[Insight-users] Still struggling with extracting information about objects resulting from a segmentation

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Thu Mar 11 16:05:59 EST 2010


Le 11 mars 10 à 17:27, Neal R. Harvey a écrit :

> I am still struggling with getting the information I need about the  
> various regions (objects) that
> I obtain from a segmentation.
> I am using ITK's watershed code to segment an image.
> Then, I want to calculate various attributes of each of the regions  
> found in the segmentation.
> For attribute calculation, I am trying to use the  
> ShapeLabelMapFilter, etc. as described in
> Lehmann's paper, entitled "Label Object Representation and  
> Manipulation with ITK".
> Richard Beare offered some hints last time and I have been trying to  
> use that, together with the
> information in the paper referred to above.
>
> Below is the snippet of code that I wrote that starts at the point  
> where I have obtained a
> segmentation from the watershed algorithm. The code compiles with no  
> problem.
> What I would expect that, if this was doing what I was hoping it  
> would do, I would see
> the same number of objects being reported from the  
> ShapeLabelMapFilter as the number
> of regions that is getting reported from the watershed segmentation.  
> However, I get the
> number of objects reported from the ShapeLabelMapFilter as zero.
>
> Can anyone suggest a fix or has any idea as to what I am doing wrong?
>
> On a slightly different, but related (i.e. it isn't a problem at the  
> moment, as the problem
> described above is not allowing the calculation of the object  
> attributes, as it doesn't
> think there are any object), is if I include calls to  
> GetFeretDiameter() or GetEquivalentRadius()
> the code won't even compile!
>
>
> typedef itk::LabelImageToShapeLabelMapFilter< WatershedImageType,  
> LabelMapType > ConverterType;
> ConverterType::Pointer converter = ConverterType::New();
> converter->SetInput( WatershedImage );
>
> // Then, can we evaluate the attributes with the dedicated filtr:  
> ShapeLabelMapFilter?
> typedef itk::ShapeLabelMapFilter< LabelMapType > ShapeFilterType;
> ShapeFilterType::Pointer shape = ShapeFilterType::New();
> shape->SetInput( converter->GetOutput() );
>
> shape->Update();
>
> LabelMapType::Pointer labelMap = converter->GetOutput();

Hi,

The problem is there: you used the output of "converter" to get the  
label map, but this output is consumed by "shape", which is a filter  
able to work in place.
You can either replace this line by

   LabelMapType::Pointer labelMap = shape->GetOutput();

or tell "shape" to not run in place before running calling Update()

   shape->SetInPlace( false );

or not use "shape" at all - the attribute values computed by this  
filter are already computed by "converter".

Regards,

Gaëtan


-- 
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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100311/4fc7a7b6/attachment.pgp>


More information about the Insight-users mailing list