1 / 63

# Image Registration Lecture 8: Image Resampling

Image Registration Lecture 8: Image Resampling. Prof. Charlene Tsai. Why Resampling ?. Resampling is the Essence of Intensity Based Image Registration. What is an Image ?. An Image is a sampling of a continuous field using a discrete grid. y. x. Image Origin &amp; Spacing.

## Image Registration Lecture 8: Image Resampling

E N D

### Presentation Transcript

1. Image Registration Lecture 8: Image Resampling Prof. Charlene Tsai

2. Why Resampling ? Resamplingis the Essence of Intensity BasedImage Registration Lecture 7

3. What is an Image ? An Image is a sampling of a continuous fieldusing a discrete grid Lecture 7

4. y x Image Origin & Spacing Spacing (Sx) Spacing (Sy) Origin (Ox,Oy) Lecture 7

5. Image Sampling Grid Spacing (Sx) Spacing (Sy) Origin (Ox,Oy) Lecture 7

6. Image Pixel Spacing (Sx) Pixel Value Pixel Region Spacing (Sy) Origin (Ox,Oy) Lecture 7

7. Image Indices Spacing (Sx) Pixel Index [0,7] [4,7] [0,6] [0,5] [0,4] [0,3] [0,2] Spacing (Sy) [0,1] [0,0] [1,0] [2,0] [3,0] [4,0] [5,0] Origin (Ox,Oy) Lecture 7

8. Index to Physical Coordinates Spacing (Sx) Pixel Index [0,7] [4,7] [0,6] [0,5] P[0] = Index[0] x Spacing[0] + Origin[0] P[1] = Index[1] x Spacing[1] + Origin[1] [0,4] Index[0] = floor( ( P[0] - Origin[0] ) / Spacing[0] + 0.5 ) [0,3] Index[1] = floor( ( P[1] - Origin[1] ) / Spacing[1] + 0.5 ) [0,2] Spacing (Sy) [0,1] [0,0] [1,0] [2,0] [3,0] [4,0] [5,0] Origin (Ox,Oy) Lecture 7

9. Image Region Spacing (Sx) Pixel Value Image Region Pixel Region Spacing (Sy) Origin (Ox,Oy) Lecture 7

10. Image Region Spacing (Sx) Region Size Image Region [3,5] Starting Index [2,3] Spacing (Sy) Origin (Ox,Oy) Lecture 7

11. Basic Resampling ResamplingTrivial Cases Lecture 7

12. Spacing ( 2 x Sx ) Spacing ( 2 x Sy ) Sub-Sampling by Half Spacing (Sx) Image Region Spacing (Sy) Origin (Ox,Oy) Lecture 7

13. Sub-Sampling by Half New Spacing S’x New Spacing S’y New Origin (O’x,O’y) Origin (Ox,Oy) Lecture 7

14. Super-Sampling by Double Spacing ( Sx/2 ) Spacing (Sx) Spacing ( Sy/2 ) Image Region Spacing (Sy) Origin (Ox,Oy) Lecture 7

15. New Spacing S’y Super-Sampling by Double New Spacing S’x New Origin (O’x,O’y) Origin (Ox,Oy) Lecture 7

16. Resampling in ITK itk::ResampleImageFilter Lecture 7

17. Input Image Output Image Resampling in ITK Origin Spacing Region Size Resample Filter Region Start Transform Interpolator Lecture 7

18. Resample Image Filter #include "itkImage.h" #include "itkResampleImageFilter.h" #include "itkIdentityTransform.h“ #include "itkLinearInterpolateImageFunction.h" typedef itk::Image< char, 2 > ImageType; ImageType::PointerinputImage = GetImageSomeHow(); typedef itk::ResampleImageFilter< ImageType > FilterType; FilterType::Pointerresampler = FilterType::New(); ImageType::SizeTypesize; size[0] = 200; size[1] = 300; ImageType::IndexTypestart; start[0] = 0; start[1] = 0; Lecture 7

19. Resample Image Filter ImageType::PointTypeorigin; origin[0] = 10.0; // millimeters origin[1] = 25.5; // millimeters ImageType::SpacingTypespacing; spacing[0] = 2.0; // millimeters spacing[1] = 1.5; // millimeters resampler->SetOutputSpacing( spacing ); resampler->SetOutputOrigin( origin ); resampler->SetSize( size ); resampler->SetOutputStartIndex( start ); resampler->SetDefaultPixelValue( 100 ); resampler->SetInput( inputImage ); Lecture 7

20. Resample Image Filter typedef itk::LinearInterpolateImageFunction<ImageType, double > InterpolatorType; InterpolatorType::Pointerinterpolator = InterpolatorType::New(); typedef itk::TranslationTransform< double, 2 > TransformType; TransformType::Pointertransform = TransformType::New(); transform->SetIdentity(); resampler->SetInterpolator( interpolator ); resampler->SetTransform( transform ); resampler->Update(); const ImageType *outputImage = resampler->GetOutput(); Lecture 7

21. Basic Registration RegistrationBasics Lecture 7

22. j j i i Image Grid Image Grid y’ y y x Space Transform x’ x Physical Coordinates Physical Coordinates Coordinate System Conversions Lecture 7

23. I will not register images in pixel space I will not register images in pixel space I will not register images in pixel space I will not register images in pixel space I will not register images in pixel space I will not register images in pix Things I will not do… Lecture 7

24. j j i i Moving Image Grid Fixed Image Grid y’ y Space Transform x’ x Moving ImagePhysical Coordinates Fixed ImagePhysical Coordinates Fixed Image & Moving Image Lecture 7

25. Selecting Moving & Fixed Images In principle the denomination of Fixed Image & Moving Image is arbitrary In practice the moving image is the one that will be resampled into the fixed image coordinate system Lecture 7

26. MRI-T2 PET 128 x 128 pixels 256 x 256 pixels Quiz #1 Images from the same patient Moving Image ? Fixed Image ? Images provided as part of the project: “Retrospective Image Registration Evaluation”, NIH, Project No. 8R01EB002124-03, Principal Investigator, J. Michael Fitzpatrick, Vanderbilt University, Nashville, TN. Lecture 7

27. MRI-T2 PET 128 x 128 pixels 256 x 256 pixels Scaling Transform Quiz #2 Images from the same patient What scale factor ? • 2.0 • 1.0 • 0.5 Images provided as part of the project: “Retrospective Image Registration Evaluation”, NIH, Project No. 8R01EB002124-03, Principal Investigator, J. Michael Fitzpatrick, Vanderbilt University, Nashville, TN. Lecture 7

28. Security Airport Security "Do not accept packages or baggage from unknown individuals." Image Security "Do not accept images or volumes without pixel spacing." Lecture 7

29. Exercise #1 Output Image Size: 181x217 pixels Spacing: 0.8 x 0.9 mm Input Image Size: 181x217 pixels Spacing: 0.8 x 0.9 mm Coordinates ? Coordinates ? ( 0.0mm , 195.3mm ) ( 144.8mm , 195.3mm ) Output Origin ( 35.0mm , 50.0mm ) Coordinates ? Origin: (0,0) ( 144.8mm , 0.0mm ) Lecture 7

30. Exercise #1 Output Image Size: 181x217 pixels Spacing: 0.8 x 0.9 mm Input Image Size: 181x217 pixels Spacing: 0.8 x 0.9 mm Origin: (0,0) Lecture 7

31. Resample Image Filter #include "itkImage.h" #include "itkResampleImageFilter.h" #include "itkIdentityTransform.h" #include "itkNearestNeighborInterpolateImageFunction.h" typedef itk::Image< char, 2 > ImageType; ImageType::ConstPointerinputImage = reader->GetOutput(); typedef itk::ResampleImageFilter< ImageType > FilterType; FilterType::Pointerresampler = FilterType::New(); ImageType::RegionTyperegion = inputImage->GetBufferedRegion(); resampler->SetSize( region->GetSize() ); resampler->SetOutputStartIndex( region->GetIndex() ); resampler->SetOutputSpacing( inputImage->GetSpacing() ); Lecture 7

32. Resample Image Filter ImageType::PointTypeorigin; origin[0] = 35.0; // millimeters origin[1] = 50.0; // millimeters resampler->SetOutputOrigin( origin ); typedef itk::IdentityTransform< double, 2 > TransformType; TransformType::Pointertransform = TransformType::New(); resampler->SetTransform( transform ); resampler->SetDefaultPixelValue( 100 ); resampler->SetInput( inputImage ); writer->SetInput( resampler->GetOutput() ); writer->Update(); Lecture 7

33. Exercise #1 Output Image Size: 181x217 pixels Spacing: 0.8 x 0.9 mm Input Image Size: 181x217 pixels Spacing: 0.8 x 0.9 mm Origin: (0,0) Lecture 7

34. Transform ? Quiz #3 Moving Image Size: 181x217 pixels Spacing: 0.8 x 0.9 mm Fixed Image Size: 181x217 pixels Spacing: 0.8 x 0.9 mm Origin: (0,0) Origin: (35,50) Lecture 7

35. I will not register images in pixel space I will not register images in pixel space I will not register images in pixel space I will not register images in pixel space I will not register images in pixel space I will not register images in pix Things I will not do… Lecture 7

36. Transform ? Quiz #4 Moving Image Size: 181x217 pixels Spacing: 0.8 x 0.9 mm Fixed Image Size: 181x217 pixels Spacing: 0.8 x 0.9 mm Origin: (0,0) Origin: (0,0) Lecture 7

37. Return to the Source Output Image Size: 181x217 pixels Spacing: 0.8 x 0.9 mm Input Image Size: 181x217 pixels Spacing: 0.8 x 0.9 mm Translation ( -35 , -50 ) (35,50) Origin: (0,0) Origin: (0,0) Lecture 7

38. More Resampling ResamplingLess Trivial Cases Lecture 7

39. Rotation y y Transform 10o x x Fixed Moving Lecture 7

40. Rotation y y Transform 10o x x Fixed Moving Lecture 7

41. Rotation y y Transform 10o x x Fixed Moving Lecture 7

42. Rotation around the Origin Spacing (Sx) Spacing (Sy) Rotation Center Origin (Ox,Oy) Lecture 7

43. Rotation around the Origin Spacing (Sx) Spacing (Sy) Origin (Ox,Oy) Lecture 7

44. Rotation around the Origin DefaultPixelValue Origin (Ox,Oy) Lecture 7

45. Rotation around the Center y y Transform 10o x x Fixed Moving Lecture 7

46. Rotation around the Center y y Transform 10o x x Fixed Moving Lecture 7

47. Rotation around the Center y y Transform 10o x x Fixed Moving Lecture 7

48. Rotation around the Center y y Transform 10o x x Fixed Moving Lecture 7

49. Rotation around the Center Spacing (Sx) RotationCenter Spacing (Sy) Origin (Ox,Oy) Lecture 7

50. Rotation around the Center Spacing (Sx) Spacing (Sy) Origin (Ox,Oy) Lecture 7

More Related