Skip to content

dyollb/ITKLabelPointSet

Repository files navigation

ITKLabelPointSet

Build Status License PyPI version

Overview

This is a module for the Insight Toolkit (ITK). The module includes a filter to extract a PointSet from a labeled image. Additional filters and IO classes may be added in future versions to support pointset registration workflows.

    import itk

    labels = itk.imread('path/to/labelmap.mha').astype(itk.US)
    D = labels.ndim

    ImageType = type(labels)
    PointSetType = itk.PointSet[itk.US, D]

    extractor = itk.LabelToPointSetFilter[ImageType, PointSetType].New()
    extractor.SetInput(labels)
    extractor.Update()
    point_set = extractor.GetOutput()

    data = point_set.GetPointData()
    for i in range(point_set.GetNumberOfPoints()):
      print(f"{i}: {point_set.GetPoint(i)}, {data.GetElement(i)}")

Installation

To install the binary Python packages:

  python -m pip install itk-labelpointset

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published