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 fixers that are applied to RawDataElements on read through pydicom. More on callback below.

Dicom fixer will also decompress compressed TransferSyntaxes so that no issues are met on the platform downstream.

Usage

Inputs

  • dicom: Input dicom

Configuration

  • debug (boolean, default False): Include debug statements in output.
  • standardize_transfer_syntax (boolean, default True): Whether or not to change TransferSyntaxUID to ExplicitVRLittleEndian
  • tag (string, default: dicom-fixer): The tag to be added on input file upon run completion.

Output

File

DICOM-fixer will either output a fixed file to overwrite the input or will output nothing

QC

DICOM-fixer will add a QC result titled fixed to either the input file if no output is written, or the output file if there is an output. The state will be either PASS or FAIL:

  • PASS if either fixes were attempted and write was successful, or if no fixes were attempted.
  • FAIL if fixes were attempted but write was not successful.

For a PASS result, any fixing events will be under the events key.

Fixers

The following fixes are applied:

General fixes from fw-file

  • Fix VR for SpecificCharacterSet and surplus SequenceDelimitationItem tags.
  • Replace VR=None with VR found in the public or private dictionaries.
  • Replace VR='UN' with VR found in the public or private dictionaries.
  • Replace invalid \ characters with _ in string VR values of VM=1.
  • Crop text VRs which are too long.
  • Fix an invalid UID. Determine if UID is semi-valid (e.g. composed of a minimum 5 nodes including invalid node starting with 0), if semi-valid, generates a new UID with the semi-valid UID as entropy source (deterministic), else, generates a new UID.
  • Fix date times tags. Attempt to parse an invalid date and format correctly.
  • Fix AS strings. Ensure one of D,W,M,Y is at end of the string, and pad to 4 characters. If no time quantifier is present, assume Years.
  • Fix number strings. Fix DS (Decimal String) and IS (Integer String) number strings by removing invalid characters and truncate floats in IS VR.
  • Fix invalid character. Attempt to remove non-printable characters from byte decoding.
  • Fix invalid VR value. Try to fix an invalid value for the given VR.
  • Fix LUT Descriptor tags.

Custom fixes

  • Fix incorrect units. Correct MagneticFieldStrength from milli-Tesla to Tesla.
  • Remove file in archive that are not likely DICOM (defined as having at least 2 public dicom tags outside the file_meta (0000, 0002) group).
  • Optionally, sets the TransferSyntaxUID to ExplicitVRLittleEndian.

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.7.4-py3-none-any.whl (10.9 MB 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