[ITK] Computing/Getting the attributes of ShapeLabelObject

Zein Salah zeinsalah at gmail.com
Tue Dec 9 09:03:58 EST 2014


And by the way, some attributes, like centroid, physical size,
regionelongation are computed. Others, like roundness are not !


On Tue, Dec 9, 2014 at 2:25 PM, Zein Salah <zeinsalah at gmail.com> wrote:
> Hi,
>
> I want to compute some shape properties  of segmented objects in a binary image.
> S I used the code below to create a labelmap.  BTW, I am using ITK 3.14.
>
>    typedef unsigned long LabelType;
>    typedef itk::ShapeLabelObject< LabelType, 3 > LabelObjectType;
>    typedef itk::LabelMap< LabelObjectType > LabelMapType;
>
>    typedef itk::BinaryImageToShapeLabelMapFilter< OverlayImageType,
> LabelMapType > ConverterType;
>    ConverterType::Pointer converter = ConverterType::New();
>    converter->SetInput(m_SegmentedImage);
>    converter->SetInputForegroundValue(255);
>    converter->Update();
>
>    LabelMapType::Pointer labelMap = converter->GetOutput();
>
>    for( unsigned int label=0; label <
> labelMap->GetNumberOfLabelObjects(); label++ )
>    {
>        const LabelObjectType * labelObject = labelMap->GetNthLabelObject(label);
>        LabelObjectType::CentroidType centroid = labelObject->GetCentroid();
>        std::cout << label << ": " << labelObject->GetCentroid() << "   "
>                                   << labelObject->GetPhysicalSize() << "   "
>                                   << labelObject->GetRegionElongation() << "   "
>                                   << labelObject->GeRoundness()
>                                   << std::endl;
>    }
>
>
> Strangely, the output of the Roundness is always 0. Moreover, it seems that
> some attrubutes are not implemented, e.g. GetElongation,
> GetboundingBox. From the
> corresponding IJ paper, I could not really understand if the the
> attributes are computed
> or need to computed elsewhere.
>
> Any hints how this should work?
>
> Thanks,
> Zein


More information about the Community mailing list