This is a module for the Insight Toolkit (ITK) that provides filters to replace regions within a masked region with the surrounding labels.
Project description
ITKDissolve
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
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
Built Distributions
File details
Details for the file itk_dissolve-1.0.4-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: itk_dissolve-1.0.4-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 266.6 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d80d9e11d7b86f42825ad178d5eea1068b2a7af8b390a5d04f3d5d0867189107 |
|
MD5 | da59c1d9a373ee59778bc3213244118e |
|
BLAKE2b-256 | eaf8b9aa14df50ce766e84a32a27eedd61f2b1359083ae86f87e202dec227acf |
File details
Details for the file itk_dissolve-1.0.4-cp39-cp39-manylinux2014_x86_64.whl
.
File metadata
- Download URL: itk_dissolve-1.0.4-cp39-cp39-manylinux2014_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17fb57f7f6d9d6e20a7599e3e39c0152c4e1fb093286c1f5a28c0567287b5965 |
|
MD5 | 9059db6c82ab06ec6086d775ee704814 |
|
BLAKE2b-256 | 78ce337226b23d0ca23616a5b573442d93500b0e354f6f742f257002276362ee |
File details
Details for the file itk_dissolve-1.0.4-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: itk_dissolve-1.0.4-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98ec1e890ce5bd98876e0f21d55a383bb915a012f07125117ec8956259bffdea |
|
MD5 | a7ccd01f16669c20f22a0be8425f4df1 |
|
BLAKE2b-256 | aa3cd06b298c51446b8442bff6898ae7d2afcc02702c9313a93c1895cde9609d |
File details
Details for the file itk_dissolve-1.0.4-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: itk_dissolve-1.0.4-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 266.0 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00c723242886368cfce602545de251e1a833f0c25e52671177a24513f93b93cb |
|
MD5 | 8217cb5f543ffd7f188eb3055aba9b3b |
|
BLAKE2b-256 | 7ba1b30291b5d19eee32fc34c79929a79e1d81f5d95c3fd2384c272c790f36e8 |
File details
Details for the file itk_dissolve-1.0.4-cp38-cp38-manylinux2014_x86_64.whl
.
File metadata
- Download URL: itk_dissolve-1.0.4-cp38-cp38-manylinux2014_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f69923574699e722f2a3a55fdc94e2a2da73eca1e8860346736f8b16be507ac4 |
|
MD5 | 7aada52d5c977d3e6c0cfbaa548016a1 |
|
BLAKE2b-256 | f2c8c066c84a9afa03ace09aee210d4915d8c4661b27b9207126e68ab7fedb91 |
File details
Details for the file itk_dissolve-1.0.4-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: itk_dissolve-1.0.4-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c3dab5cf78ac005007b18cc8ef5328b44856cf3d05916e9a15ad0e8004e3124 |
|
MD5 | 0593be3ff52382520bd0c4e7e370ec74 |
|
BLAKE2b-256 | 261dfa20e431c092004036f1434ae776963575939a6365fc3544d44c3a51f9d3 |
File details
Details for the file itk_dissolve-1.0.4-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: itk_dissolve-1.0.4-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 264.8 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c5231cd3f17e0d0144cfdec9d73076aed163f89127fd5731b1ceb86b9ffe77a |
|
MD5 | 4e11a42ffccb11569777612e5af4c577 |
|
BLAKE2b-256 | aa2904ae63b22b7bb13b842189b63a280c6cbca4787282d9465b33708eb2049d |
File details
Details for the file itk_dissolve-1.0.4-cp37-cp37m-manylinux2014_x86_64.whl
.
File metadata
- Download URL: itk_dissolve-1.0.4-cp37-cp37m-manylinux2014_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca4653042c470f13736bc479e63ccd6f0f70f56e3ca191dcf382d3cf708116f3 |
|
MD5 | b04a832718e66f00a0cba182e09cf158 |
|
BLAKE2b-256 | 7b5af47d09c43ce009913eb00fb12e48883d9bcf015e6551f373ab57162e6ad8 |
File details
Details for the file itk_dissolve-1.0.4-cp37-cp37m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: itk_dissolve-1.0.4-cp37-cp37m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.7m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56a29704e124876f7621dec71a00935535939ea4767f10244a67c292af4a270f |
|
MD5 | 8d9645889bfec8c75e830b2c6072f2a9 |
|
BLAKE2b-256 | 9797bb922891f20b88c350c41f08900022f5f4e4e12359eb8f811f8206333a9a |
File details
Details for the file itk_dissolve-1.0.4-cp36-cp36m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: itk_dissolve-1.0.4-cp36-cp36m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.6m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5d6ac556e4dbd3c558eccafcb9ed4846cdf70301709c95fac93d9b975a347a3 |
|
MD5 | 53d5fecfc6ceaef0bd44aa70fb623388 |
|
BLAKE2b-256 | 7af16ae394d779231e3a5aa0bd0377a5911a0dde329ef3734c9bb6b484effc34 |