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

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


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