Socket
Socket
Sign inDemoInstall

itk-topologycontrol

Package Overview
Dependencies
1
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    itk-topologycontrol

ITK external module to control topology of binary mask regions


Maintainers
1

Readme

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

Keywords

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc