[ITK] Computing/Getting the attributes of ShapeLabelObject

Bradley Lowekamp blowekamp at mail.nih.gov
Tue Dec 9 09:11:06 EST 2014


Hello,

ITK 3.14 is over 5 years old, and appears not to even have this IJ paper merged into the Review directory. I _strongly_ recommend upgrading! I don't even know what code you are using.

It looks like the IJ paper says the roundness is related to the ratio of the areas, but currently (4.7rc1) it computation is does as a ratio of the perimeters[1]. The BinaryImageToShapeLabelMapFilter has some optional computation, among those are computing the peremeter, did you try calling BinaryImageToShapeLabelMapFilter::ComputePerimeterOn()?


Brad

[1] https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx#L625

On Dec 9, 2014, at 8:25 AM, 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
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community



More information about the Community mailing list