Skip to main content

A python package that upsample segmentated medical image

Project description

Segmentation Upsampler

This is a Python-based software for upsampling 3-dimensional segmented medical images using a mesh-based method. This method may be useful for reducing staircasing artifacts and increasing accuracy in medical image-derived ultrasound simulations, among other applications requiring accurate segmentation upsampling.

Installation

*The software is Python-based and MATLAB is used to generate sample shapes and run tests.

The software was developed in following environment:
Python version 3.9
MATLAB R2023b
Please check the compatibility of lateral Python versions using this link: https://www.mathworks.com/support/requirements/python-compatibility.html.

Python package Installation:
pip install pySegUpsampler==0.0.4

MATLAB package:
k-Wave (http://www.k-wave.org/)

I/O

The algorithm accepts and returns the following variables:

Input:

originalImage: low resolution input image (binary 3D array - two labels, integer 3D array - more than two labels)
spacing: spacing of the original image (1 x 3 floating point array)
$dx$: scale of upsampling (scalar float for isotropic upsampling, 1 x 3 floating point array for an anisotropic medical image)
$\sigma$: the standard deviation for the Gaussian smoothing kernel (scalar float, recommended range: 0 - 1)
$I$: isovalue for isosurface extraction (scalar float, recommand range: 0.4 - 0.5)

Output:

newImage: high resolution output with defined spacing

Examples

example_multilabel_testobject.m upsamples a code-generated complex shape and compares it to a high-resolution code-generated ground truth.

example_vertebra.m resamples a medical image-based segementation of a human spine. Figure 1 depicts slices through the 3D spine volume, demonstrating the upsampling of a multi-label spine segmentation with input parameters $\sigma = 0.7$ and isovalue = 0.4. The input image is sourced from Liebl $et$ $al$. 2021 [^1]. This demonstration resamples the original anisotropic voxel spacing of [0.2910, 0.2910, 1.2500] millimetres to an isotropic [0.8, 0.8, 0.8] millimetre voxel spacing. Gap post-processing was not applied.

spineDemo

Figure 1: Mesh-based upsampling demonstration with a segmented spine (subverse003) from the Verse2020 spine segmentation dataset [^1].

example_AustinWoman_Kidney.m upsamples a segmented medical image of a kidney and surrounding organs from the female Visible Human Project dataset [^2] with input parameters $\sigma = 0.4$ and isovalue = 0.4. This demonstration upsamples the original voxel spacing of [1, 1, 1] millimetres to an isotropic [0.8, 0.8, 0.8] millimetre voxel spacing. Gap post-processing was applied.

liverDemo

Figure 2: Mesh-based upsampling demonstration with a kidney and surrounding organs from the female Visible Human Project dataset [^2].

Test

SinglelabelGridSearch.m provides a grid-search method to find optimal parameter ($\sigma$, isovalue) settings for upsampling a single-label code-based image. Mis-labelling errors are evaluated using a high-resolution code-based image.

MultilabelGridSearch.m provides a grid-search method to find optimal parameter ($\sigma$, isovalue) settings for upsampling a multi-label code-based image. Errors resulting from gaps between labels and volume differences are evaluated using a high-resolution code-based image.

methodComparsion.m provides a comparsion of the mesh-based upsampling method against naive (nearest-neighbour and trilinear interpolation) upsampling methods.

normalizationComparsion.m compares error metrics for evaluating the accuracy of the upsampled result using a high-resolution ground truth.

IsovalueVSVolume.m provides the variation of volume ratio against isovalue, which can be used by the user to select the isovalue based on the desired volume.

References

[^1]:Liebl, H., Schinz, D., Sekuboyina, A., Malagutti, L., Löffler, M. T., Bayat, A., ... & Kirschke, J. S. (2021). A computed tomography vertebral segmentation dataset with anatomical variations and multi-vendor scanner data. Scientific data, 8(1), 284. [^2]:Massey, J. W., & Yilmaz, A. E. (2016, August). AustinMan and AustinWoman: High-fidelity, anatomical voxel models developed from the VHP color images. In 2016 38th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC) (pp. 3346-3349). IEEE.

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

pysegupsampler-0.0.5.tar.gz (30.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysegupsampler-0.0.5-py3-none-any.whl (37.7 kB view details)

Uploaded Python 3

File details

Details for the file pysegupsampler-0.0.5.tar.gz.

File metadata

  • Download URL: pysegupsampler-0.0.5.tar.gz
  • Upload date:
  • Size: 30.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.12

File hashes

Hashes for pysegupsampler-0.0.5.tar.gz
Algorithm Hash digest
SHA256 c9a2e0667cce25df6bbf46d847e522a0a7e31e0e78e4f5a62d233872c8b989ab
MD5 7372e67fc9a93251184a269cdab8e9da
BLAKE2b-256 7efece25eb05722f8d564294f7b5053015a180c4cb0cddb8ee1e0336c2d2d53e

See more details on using hashes here.

File details

Details for the file pysegupsampler-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: pysegupsampler-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 37.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.12

File hashes

Hashes for pysegupsampler-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 122a28e2f1c4a653bd07ca3e7c5f150298777dca01bfd2e33328279b82a0204d
MD5 6683712a51ea4a9b62e1829915f48c08
BLAKE2b-256 d5473dcd201a3dea8a88b3bc1721d75ea41b757b231a9d9f55cb6ced4c881fb4

See more details on using hashes here.

Supported by

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