[Insight-users] Mutual Info-based Registration on Ultrasoundimage
Luis Ibanez
luis.ibanez at kitware.com
Fri, 23 Apr 2004 16:13:42 -0400
Hi Thomas,
Could you please be more specific ?
Are we talking about the image that you read using
the ImageFileReader ?
If this is the case, the spacing should already be
set by the reader. If the spacing that you see
when you invoke GetSpacing() doesn't match what
you think it is in the image file, then this may
indicate a bug in the respective reader.
What fileformat are you using for storing your images ?
Note that many fileformats don't have spacing information
since they are not necessarily designed for storing
medical images. In those cases, ITK readers set the
spacing to the default value = 1.0.
If your file doesn't have spacing information,
you could use the itk::ChangeInformationImageFilter
in order to set the spacing of the image. In practice
this is a dangerous operation, and it may be a better
idea to chose a more formal image fileformat.
Calling SetSpacing in the GetOutput() image of a filter
will not work, because the filter owns the image and
will refresh the information anytime you call Update()
again.
You should *not* attempt to modify the content of
an image that you obtained as GetOutput() from
an ITK filter. At some point we should impose
const-correctness to the GetOutput() call in order
to prevent unwanted modifications.
There is no point in worrying about your registration
process until you solve the spacing issue. ITK performs
registration in physical coordinates (e.g. millimeters),
so it is fundamental that you make sure that your images
have correct information about their Origin and Spacing.
A simple exercise for verifying what you are getting
after reading is to do:
reader->Update()
reader->GetOutput()->Print( std::cout );
That will show you information about the image read
from the file, including origin and spacing.
Regards,
Luis
-----------------------------
Thomas - Kuiran Chen wrote:
> Hi Luis,
>
> I've been playing with the mattes mutual information implementation program you sent me for a while. :-)
>
> Do I have to explicitly set the pixel spacing using itk::Image::SetSpacing? The reason is that when I use the GetSpacing method of the itk::Image to check what is the spatial setting to read in the image, I found the it was (1,1), which is incorrect because my ultrasound image has a pixel-pixel distance of 0.1 mm. My guess is that (1,1) could be the default setting in ITK.
>
> What is more interesting is that even if I set the spacing explicitly as in the example (Image4.cxx), the output (using cout) always shows (1,1). I've explicitly called Update() to refresh the pipeline but it didn't work?
>
> Did I do something wrong here?
>
> Now what I got is: for two ultrasound images with one of them being shifted a distance in X-axis, the program gives a large mutual info (which is good), but the suggested translation parameters are unbelievable: X- 56.405, Y - 5.29456. If the parameters are given in millimeters, this would have translated the object completely out of the image (as the image size is only 380 x 340 pixels, which is 38x34 mm).
>
> That's why I questioned if there should be some setting of pixel spacing I should perform before hand.
>
> Thanks a lot,
>
> Thomas
>
>
> ---------------------- Original Message ------------------------
> From: Luis Ibanez <luis.ibanez at kitware.com>
> To: Thomas - Kuiran Chen <chent at cs.queensu.ca>
> Sent: 2004-04-20 15:57:27
> Subject: Re: [Insight-users] Mutual Info-based Registration on Ultrasoundimage
>
>
> Hi Thomas,
>
> Let me start by saying that we all have a lot of respect
> for those who dare to work with Ultra Sound images. :-)
>
> Ultrasound is more challenging for Mutual Information due
> to the presence of speckle/noise. Since MI uses a reduced
> number of samples (typically 50 to 100), there are good
> chances that the Metric values will have a large variability
> because samples will fall sometimes in bright speckle spots
> and sometimes in dark speckle spot.
>
> I will suggest you to start by using the Mattes implementation
> of Mutual Information. This Metric produces a less noisy output
> than the Viola-Wells implementation. This will not yet solve
> your problem though...
>
>
> Are you trying to register UltraSound to UltraSound ?
> or UltraSound to MRI ?
>
> This will be very important in order to chose the metric and
> anticipate its behavior.
>
>
>
>
> In order to get some insight on how to tune the parameters
> for your optimization, probably the best thing to do is to
> study the characteristics of the Metric when computed over
> your images. Please find attached a small program that allows
> you to explore the values of the metric using a translation
> transform. You want to plot these values in order to get a
> feeling on the level of noise of the Metric, the presence
> of local minima, and the overall reproducibility of the Metric
> function itself. (you will have to convert the dimension
> to 3D, since the example was configured for 2D)
>
> Please run this program first using the *same* input image
> as fixed and moving images, and let the translation be
> evaluated for a range that is close to 1/2 of the image extent
> (physical extent in millimeters).
>
> Plot the values using your favorite plotting program. (anything
> from GNUPlot to Excel).
>
> For examples on how these plot will look like, please take
> a look at the course in Image Registration:
>
> http://www.cs.rpi.edu/courses/spring04/imagereg/
>
> In particular, look at lectures 8 and 9.
>
>
> Once you get this plot, I'll suggest you to experiment with
> the edge preserving smoothing filters described in the Software
> Guide. Run these filter as pre-processing of the input images,
> and then repeat the metric plots. Since the filters will reduce
> the noise, and hopefully some of the US speckle, it is to expect
> that the Metric plot will also be smoothed... and therefore
> easier to optimize.
>
> You could also give it a try to more traditional smoothing such
> as Gaussians....
>
> ---
>
> It is not productive to fight with the registration + optimization
> until you find a way of generating relatively smooth Metric plots.
> Note that this is just an exercise on learning how to tune the
> parameters. Once you figure out the parameters, you will not need
> to plot the Metric anymore.
>
> Make sure that origin and spacing are correctly set in your images
> before you start computing all these metric plots.
>
>
>
> Please let us know if you have further questions.
>
>
> Thanks
>
>
> Luis
>
>
> -------------------------
> Thomas - Kuiran Chen wrote:
>
>
>>Hi Luis,
>>
>>I've been trying to use ITK's implementation of viola's mutual information based registration (itk::MutualInformationImageToImageMetric) for ultrasound images.
>>
>>The parameter settings of the matric in the example (ImageRegistration2) work well on MRI image, but when I tried with ultrasound images (I even tried two identical images), the result was interesting but somehow unexpected. The bestValue from the optimizer was around 0.5 (mutual info entropy), and the program suggested a translation of (0.11, 0.09) along X and Y directions, and the number of iterations used was 200.
>>
>>The parameters need to be set are (as for the MRI image - BrainT1SliceBorder20.pgn, in the example):
>>
>>1. for itk::MutualInformationImageToImageMetric:
>>- Fixed and moving image standard deviation, the example suggests 0.4;
>>- Number of Spatial Sample Bins, the example uses 50;
>>
>>2. for itk::DiscreteGaussianImageFilter:
>>- Fixed and moving image smoother various, the example sets 2.0
>>
>>3. for itk::GradientDescentOptimizer:
>>- learning rate: set to 20.0 in the example
>>- number of iterations: 200
>>
>>Can you provide any hints/guidelines of how to play with these parameters for different image modality? In particular, those work for ultrasound images? Also is there any text I can find to explain these parameters in more details?
>>
>>Thanks a lot,
>>Thomas
>>
>>
>>
>
> ================================================================
>
>
> --------------------------------------------------------------------
>
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>