[Insight-users] problems computing similarity between images

Luis Ibanez luis . ibanez at kitware . com
Wed, 20 Aug 2003 19:11:16 -0400


Hi Petra,

I typo found its way in my previous email,

Where it says:

> That is, if you requested to extract a region with
> start index (15,27) and size (300,400), form a full
> image of region (0,0)-O(1000,1000), the resulting
> image at the output will have regions (buffered,
> requested and largest) equal to
> 
>              (15,27)-(1000,1000),



It should be



> 
>              (15,27)-(300,400),
>



Sorry about that,


   Luis



================================================
Luis Ibanez wrote:
> 
> Hi Petra,
> 
> Thanks for posting the detailed code of your test.
> After running it on debugging here is what I can see:
> 
> The ExtractImageFilter is not appropriate for the
> purpose of this test, given that the image you get
> as output has its regions set *exactly* as the
> "extraction region".
> 
> That is, if you requested to extract a region with
> start index (15,27) and size (300,400), form a full
> image of region (0,0)-O(1000,1000), the resulting
> image at the output will have regions (buffered,
> requested and largest) equal to
> 
>              (15,27)-(1000,1000),
> 
> and the origin set to the same origin of your input
> image.  When this image maps indices to coordinates
> in physical space, its mappings are placed exactly
> in the same location as the original image.
> 
> In other words, the extracted region is placed in
> the same spatial location where it was when it used
> to belong to the larger image.
> 
> You could use the RegionOfInterest image filter,
> but beware that this one will put the region to
> (0,0)-(300,400) and the origin to 15*spacingX,
> 27*spacingY. So, it will also be mapped to the
> same physical location.    :-/
> 
> 
> -------
> 
> 
> What I would suggest you is to use the RegionOfInterest
> ImageFilter AND use your initial transform for specifying
> that you want to move that extracted region to be on top
> of the other region (the fixed image region).
> 
> Let's say that you want to register two regions of size
> (300,400) and with starting indices:
> 
> Region1 start index = ( 10, 20)
> Region2 start index = (120,230)
> 
> You will use Region1 to set the FixedImageRegion() on the
> registration method, and Region2 for the RegionOfInterest
> ImageFilter.
> 
> Then, prepare the initial transform to be the one
> that moves Region2 on top of Region1. That will be
> 
>   TranslationParam[0] = ( 120 - 10 ) * spacing[0];
>   TranslationParam[1] = ( 230 - 30 ) * spacing[1];
> 
> and set this parameters to the metric...
> 
> Then you will actually be comparing Region2 to Region1.
> 
> 
> 
> Please find attached the modified code that do this
> preparatoin on the initial transform, as well as its
> respective CMakeLists.txt file.
> 
> The program is expecting now the starting index of
> region2 as command line argument.
> 
> The final word about the test would be to use the output
> transform for resampling region2 on the coordinate system
> of the fixed image.
> 
> You will find several examples on how  to do this on the
> directory:
> 
>        Insight/Examples/Registration
> 
> You will find details about these examples in the
> software guide
> 
>     http://www . itk . org/ItkSoftwareGuide . pdf
> 
> - ExtractImageFilter in Section 7.5
> - RegionOfInterestImageFilter in Section 7.4
> - ResampleImageFilter in Section 6.7.1
> - RegistrationMethods in Chapter 8
> 
> 
> 
>  Please let us know if you have further questions.
> 
> 
> 
>    Thanks
> 
> 
>