[ITK-users] Use more samples than available in region to compute Mattes MI metric

Carlos Hernando Ramiro CHernando at telespazio.es
Thu Jul 24 10:25:29 EDT 2014


Dear all,

I wanted to compute MattesMutualInformationImageToImageMetric just for a window of my image, so I have set an specific region with SetFixedImageRegion(region).
As I did not know the existence of UseAllPixelsOn(), I initially calculate the size of my window and set the number of samples "manually" with SetNumberOfSpatialSamples() according to that size.
I was calculating the size wrongly and I was giving SetNumberOfSpatialSamples() a number higher than the size of the region. However, after computing the metric and checking the number of pixels used with GetNumberOfPixelsCounted(), it says that it has used all the specified pixels, although they are more than the available in the region. 
When I discovered the error, I thought that although it gave me a number larger than the region it was actually using all the pixels available anyway. However, I did some tests with different numbers of pixels, which were larger than the size of the region and they provide different metric results.
So my question is, is this behaviour normal? If so, where does the metric take the extra pixels from? 

PD. Using UseAllPixelsOn() it seems to work well because at least GetNumberOfPixelsCounted() gives me the number of pixels available in the region, but it would be great if I could somehow confirm it.


Best regards
Carlos


More information about the Insight-users mailing list