[Insight-users] itk::StatisticsLabelMapFilter with input image size != feature image size
Gaëtan Lehmann
gaetan.lehmann at jouy.inra.fr
Fri Dec 10 09:40:41 EST 2010
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
>>
--
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
http://voxel.jouy.inra.fr http://www.itk.org
http://www.mandriva.org http://www.bepo.fr
More information about the Insight-users
mailing list