Skip to content

API reference

Run the full pipeline on a single series and return its audit record.

Bases: BaseModel

Top-level configuration for a single pipeline run.

from_json(path) classmethod

Load and validate a configuration file.

to_json(path)

Persist the configuration as indented JSON.

Bases: BaseModel

Complete, serialisable record of one pipeline run.

Load a single DICOM series from path.

If the path contains multiple series, series_uid selects one; otherwise the largest series (most instances) is chosen and a debug note is logged.

An ordered DICOM series with a lazily assembled voxel volume.

metadata property

Validated, non-identifying descriptive metadata for the series.

representative property

The first dataset, used to read series-level attributes.

volume()

Return the series as a 3D array (slices, rows, cols) in stored units.

Rescale slope/intercept are applied so CT data is returned in Hounsfield units. The result is cached after first assembly.

De-identify a single dataset in place and return an audit record.

salt is the pseudonymisation secret for PatientID and UIDs; when None it is resolved by :func:resolve_pseudonym_secret.

Assess a series from metadata only. Never reads or changes pixel values.

Run all QC checks against series and return a structured report.

Convert series to output in the requested format.

metadata is written into the image header as key/value pairs where the format supports it (NRRD key:=value fields; NIfTI has no place for them). The pipeline uses it to record what was, and was not, de-identified.

Returns a :class:ConversionResult recording the written path, shape, and spacing. Raises :class:ConversionError if SimpleITK fails to write.

Write an integer labelmap as a Slicer .seg.nrrd segmentation.

Parameters:

Name Type Description Default
labelmap ndarray

Integer array shaped like reference.volume() -- (slices, rows, cols). Voxel value 0 is background; each positive value is a segment.

required
reference DicomSeries

The series the labelmap was derived from, used for output geometry.

required
segment_names dict[int, str] | None

Optional mapping of label value -> human-readable segment name.

None

Models

Bases: _Frozen

Descriptive, non-identifying metadata for a single DICOM series.

Bases: _Frozen

Result of running quality-control checks on an ingested series.

passed property

True when no hard errors were recorded (warnings are non-blocking).

Bases: _Frozen

Audit record describing what de-identification changed.

For a pipeline run this is the union over every instance in the series. Element paths inside sequences are written Sequence[].Keyword.

Bases: _Frozen

What is known about identifying content in the pixel data of a series.

Pixel data is never analysed or modified, so pixel_content_verified and pixels_modified are always False. status is "flagged" when metadata indicates known or suspected burned-in annotation, else "unverified". A missing or NO BurnedInAnnotation indicator is not proof of clean pixels.

Bases: _Frozen

Record of a volume successfully written to disk.