Trying to access LabelGeometryImageFilter in ITK 5.2.1.post1 python package.

Dear ITK devs,
Many thanks for creating such a solid tool. I am currently trying to migrate from SimpleITK to ITK python because of LabelGeometryImageFilter’s ability to calculate orientation as well. I would like to calculate the orientation of the binary label objects for my morphometric analysis.
I installed ITK 5.2.1.post1 using PIP (itk-filtering included, OS: Linux and Mac) . However, when I try to use LabelGeometryImageFilter using “itk. LabelGeometryImageFilter” - I get the following error: AttributeError: module ‘itk’ has no attribute ‘LabelGeometryImageFilter’. Am I doing something wrong? Any guidance would be highly appreciated.
Many thanks,
Lalith :slight_smile:

Hello @LalithShiyam

Possibly take a look at SimpleITK’s LabelShapeStatisticsImageFilter, it computes orientation information too. For a detailed usage example, characterizing the shapes of bacteria, see this jupyter notebook.

1 Like

LabelGeometryImageFilter is part of Review module, and is not built by default. To get it, you should compile ITK with Python wrapping and Module_ITKReview turned on.

1 Like

Many thanks :slight_smile: will do so!

Many thanks - will check it out again :smiley:

There are some issue with some computations in the LabelGeometryImageFilter not correctly taking into account the image’s direction cosine matrix and/or the pixel spacing. These have been corrected in the implementation in the ITK LabelMap framework. Please look at the LabelImageToShapeLabelMapFilter for an updated implementation.

1 Like