Skip to main content

This gear reports on the Dicom files data elements and optionally fixes or enhances the problematic ones, generating a new archive.

Project description

Dicom Fixer

Description

This gear is responsible for reporting on the Dicom files data elements and optionally fixing/enhancing the problematic ones and generating a new archive.
This gear utilizes the tracker functionality of RawDataElements in fw-file. Namely, it houses a collection of default and custom callbacks that are applied to RawDataElements on read through pydicom. More on callback below.

Usage

Inputs

  • dicom: Input dicom

Configuration

  • debug (boolean, default False): Include debug statements in output.
  • tag (string, default: dicom-fixer): The tag to be added on input file upon run completion.

Callbacks

fw-file callbacks:

  • backslash_in_VM1_string_callback: Fix value of RawDataElement with VM=1 and VR of type string that contains an invalid \ character (\ is the array delimiter in Dicom standard) and replaces with _. Use case is to handle non-compliant Dicom implementation that let e.g. SeriesDescription value containing .
  • handle_none_VR: A callback to handle VR = None.
    • Mirror the handling of pydicom pydicom.dataelement.DataElement_from_raw when VR is None but set VR to 'UN' for public tag that are not in the pydicom dictionary instead of raising a KeyError.
  • handle_un_VR: A callback to handle VR=UN.
    • Mirror pydicom.dataelem.DataElement_from_raw when VR is UN but instead set VR to 'OB' when decoding value raises with the inferred VR.
  • converter_exception_callback: A callback to catch NotImplementedError when raw_elem contains an invalid VR.

Custom callbacks:

  • handle_incorrect_unit: Callback to fix known incorrect units
    • Currently only implemented to correct MagneticFieldStrength from milli-Tesla to Tesla.

Non-RawDataElement callbacks:

  • decode_dcm: Mirrors pydicom.dataset.Dataset.decode, except it ignores decoding the OriginalAttributesSequence tag.
  • is_dcm: This is a callback that works on the collection itself, filtering out and removing any files that don't look like a DICOM.
    • "Looks like a dicom" is defined as: Having at least 2 public dicom tags outside the file_meta (0x0000, and 0x0002) group.

Contributing

For more information about how to get started contributing to that gear, checkout CONTRIBUTING.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

fw_gear_dicom_fixer-0.3.6-py3-none-any.whl (7.9 kB view hashes)

Uploaded Python 3

Supported by

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