[Insight-users] LabelImageToShapeLabelMapFilter

Irene Gonzálvez García irenegonzalvezg at gmail.com
Mon Jun 16 11:07:03 EDT 2008


Dear Gaëtan ,

Thanks a lot for your reply.I have been testing the example you told m 
in a previous mail changing 
"itkBinayImageToLabelCollectionImageFilter.h" by 
"itkLabelImageToLabelCollectionImageFilter.h" because i am using 
grayscale images.

In the loop:

for( int label=0; label<collection->GetNumberOfObjects(); label++ )
        {

            LabelObjectType::Pointer labelObject = 
collection->GetLabelObject( 83 );

            std::cout << label << "\t" << labelObject->GetPhysicalSize() 
<< "\t" << labelObject->GetCentroid() << std::endl;
        }
I found that some labels are not defined and I get this error:  
Description: itk::ERROR: LabelCollectionImage(017D8F10): No label object 
with label 1.  From label 2 to label 50 it works fine, but then between 
50 and 80 it occurs the same problem  (collection->GetNumberOfObjects()=85).

Is there any possibility to select only the region which value is 
maximum and calculate the centroid only for this region? And the last 
question, when I get the centroid I would like to create a new image 
which all pixels equal to zero except the centroid pixel which value 
will be equal to 1. Is there anything implemented?

Best regards and thanks a lot for your help
Irene



Gaëtan Lehmann wrote:
>
> Le 16 juin 08 à 09:07, Irene Gonzálvez García a écrit :
>
> Hi Irene,
>
> A simple example with the same filter for a binary image is available 
> at 
> http://voxel.jouy.inra.fr/darcs/contrib-itk/binaryAttributeMorphology/attribute_values.cxx , 
> or in the source code on the insight journal.
> Simply replace BinaryImageToShapeLabelMapFilter by 
> LabelImageToShapeLabelMapFilter if your input image is a label image.
>
> Regards,
>
> Gaëtan
>
>



More information about the Insight-users mailing list