How to decompress a file into dicom format

Hi Everyone,
I have MRI data that doesn’t have a file extension (no .dcm or .ima etc). By looking things up it seems that it is compressed dicom data (it’s source was from a CD). Is there a successful way (on Linux or Windows) to convert that to dicom format?

What’s the file format if not .dcm or .ima? I think if it was compressed then it’d have those same file endings but with something additional like .gz appended

While NIfTI files only have a few file name extensions (.hdr/.img, .nii, .nii.gz), the DICOM specification does not require or. specify any file name extension. While some might use .dcm or .img, this is not a general rule. Indeed, Siemens tends to base the filename on the mediaObjectInstanceUID (0002,0003) so a Siemens DICOM image may look like

MR.1.3.12.2.1107.5.2.32.35131.2014031012545067891488118

The file name tells you nothing about whether the image data is stored as compressed or raw bytes. You determine image storage from the Transfer Syntax (0002, 0010) https://www.dicomlibrary.com/dicom/transfer-syntax/.

You have several options:

  1. If you want to convert your DICOM data to uncompressed NIfTI you could use a command like dcm2niix -z n /path/to/dicoms. dcm2niix will decode most forms of DICOM compression.
  2. If you want to convert your DICOM data to compressed NIfTI you could use a command like dcm2niix -y n /path/to/dicoms. dcm2niix will decode most forms of DICOM compression.
  3. If you want to rename your DICOM images so they have a sensible naming scheme and have the extension .dcm, you could use a command like dcm2niix -r y -f %t/%s_%p/%4r_%o.dcm /path/to/DICOMs. This will retain the transfer syntax.
  4. If you want to decompress DICOM data while preserving the DICOM format you could use gdcmconv or dcmdjpeg.html.
1 Like