[Insight-users] Re: SetFixedImageRegion

Luis Ibanez luis.ibanez at kitware.com
Thu Sep 16 18:29:17 EDT 2004


Hi Wei,

In order to combine both the Fixed and Resampled Moving
image in a single image, you must perform two resamplings.

Please do the following:

A) First you must estimate the size of the image that will
    be able to contain the composition of the fixed and the
    resampled moving image.

B) Use the ResampleImageFilter and especify that size as
    the output image size. use the Identity transformation
    and provide the fixed image as input. That will map the
    fixed image into the frame of the final combined image.

C) Use *another* ResampleImageFilte, set the same output
    size to the size of the combined image that you computed
    in (A), set the transform to the one that you got from
    your registration, set the moving image as the input to
    this filter, and execute the filter.

D) Finaly, take the two images resulting from (B) and (C)
    and merge them using the OR filter or the MAX image
    filters.  You may eventually prefer to implement a
    blending filter for this task.


Regards,


    Luis



--------------------
Wei-Lin Bee wrote:

> Hi Luis,
> 
> Thank you very much for your instruction.
> 
> I've change MutualInformationImageToImageMetric to MeanSquaresImageToImageMetric
> and replaced related parameters. Now the program seems work well.
> 
> 
> One more question:
> 
> The output image seems to be resampled moving image at the time. How to combine
> fixed image and moving image to a stitched one as output image?
> 
> 
> Thanks abound!
> 
> 
> Best,
> Tiger
> 
> ps. again, the attachment is my program for your reference...
> 
> 
> 
> Quoting Luis Ibanez <luis.ibanez at kitware.com>:
> 
> 
>>Hi Wei,
>>
>>Thanks for your detailed report.
>>
>>Your code seems to be in good shape.
>>
>>The run-time problem that you are facing is
>>an exception being thrown when you invoke the
>>method GetValue() in the MutualInformation metric.
>>
>>You *must* put GetValue() inside a try/catch block
>>so you will be able to know when an exception is
>>thrown.  Please look at the ITK SoftwareGuide,
>>
>>    http://www.itk.org/ItkSoftwareGuide.pdf
>>
>>there are multiple examples on how to catch exceptions.
>>
>>
>>Once you add the try/catch block, this particular
>>exception will show you the following message:
>>
>>
>>itk::ExceptionObject (0x8199f10)
>>Location: "Unknown"
>>File:
>>
> 
> /home/ibanez/src/Insight/Code/Algorithms/itkMutualInformationImageToImageMetric.txx
> 
>>Line: 155
>>Description: itk::ERROR: MutualInformationImageToImageMetric(0x8139878):
>>All the sampled point mapped to outside of the moving image
>>
>>
>>Which means that MutualInformation was not able to find enough sampling
>>point in the subregion in which you are performing this computation.
>>
>>
>>As you probably know, after reading the Registration chapter
>>from the SoftwareGuide, MutualInformation samples the image
>>randomly in order to compute the joint histogram of gray levels.
>>When not enough samples fall inside the FixedImageRegion, this
>>exception is thrown, because the estimation is expected to be
>>very poor with such a small number of samples.
>>
>>
>>You could go around this by increasing the number of samples....
>>but in practice, what we could suggest you is to NOT use Mutual
>>Information as the metric for this task. This is based on two
>>arguments:
>>
>>
>>1) Your images are of the same modality.
>>
>>2) Your images are almost black with scattered bright signals
>>    (we assume they are cells in fluorescent microscopy).
>>    In that regard, information is only carried by the cells, not
>>    the background. The chances that some of the samples from Mutual
>>    Information will fall inside a cell are very small. In most cases
>>    your image will appear simply as a black field to the IM Metric.
>>
>>
>>Please replace Mutual Information with a metric better suited for
>>this problem, such as Normalized Correlation, or MeanSquares.
>>
>>
>>BTW: Now you will not need to compute 100 times the metric and make
>>an average from it. You will not need the Normalization filters
>>either, since NormalizedCorrelation is invariant to linear changes
>>in the intensity levels.
>>
>>
>>Also, remember to put always *try/catch* blocks around the pieces
>>of code that can potentially throw exceptions.
>>
>>
>>
>>   Regards,
>>
>>
>>
>>      Luis
>>
>>
>>
>>--------------------
>





More information about the Insight-users mailing list