Esacode

Docs / Blocks / Data

Read medical images

Reads CT and MR scans (NIfTI, NRRD, MHA or DICOM series), checks their geometry, converts DICOM to NIfTI and draws three slices through each, with the anatomy over them when labels are connected.

Runs on a worker (Python) Data Version 1.0 Code you can open and adapt

How it works

Connect scans: NIfTI (.nii, .nii.gz), NRRD or MHA files, or the files of DICOM series (folders of .dcm files, grouped by series). Each scan is checked: size, spacing, orientation, slices missing in a DICOM series, thick slices; DICOM series are written as NIfTI (Volumes) for the next blocks.

The picture of each scan shows an axial, a coronal and a sagittal slice through the middle of the anatomy, in a CT window (soft tissue, bone, lung, brain) or scaled to the scan (MR); connect the labels of the same cases (masks in segmentations/ folders, or label maps) to colour the structures over the slices. Masks connected as scans (in folders named segmentations, masks or labels) are skipped.

Only technical DICOM tags (modality, series description, maker, slice thickness) reach the table: never a patient's name, ID or dates. Runs on any worker.

Inputs

InputTakesWhat it is
Scans
scans
Files
gz, nii, nrrd, nhdr, mha, mhd, dcm
NIfTI, NRRD, MHA, or the files of DICOM series Takes several connections.
Labels
labels
Files
gz, nii, nrrd, mha
Optional: masks (segmentations/ of each case) or label maps, coloured over the slices Optional. Takes several connections.

Outputs

OutputGivesWhat it is
Volumes
volumes
Files
gz, nii, nrrd, mha
Each scan as a volume: DICOM series as <case>/scan.nii.gz, other volumes as they came
Slices
previews
Files
png
<case>_slices.png: axial, coronal and sagittal slices, with the labels over them
Scans
table
Table
csv
scans.csv: case, source, modality, size, spacing_mm, orientation, extent_mm, min, max, slice_gaps, series, manufacturer, labels, note
Live telemetry
telemetry
Live telemetryWhat the block sends while it runs, for views such as Chart or 3D view.

Settings

SettingDefaultWhat it does
Window
window
CT soft tissue How CT values become greys in the pictures; auto: scaled to each scan (MR)
One of: CT soft tissue, CT bone, CT lung, CT brain, auto
Skip folders
skip
segmentations, segmentation, masks, mask, labels, label Files in folders with these names are not scans
DICOM to NIfTI
convert
on Write each DICOM series as a NIfTI volume

Where it runs

On one of your computers with the EsaSim worker: Any worker. The worker installs the Python packages it needs when they are missing: numpy</code>, <code>SimpleITK</code>, <code>pillow.

In its code, settings are ctx.params["key"], inputs ctx.inputs["id"] and outputs ctx.output("id", "name.ext"); see Custom blocks.

More in Data