[Insight-developers] ExtractImageFilter : Regions : what should they be ?
Luis Ibanez
luis.ibanez@kitware.com
Wed, 26 Mar 2003 17:12:30 -0500
Hi Jim,
There is an open issue regarding how the ExtractImageFilter
should behave regarding the values of the regions for the
output image.
Right now, the output image have its three regions set
to the exact values of the user-provided region passed
in the SetExtractionRegion() method.
That is, if we have an input image of size 200x200.
and we ask for extracting the region:
Index = 10, 15
Size = 145, 135
the output image reports to have:
LargestPossibleRegion = BufferedRegion = RequestedRegion
with
Index { 10, 15 }
Size { 145, 135 }
This confuses downstream filters. In fact it seems that
few filters are prepared to deal with a non-zero index
for the LargestPossibleRegion.
---
In some way it looks like the Largest possible region shouldn't
have an index at all, since it is redundant with the notion of
origin. The largest possible region should probably be just
"size".
The buffered region and Requested region chould be defined in
the reference frame of the largest possible region.
If you test the example in Insight/Examples/IO,
ImageReadExtractWrite.cxx
With parameters:
ImageReadExtractWrite
BrainProtonDensitySlice.png output.png 15 17 110 120
You will see that the PNG reader gets confused with the regions.
I would suggest that the ExtractImageFilter should report
an image with the corrected origin
= Input image origin + ExtractRegionStartIndex * spacing
and all its regions set to
Index={0,0} and
Size=ExtractRegionSize
Or, if there are good reasons for the current behavior of the
ExtractImageFilter, we could consider
1) Adding booleans allowing to commute the
behavior of this filter
2) Creating a new filter with the second behavior.
I'll be happy to write (2) if you find (1) to be undesirable,
Please let me know what you think,
Thanks
Luis