JuliaHealth / DICOM.jl

Julia package for reading and writing DICOM (Digital Imaging and Communications in Medicine) files
MIT License
57 stars 21 forks source link

Ability to read DICOM files without headers #5

Open simonster opened 10 years ago

simonster commented 10 years ago

The DICOM files I get from our PACS here at MIT Martinos Center don't have headers. Is this common enough that dcm_parse should just try to read the file anyway even if it doesn't have a valid header? Or this be optional?

ihnorton commented 10 years ago

The premise seems rather philosophical... (Is this for anonymization reasons? I thought you work with monkeys of some sort).

Anyway, I don't think it's very common, DICOM being as strict as it is. I do come across this from time to time myself, but I just consider it raw data and write a NRRD header to describe the data (usually to read with ITK/VTK/3D Slicer/etc.).

ihnorton commented 10 years ago

FWIW, I don't have any objection to having it as an option. DICOM readers usually have unstrict modes (which is especially useful when dealing with aggressively anonymized datasets - though usually some header is still present).

simonster commented 10 years ago

To clarify, by header, I mean the first 128 bytes of the file and the "DICM" string that follows. The scanner is a Tim Trio that is also used for human studies, but the data aren't anonymized: the patient name, dates, etc. are all still in the DICOM files. I have no idea why that preamble is missing, or where it gets lost between the scanner and the PACS SFTP server. (The preamble is there if I export directly from the console.) I can make the files valid just by adding 128 null bytes + DICM.

The nibabel documentation on how SPM reads DICOM files says that SPM calls this "truncated DICOM" and gives some details about how it tries to determine whether files that are missing the preamble are DICOM or not. I also know that FreeSurfer's unpacksdcmdir doesn't complain.