[Insight-users] Compute the overlapping volume of two images (by SimilarityIndexImageFilter)

Michael Schildt michael.schildt at ifn-magdeburg.de
Mon Nov 12 04:32:19 EST 2007


Hello Xabi!

Thank you for the answer because it is 99% what I want (at a first look):
- I clone both images
- set all pixels in both clones to a non-zero value
- set both clones as input for SimilarityIndexImageFilter
- do SimilarityIndexImageFilter->Update();
-> SimilarityIndexImageFilter->GetSimilarityIndex () should return the
number of overlapping pixels

So, this is the theory. As always, when looking in the documentation it
doesn't tell much about principles and prerequisits, only about the
syntax. What happens if the images have different pixels sizes and
different regions?

The sentences "This filter requires the largest possible region of the
first image and the same corresponding region in the second image."
should tell me something about it. A region is defined by an start index
and a size. "Same region" probably means only images of same region and
position will be compared, else error is thrown.

The defined measure S, which equals to two times the number of common
non-zero pixels in both images devided by the sum of the total number of
non-zero pixels of each image, is only valid if both images have the
same number of pixels with same pixel spacing and identical image
position. Else it will be difficult or impossible to define coresponding
pixels.

I quess, as a solution for images with different number of pixels,
different pixel sizes and or different position but same volume defined
by identical width, height and depth could be characterized by something
like S' equals two times the common volume covered by both images
divided by the sum of both volumes.
For implementation one can think of something like:
- set pixel_counter to zero
- iterate through all pixels of image one
    - for each pixel, test if it is contained within the volume defined
by image two (ImageSpatialObject->IsInside(...))
    - if contained increment pixel_counter
- volume = pixel_counter * pixel size of image one
- overlap = 2* volume / (number of pixel * pixel size of image one +
number of pixel * pixel size of image two)

It should be straight forward to implement this if one is an experienced
ITK implementor, which isn't true for me. I'm unsure about:
- The filter should be derived from "ImageToImageFilter"
- Which methods I have to implement
- How to write Test Programm
- ...

So, I will read the chapter 13 of the ITK-Guide "How to write a filter"
and try, if i have some time. ;)

Best requrads,
    Michael

Xabier Artaechevarria Artieda schrieb:
> Hi Michael,
> this filter is not exactly what you are looking for, but it is 
> generally used to assess the quality of a segmentation:
>
> http://www.itk.org/Doxygen32/html/classitk_1_1SimilarityIndexImageFilter.html 
>
>
> Regards,
> Xabi
>



More information about the Insight-users mailing list