Conversion of medical images to MHA and TIFF.
Project description
panimg
NOT FOR CLINICAL USE
Conversion of medical images to MHA and TIFF.
Requires Python 3.7, 3.8 or 3.9.
libvips-dev
and libopenslide-dev
must be installed on your system.
For compressed DICOM support ensure that gdcm
is installed.
Under the hood we use:
SimpleITK
pydicom
Pillow
openslide-python
pyvips
Usage
panimg
takes a folder full of files and tries to covert them to MHA or TIFF.
For each subdirectory of files it will try several strategies for loading the contained files, and if an image is found it will output it to the output folder.
It will return a structure containing information about what images were produced, what images were used to form the new images, image metadata, and any errors from any of the strategies.
NOTE: Alpha software, do not run this on folders you do not have a backup of.
from pathlib import Path
from panimg import convert
result = convert(
input_directory=Path("/path/to/files/"),
output_directory=Path("/where/files/will/go/"),
)
Supported Formats
Input | Output | Strategy | Notes |
---|---|---|---|
.mha |
.mha |
metaio |
|
.mhd with .raw or .zraw |
.mha |
metaio |
|
.dcm |
.mha |
dicom |
1 |
.nii |
.mha |
nifty |
|
.nii.gz |
.mha |
nifty |
|
.png |
.mha |
fallback |
2 |
.jpeg |
.mha |
fallback |
2 |
.tiff |
.tiff & .dzi |
tiff |
3 |
.svs (Aperio) |
.tiff & .dzi |
tiff |
3 |
.vms , .vmu , .ndpi (Hamamatsu) |
.tiff & .dzi |
tiff |
3 |
.scn (Leica) |
.tiff & .dzi |
tiff |
3 |
.mrxs (MIRAX) |
.tiff & .dzi |
tiff |
3 |
.biff (Ventana) |
.tiff & .dzi |
tiff |
3 |
1: Compressed DICOM requires gdcm
2: 2D only, unitary dimensions
3: DZI only created if possible
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.