[Insight-users] itk::StatisticsLabelMapFilter with input image size != feature image size

Luis Ibanez luis.ibanez at kitware.com
Fri Dec 10 17:43:12 EST 2010


Here is a suggestion:

We could implement it as an option in the filter,
under the control of a boolean flag.

Granted, it is not elegant,
but will do the trick.

We may have to think hard about a very
descriptive name for such boolean flag.

Maybe:

         RequireSameImageGrid

or

         AllowNonAlignedImageGrids


The documentation of such flag should
include a warning about the impact on
the computation time.


    Luis


------------------------------
On Fri, Dec 10, 2010 at 10:41 AM, Arnaud GELAS
<arnaud_gelas at hms.harvard.edu> wrote:
> Hi Gaetan,
>
> You're right, this is a general problem!
>
> We could add conditions on origin, spacing, direction in such filters, and
> use the current implementation; else we could either use
> TransformPhysicalPoint as Luis suggested, either throw an exception. This
> would impact a lot of filters.
>
> Thoughts?
>
> Best,
> Arnaud
>
> On 12/10/2010 09:40 AM, Gaėtan Lehmann wrote:
>>
>> Hi,
>>
>> Yes, the image must have the same origin, spacing and direction.
>> It should be possible to have a larger feature image than the label
>> map, but that's all.
>>
>> This is a very usual requirement in the ITK filters, and I think that
>> most of them have this constraint.
>> Pixels are accessed through their index, not their physical position.
>> If the images are not aligned, it becomes a bit more difficult to
>> access the data.
>>
>> I think the question of whether we should do that or not is not
>> specific to that filter, but should be discussed for all the filters
>> which are using more than one input - for example
>> itk::BinaryFunctorImageFilter
>>
>> Regards,
>>
>> Gaėtan
>>
>>
>> Le 10 déc. 10 ą 13:12, Luis Ibanez a écrit :
>>
>>> Hi Arnaud,
>>>
>>> Given that the algorithm visits all the pixels
>>> from the lines of the label objects and use
>>> them to query the feature image in line:
>>>
>>> itkStatisticsLabelMapFilter.txx:120
>>>
>>> const FeatureImagePixelType&  v = featureImage->GetPixel(idx);
>>>
>>> it would seem that we just need to insert the guard:
>>>
>>> if( ! featureImage->GetBufferedRegion().IsInside( idx ) ) continue;
>>>
>>> just before the GetPixel line.
>>>
>>>
>>> Then, the statistics will be computed using only the overlapping
>>> regions between the LabelMap and the feature image.
>>>
>>> Yet, a more tempting option is to let the feature image be of
>>> any origin, spacing and orientation by introducing the
>>> following code:
>>>
>>> labelMap->TransformIndexToPhysicalPoint( idx, ptx );
>>> bool isInside = featureImage->TransformPhysicalPointToIndex( ptx,
>>> idx2 );
>>> if( ! isInside ) continue;
>>> const FeatureImagePixelType&  v = featureImage->GetPixel(idx);
>>>
>>>
>>> There is a price in computation time,...
>>> but the added generality seem to be worth it.
>>>
>>>
>>>    Luis
>>>
>>>
>>> ---------------------------------------------
>>> 2010/12/9 Gelas, Arnaud Joel Florent<Arnaud_Gelas at hms.harvard.edu>:
>>>>
>>>> Vince,
>>>>
>>>> Thanks for your reply!
>>>>
>>>> That's also what I thought; but I got some code from a student with
>>>> such a case. The code does not fail, and even provides results
>>>> (most probably not the right ones, but it does).
>>>>
>>>> Would it be possible to add exceptions to handle these cases
>>>> (different origin, spacing, etc...) if it is not supposed to work ?
>>>>
>>>> Thanks,
>>>> Arnaud
>>>> ________________________________________
>>>> From: Magnotta, Vincent A [vincent-magnotta at uiowa.edu]
>>>> Sent: Wednesday, December 08, 2010 10:13 PM
>>>> To: Gelas, Arnaud Joel Florent; Gaėtan Lehmann
>>>> Cc: ITK Users
>>>> Subject: RE: [Insight-users] itk::StatisticsLabelMapFilter with
>>>> input image size != feature image size
>>>>
>>>> Arnaud,
>>>>
>>>> My reading of the algorithm is that the images must be of the same
>>>> size, spacing, directions, and origin to work correctly.
>>>>
>>>> Vince
>>>>
>>>>
>>>> ----------------------
>>>> Associate Professor
>>>> Department of Radiology
>>>> 0453-D JCP
>>>> 200 Hawkins Drive
>>>> Iowa City, IA 52242
>>>> E-mail: vincent-magnotta at uiowa.edu
>>>> Phone: 319-356-8255 Fax: 319-353-6275
>>>> Website: http://www.radiology.uiowa.edu
>>>>
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: insight-users-bounces at itk.org on behalf of Arnaud GELAS
>>>> Sent: Wed 12/8/2010 3:45 PM
>>>> To: Gaėtan Lehmann
>>>> Cc: ITK Users
>>>> Subject: [Insight-users] itk::StatisticsLabelMapFilter with input
>>>> image size != feature image size
>>>>
>>>> Hi Gaetan,
>>>>
>>>> In itk::StatisticsLabelMapFilter, does the feature image need to be
>>>> aligned (same origin, same spacing) with the input one?
>>>>
>>>> For instance, can you use this filter with a feature image larger
>>>> than
>>>> the input one, i.e. the input one is a ROI from one label map with
>>>> same
>>>> spacing, origin from the feature image?
>>>>
>>>> Thanks,
>>>> Arnaud
>>>> _____________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Kitware offers ITK Training Courses, for more information visit:
>>>> http://www.kitware.com/products/protraining.html
>>>>
>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>> http://www.itk.org/Wiki/ITK_FAQ
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>
>>>>
>>>> _____________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Kitware offers ITK Training Courses, for more information visit:
>>>> http://www.kitware.com/products/protraining.html
>>>>
>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>> http://www.itk.org/Wiki/ITK_FAQ
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>
>
>


More information about the Insight-users mailing list