Skip to main content

ITK external module to control topology of binary mask regions

Project description

ITKTopologyControl

Build Status License PyPI version

Overview

This is a module for the Insight Toolkit (ITK). The module includes a filter called FixTopologyCarveOutside which works like morphological closing, except that in the "erode" phase topological constraints are enforced to avoid re-opening holes. It is able to close holes in thin layers (e.g. skull) with a minimal thickness.

    import itk
    skull_mask = itk.imread('path/to/skull_with_holes.mha').astype(itk.US)

    ImageType = type(skull_mask)
    MaskType = itk.Image[itk.UC, 3]

    top_control = itk.FixTopologyCarveOutside[ImageType, ImageType, MaskType].New()
    top_control.SetInput(skull_mask)
    top_control.SetRadius(5)
    top_control.Update()
    skull_mask_closed = top_control.GetOutput()

    itk.imwrite(skull_mask_closed, 'skull_mask_closed.mha')

Or using a custom mask (e.g. a sphere around a hole):

    import itk
    custom_mask = itk.imread('path/to/custom_mask.mha').astype(itk.UC)
    skull_mask = itk.imread('path/to/skull_with_holes.mha').astype(itk.US)
    skull_mask_closed = itk.fix_topology_carve_outside(skull_mask, MaskImage=custom_mask, Radius=5)
    itk.imwrite(skull_mask_closed, 'skull_mask_closed.mha')

Closing holes in skull

Installation

To install the binary Python packages:

  python -m pip install itk-topologycontrol

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

itk_topologycontrol-1.1.0-cp311-cp311-win_amd64.whl (589.5 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

itk_topologycontrol-1.1.0-cp311-cp311-manylinux_2_28_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

itk_topologycontrol-1.1.0-cp311-cp311-macosx_10_9_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

itk_topologycontrol-1.1.0-cp310-cp310-win_amd64.whl (589.5 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

itk_topologycontrol-1.1.0-cp310-cp310-manylinux_2_28_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

itk_topologycontrol-1.1.0-cp310-cp310-macosx_10_9_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

itk_topologycontrol-1.1.0-cp39-cp39-win_amd64.whl (590.0 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

itk_topologycontrol-1.1.0-cp39-cp39-manylinux_2_28_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

itk_topologycontrol-1.1.0-cp39-cp39-macosx_10_9_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

itk_topologycontrol-1.1.0-cp38-cp38-win_amd64.whl (614.3 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

itk_topologycontrol-1.1.0-cp38-cp38-manylinux_2_28_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

itk_topologycontrol-1.1.0-cp38-cp38-macosx_10_9_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

itk_topologycontrol-1.1.0-cp37-cp37m-win_amd64.whl (614.0 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

itk_topologycontrol-1.1.0-cp37-cp37m-manylinux_2_28_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.28+ x86-64

itk_topologycontrol-1.1.0-cp37-cp37m-macosx_10_9_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page