Morphological image processing for 3D multi-label images.
Project description
fastmorph: multilabel 3D morphological image processing functions.
This is a collection of morphological 3D image operations that are tuned for working with dense 3D labeled images.
We provide the following multithreaded operations:
- Multi-Label Stenciled Dilation, Erosion, Opening, Closing
- Multi-Label Spherical Erosion
- Binary Spherical Dilation, Opening, and Closing
- Multi-Label Fill Voids
Highlights compared to other libraries:
- Handles multi-labeled images
- Multithreaded
- High performance single-threaded
- Low memory usage
- Dilate computes mode of surrounding labels
Disadvantages versus other libraries:
- Not ideal for grayscale images
- Stencil (structuring element) is fixed size 3x3x3 and all on.
import fastmorph
# may be binary or unsigned integer 2D or 3D image
labels = np.load("my_labels.npy")
# multi-label capable morphological operators
# they use a 3x3x3 all on structuring element
# dilate picks the mode of surrounding labels
# by default only background (0) labels are filled
morphed = fastmorph.dilate(labels, parallel=2)
# processes every voxel
morphed = fastmorph.dilate(labels, background_only=False, parallel=2)
morphed = fastmorph.erode(labels)
morphed = fastmorph.opening(labels, parallel=2)
morphed = fastmorph.closing(labels, parallel=2)
# Dilate only supports binary images at this time.
# Radius is specified in physical units, but
# by default anisotropy = (1,1,1) so it is the
# same as voxels.
morphed = fastmorph.spherical_dilate(labels, radius=1, parallel=2, anisotropy=(1,1,1))
# open and close require dialate to work and so are binary only for now
morphed = fastmorph.spherical_open(labels, radius=1, parallel=2, anisotropy=(1,1,1))
morphed = fastmorph.spherical_close(labels, radius=1, parallel=2, anisotropy=(1,1,1))
# The rest support multilabel images.
morphed = fastmorph.spherical_erode(labels, radius=1, parallel=2, anisotropy=(1,1,1))
# Note: for boolean images, this function will directly call fill_voids
# and return a scalar for ct
# For integer images, more processing will be done to deal with multiple labels.
# A dict of { label: num_voxels_filled } for integer images will be returned.
# Note that for multilabel images, by default, if a label is totally enclosed by another,
# a FillError will be raised. If remove_enclosed is True, the label will be overwritten.
filled_labels, ct = fastmorph.fill_holes(labels, return_fill_count=True, remove_enclosed=False)
Performance
A test run on an M1 Macbook Pro on connectomics.npy.ckl
, a 5123 volume with over 2000 dense labels had the following results.
erode / 1 thread: 7.70 sec
erode / 2 threads: 4.10 sec
erode / 4 threads: 3.02 sec
dilate / background_only=True / 1 thread: 1.15 sec
dilate / background_only=True / 2 threads: 0.65 sec
dilate / background_only=True / 4 threads: 0.48 sec
dilate / background_only=False / 1 thread: 14.31 sec
dilate / background_only=False / 2 threads: 7.47 sec
dilate / background_only=False / 4 threads: 8.09 sec
dilate / background_only=False / 8 threads: 5.46 sec
skimage expand_labels / 1 thread: 75.20 sec
Memory Profiles
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fastmorph-1.0.1.tar.gz
(23.2 kB
view hashes)
Built Distributions
Close
Hashes for fastmorph-1.0.1-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c850601c886bbe55af2fa1cf01e2f9afdf83895ec0ff4e8d1ee7e6d887a53401 |
|
MD5 | 0de4959e5e93b4c8243298cc0d2123dd |
|
BLAKE2b-256 | 54d309762f93f80be73c44da88557f716e835e1d6f6c8a51766db0a5fa5da73c |
Close
Hashes for fastmorph-1.0.1-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b45884ebf312bc88371bd88ff950a3389b0d9efd20a4d7978378f437c1509374 |
|
MD5 | d5a1ac8e2c0bf1be4d309be556fdee8c |
|
BLAKE2b-256 | e39d742e36acf3952c67448de0e62326c315832f888c35d978a6385bb35e82f7 |
Close
Hashes for fastmorph-1.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef8a1dbf8ac4ae0a13b783d6b75d108038ec3814dc04510ea67d26bd2445d902 |
|
MD5 | 67d409520bfd93df83d0b1f24b6f8123 |
|
BLAKE2b-256 | 4c5ae49508ee183d64e581d19683f3e004cda777c0aef89670db99cb90477066 |
Close
Hashes for fastmorph-1.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e676cf6f12a98d60f33e15ddff501d8302146a16a82710b1e1a75d541db3b76b |
|
MD5 | 1234d18cb507ab06f54e1b39313afe49 |
|
BLAKE2b-256 | 54284b7d9ff18115660c5d6b9d07d04e3e3a705ba7d4a537ed5acd0f730a9490 |
Close
Hashes for fastmorph-1.0.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd085a47f4c59a9cb4b77332ffaaf6373a3de795a345ec8aba0b277bfb0334bb |
|
MD5 | c59779b9202a58ae18d96c9d76ef6947 |
|
BLAKE2b-256 | ef28f415ea67b04f7559741b59f059a80e8eb3da84c083a10a9e39c55301eb6b |
Close
Hashes for fastmorph-1.0.1-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7773bc30cc145db6377a6a0a6ae9a419b2d6075439496e33cd740ffab55c8bec |
|
MD5 | 476238a5ec3cdb94ee7e806237577e36 |
|
BLAKE2b-256 | 824fac34ca1166e639b2d0380cd8cb3a4cb1dfa190491b0239903a457f1c3dc8 |
Close
Hashes for fastmorph-1.0.1-cp312-cp312-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b3e06d4073c1e91c3d2e0451a8d209d67cb43df9373218ec4cc172ccbfd0df6 |
|
MD5 | 9824d236ccc7fc7adc4fc96927b1f4d8 |
|
BLAKE2b-256 | 74affaa74ec64f35ae48b11464829c4c3e9837d9bcf510f3e136443da45edc7c |
Close
Hashes for fastmorph-1.0.1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cad114e1acd5f678d98f3b76e6af038e910b82335e40476de8b06beec364b10 |
|
MD5 | 845041dd75a152ba12232a781bf2ce10 |
|
BLAKE2b-256 | 901b3b0dfaa6ecd46d7395e2d59a6132b517444c6668077f53effdc98db03c94 |
Close
Hashes for fastmorph-1.0.1-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4eed7649592d084be8d2b50474e498f2558d7399062a36a3ef3c9f3eab91fd6f |
|
MD5 | 142011dce1993ddc6d4434efdbe289c5 |
|
BLAKE2b-256 | 1c3bab79c2c50e163506ccbcc4c98e62b45661c08bab194248c41cf725775437 |
Close
Hashes for fastmorph-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db6da16f05791e6f9a8364dde2066f9430b7e29d71da7186e4214968c39fa37e |
|
MD5 | 1bb78d89cc11fec455ed31f43ae4342e |
|
BLAKE2b-256 | eae8872d6dbfa2548cc0bfe81544e200b679dc1e55ea61dbd08c44fe3a9f15ac |
Close
Hashes for fastmorph-1.0.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | adaa33f8a39a1cccb5164461892a97062c3d9c09314203ff30a6221cfa6e2f27 |
|
MD5 | 9897fb519137d796010eaaf4b88a8413 |
|
BLAKE2b-256 | f2eac5e090b4bd75433b38ad14c0af6eab0101e48f1fd3977e696849ce00e5a5 |
Close
Hashes for fastmorph-1.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf375142080adba02d8499d6cbe1d4579da058d9edf015c17a491faf3e75af5c |
|
MD5 | 790d1b70fce35d90411c8e000a964206 |
|
BLAKE2b-256 | c0f0a7acdf02657ed1dfbf4d162ddeca31dc38fb6f17e2fe69695434b69fdbf9 |
Close
Hashes for fastmorph-1.0.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f67067bca0d99a7ed04264115c2d373b014c26be72d45eb2ac4d8758e473effd |
|
MD5 | 72543950b326035351c073868843aa35 |
|
BLAKE2b-256 | af2da5d37796da641d23fc48ab3817c4e72bac1c35b488ad5757cad5095c999a |
Close
Hashes for fastmorph-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56cba9ad1ad1ea404dd4a4ca57a0ab902c69fe0b60fa3848c342872d7d14caa9 |
|
MD5 | 1bb8900a6e1b38bda71d02752ab55095 |
|
BLAKE2b-256 | 799d5fa5893bd954fc0862764efcf49c4bb1282fd0355d782441f698dd5b33ff |
Close
Hashes for fastmorph-1.0.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88c610ab87dfc71e41c8d8810979162a5224ac695aa03d1af1a0da86525f1a71 |
|
MD5 | 395ed080734aa648278cc8a1b9ef20b9 |
|
BLAKE2b-256 | 0d03071afef4b53710c03d121e45e112c5ed7f37157efd9a62c9964762206e5f |
Close
Hashes for fastmorph-1.0.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54a3a3ab8d5a7d1cb4dad8faf9c5ae3fd0473ad2e150ded0d17ad1d4ff95c1b6 |
|
MD5 | 4a8fbabd60bcbd37c9647d755b5cd153 |
|
BLAKE2b-256 | b9878c5297bb22a7fbcd9ecb0962ff7df6be8ad0aa5220efbd0d75d261a4f9d1 |
Close
Hashes for fastmorph-1.0.1-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f26f2e52f88fd99d0160199b913e8e5e8b980ab2b3ca8c109227eb6df57bfc6 |
|
MD5 | e55c284f30a4ce7dd2d537adafbea5bd |
|
BLAKE2b-256 | 7f231301ca95d3706f009d99a8e86f10be822c64012216fa9612a59e4a61edea |
Close
Hashes for fastmorph-1.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 413a1c95091466369d2a0846a962fda07b7138c113771aa6ae64508331cf4e58 |
|
MD5 | 3dd5a798a1880c7f90a4c4d3a461ae64 |
|
BLAKE2b-256 | c19b71cc8d398680ddb20d78dac3043e5355c61cf20b486c3a15e7ebd1137987 |
Close
Hashes for fastmorph-1.0.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9232d5c8ebc1ebc1f8506a1e158fb025cffcf174d685f6fd396245ed123819a7 |
|
MD5 | 81e2c69ce9eb75c4ea7843b4e8e2854d |
|
BLAKE2b-256 | a727c9a945664030156ea3d1751f57cd058b2feaca8ddde7dedcbcd68eb5cf32 |
Close
Hashes for fastmorph-1.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03395b8a51d3b95f3eaba88c40cd67b2015b3b1854ed339c8212bc7a331cb4f0 |
|
MD5 | 96f0aadb27001634ea2bf5fea1a92b1c |
|
BLAKE2b-256 | 67be57d0b5f37649f0f038376d8f17d649fd4c49a13e0d9ea0017c16cf116b15 |
Close
Hashes for fastmorph-1.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | edc0bb3c41b6949d06970380bd4a4cbf7e2c3e40726f3c56f92d88c76b8585fd |
|
MD5 | 449b2c1cb1a58d2439d45f2c780176ea |
|
BLAKE2b-256 | 7d1a3c37f789fd1625827eec35a3b2644630e001d2644fc13af8a550fd2e23b2 |
Close
Hashes for fastmorph-1.0.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb1231cef8d2d5bdd4244f5d6892b064a34e5ea721e51e78ffb8faeee825a3ec |
|
MD5 | 89992782584dbfdf9f83beb513de3acf |
|
BLAKE2b-256 | 98618c839fc34fbca1314c5ee930cd3440e414a5ef0fa7fcf5a1035b3b1369cd |
Close
Hashes for fastmorph-1.0.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1578da9992c5b9577b7dca62e61fce9bad3670165375b9ef4782c4fb748014d0 |
|
MD5 | 33e21675bc780afc0b9c2bb057c8d3a3 |
|
BLAKE2b-256 | db500e78bd93e2bf9bb660ade45f93a134c959cfbb735b6f1db244c5e1aaf38c |
Close
Hashes for fastmorph-1.0.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dde08358b6838e6d6cbf19acda2ddc634ad22c410d1a733e0f83435b9593f1da |
|
MD5 | 94820dfbed8cf93289999cd59bebab33 |
|
BLAKE2b-256 | 14b1b7b3b0c6339f4635896db79ede15dccfea2dbefa102b01667f39c5a0c93d |
Close
Hashes for fastmorph-1.0.1-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a75506a602226a26427700ed81fcebf873e38aa5837a0e5349ae6ce9cc2000d |
|
MD5 | 01968944257cf7723311cc68220165b2 |
|
BLAKE2b-256 | 48dd25f07395cd66dcc4ea296935ca5258c4818ae4f232140cc818906fcb60a6 |
Close
Hashes for fastmorph-1.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6f7ef71e985b3bbee09aa247bc9a190d64a61101ab3eeedad7b2dfb96020b05 |
|
MD5 | 103ebb402a19f26674dc116fe7814f6b |
|
BLAKE2b-256 | 3aea10d76a9a11bf1f2e8786da1a9c023eaa5e1b89c5137c4172952141d9411a |
Close
Hashes for fastmorph-1.0.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1dedd722dd0cbbbc5620b33cbc3363d747d9fc960ac0d71f67d141f2d058b5f7 |
|
MD5 | 3ad5fa28f7b4d814fa81247424767851 |
|
BLAKE2b-256 | 93c25bec8186b55cdef029e20a0fb7a5c147e637aac2044d27d55a92bd442b40 |
Close
Hashes for fastmorph-1.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 922adb77213ea4ad679b4c26d497b3f3bcfee769926150488fe547f81029df76 |
|
MD5 | ca2e74c929a7a6f36a78787a95f0b890 |
|
BLAKE2b-256 | 32c54cc690af6363d808eb64577826edc6b9928c55cbcc8a2281f569227b0603 |
Close
Hashes for fastmorph-1.0.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de9f9d16480d639ddfc26288ea818499e993cd8671b8ba7134459cf74a19b03f |
|
MD5 | 97b21f6b6416a6d816dd6338be9f210b |
|
BLAKE2b-256 | 1546d93ed7235d10e2f5037e71ec94b52dbe10af582ec87c10f3d8ce6015a2d4 |
Close
Hashes for fastmorph-1.0.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d4f4170f714bf355e26e99c4f74812fa45edfa8ff7e4571298f1c90f58a806e |
|
MD5 | 512618b739d7bf05fd4ef16e4279db98 |
|
BLAKE2b-256 | 7a9e66400e0d23de85d02656b457ca2096159069b5e3ad1bbde6283a84f2aa08 |
Close
Hashes for fastmorph-1.0.1-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0e91f609f2f512da1d4eea7a1fe4b4b57ed81a75790c439adcbedd907a252a9 |
|
MD5 | f386e807f6ea79231f58022b9f12e3df |
|
BLAKE2b-256 | 32378ad1b212588223afa8a3f8b6da082dad6ce3ea166077684c53012198af35 |
Close
Hashes for fastmorph-1.0.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e16bf00ca7c1c3cecbf69d5a7954058cb7a04e14e36dcf2a0454cb72f726defd |
|
MD5 | 2c340d01285af9240d64562f53a8cf63 |
|
BLAKE2b-256 | d3cb1f1ae3d7654253dbdd4fb757fb2e9e4d52b1424098a7c4c6fdd728fbc0b0 |
Close
Hashes for fastmorph-1.0.1-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c2336d474c4caa037f7032c002c923b1cc8b9a62c57cb10e3d6a5673ee959a9 |
|
MD5 | 410da061174d982fec4fdbbda4eb6f69 |
|
BLAKE2b-256 | e3486ea10426d5467ad5646efcb1a28eb704c81c3e7d0e65a75af586eba4196c |
Close
Hashes for fastmorph-1.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 044d058f04d9d39593409cba206dcfffd9e67b3ab9cf60a5e123d4a99390206d |
|
MD5 | fe91f4927431003739aedce505219949 |
|
BLAKE2b-256 | 1edec6720486a23ef2336b5d97538283be6a69f36cce3491ad93973085d31cb9 |
Close
Hashes for fastmorph-1.0.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c63350c1e5e062d48338508969b429869f6978e45bc6c21515b4d4753132a88 |
|
MD5 | 7ad7737862f2d947d4b265d568b42db9 |
|
BLAKE2b-256 | d035134e699ceeb5a65cfaa51c9ad25225bb5b9c84b1ea521e36ce25dfb5d16d |
Close
Hashes for fastmorph-1.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89d57fa1a68c74e907ffa6905182e901ebd7b00d2ba1c5d750ab54f1c565b9c9 |
|
MD5 | 5054f13eff952365635ec3161478b405 |
|
BLAKE2b-256 | 71f7962b30898babea6e75eb0058e611f5b8473e449a3689db88f722d743aeeb |
Close
Hashes for fastmorph-1.0.1-cp38-cp38-macosx_11_0_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdbba0e3501cb8726e4f824186c7c830bbcd92861e895671b91d65accd3ca9d0 |
|
MD5 | 27896c6033eb5f727fa9373125e406fe |
|
BLAKE2b-256 | 0ecb44965b615efeb248ab474d7e3db2d73bbde837b915461db839a0801a860f |
Close
Hashes for fastmorph-1.0.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 739a651c81698c83cb579c091c2677dcac2ea2c2aeb4d7aa209760ac5f4fa8a4 |
|
MD5 | a9e85eac6602f87a12ad5f61e2328f3a |
|
BLAKE2b-256 | 67964a034863250af16e464bd64701076e4ec100f933486c86335a8a17c798e2 |
Close
Hashes for fastmorph-1.0.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 493f177aab28372de345544f52765cc56da32507913a02f5eb80c5411c68cfff |
|
MD5 | 3932efaf485ae492aacc86953e8ca22e |
|
BLAKE2b-256 | c3b4c681ed5f96f9904f70bbcbc36d68a9564e1b85aa51ee343a85464498997d |