Socket
Socket
Sign inDemoInstall

itk-dissolve

Package Overview
Dependencies
1
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    itk-dissolve

This is a module for the Insight Toolkit (ITK) that provides filters to replace regions within a masked region with the surrounding labels.


Maintainers
1

Readme

ITKDissolve

Build Status License PyPI version

Overview

This is a module for the Insight Toolkit (ITK) that provides functionality to discard pixels within a masked region. Unlike masking, the pixels in the masked region are replaced (dissolved) by their nearest pixels outside the mask. This can be useful to clean-up label fields, e.g. to remove small islands/holes or remove entire labels, and replace them by the adjacent labels.

The module includes a filter called DissolveMaskImageFilter.

    import itk
    labels = itk.imread('path/to/labels.mha').astype(itk.US)
    mask = itk.imread('path/to/mask.mha').astype(itk.UC)

    ImageType = type(labels)
    MaskType = type(mask)

    dissolve = itk.DissolveMaskImageFilter[ImageType, MaskType].New()
    dissolve.SetInput(labels)
    dissolve.SetMaskImage(mask)
    dissolve.Update()
    modified_labels = dissolve.GetOutput()

    itk.imwrite(modified_labels, 'modified_labels2.mha')

Or using the pythonic API:

    import itk
    labels = itk.imread('path/to/labels.mha').astype(itk.US)
    mask = itk.imread('path/to/mask.mha').astype(itk.US)
    modified_labels = itk.dissolve_mask_image_filter(labels, mask_image=mask)
    itk.imwrite(modified_labels, 'path/to/modified_labels.mha')

Installation

To install the binary Python packages:

  python -m pip install itk-dissolve

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