[Insight-users] MultiResolution Registration
Luis Ibanez
luis . ibanez at kitware . com
Mon, 10 Nov 2003 22:58:46 -0500
Hi Bing,
The Multi-Resolution framework actually creates
a pyramid of images, where each level is a shrinked
version of the original image.
The subsampling process is done by the MultiResolution
Pyramid class
http://www . itk . org/Insight/Doxygen/html/classitk_1_1RecursiveMultiResolutionPyramidImageFilter . html
The pyramid structure is smoothing the data using a
RecursiveGaussianImageFilter and then subsampling
by the factor that you specified.
[ Subsampling must always be preceeded by smoothing
in order to avoid aliasing effect resulting from
the overlap of the spectra in the frequency domain. ]
Of course, if your subsampling factor is 2, the
region size of the resulting level will have
half the size (measured in number of pixels) than
the previous level. NOTE however that the spacing
will also be doubled, so the total physical extent
of the image measured in millimeters will still
be the same in both levels.
If you have a pyramid with two levels and the
scaling factor between them is 2, then when you
read the pixel value at index (0,1) in the coarser
level, this position will be equivalent to index
(0,2) in the finer level.
If you want to verify this experimentally, simply
connect an ImageFileWriter to every level of the
pyramid and save the different levels to MetaImage
format.
Upon inspection of these files you should find that
the spacing on each level increases as they go to
the top of the pyramid while the region size decreases.
Use the ImageViewer application in InsightApplication
in order to view these images. You will be able to
click and probe homologous pixels (by opening two
viewers simultaneously, each one with one level of the
pyramid). The coordingates printed out on the lower
right corner of the viewer will show you the positions
in millimiters.
Please let us know if you have further questions.
Thanks
Luis
-------------------
Bing Jian wrote:
> Hi, Luis,
>
> Following code snippet is copied from
> itkMultiResolutionImageRegistrationMethod.txx
>
> I'm wondering if it does shrink the orginal image.
> For me, it seems just cutting the size of original
> region. For example, if scaleFactor is 2, start=[0,0],
> size = [w,h], then the new region will starts from
> [0,0] and ends at [w/2, h/2]. But where is the job
> done to filter out those pixels at unused grid points?
>
> If I set an iterator (named it) with the orginal image
> and this new cutted region, after one ++it operation,
> what's the data returned by it.Get(). Is it the pixel value
> at original index (0,1) or original index (0,2)? and when
> it.AtEnd(), the data is value at (w,h) or (w/2, h/2)?
>
> Hope it's clear.
>
> Thanks in advance!
>
> // Compute the FixedImageRegion corresponding to each level of the
> // pyramid. This uses the same algorithm of the ShrinkImageFilter
> // since the regions should be compatible.
> for ( unsigned int level=0; level < m_NumberOfLevels; level++ )
> {
> SizeType size;
> IndexType start;
> for ( unsigned int dim = 0; dim < TFixedImage::ImageDimension;
> dim++)
> {
> const float scaleFactor = static_cast<float>( schedule[ level ][
> dim ] );
>
> size[ dim ] = static_cast<typename SizeType::SizeValueType>(
> floor( static_cast<float>( inputSize[ dim ] ) / scaleFactor )
> );
> if( size[ dim ] < 1 )
> {
> size[ dim ] = 1;
> }
>
> start[ dim ] = static_cast<typename IndexType::IndexValueType>(
> ceil( static_cast<float>( inputStart[ dim ] ) / scaleFactor )
> );
> }
> m_FixedImageRegionPyramid[ level ].SetSize( size );
> m_FixedImageRegionPyramid[ level ].SetIndex( start );
> }
>