Onboarding DICOM data and converting to NIfTI
Onboarding DICOM data and converting to NIfTI#
Neuroimaging data is most often collected in DICOM format but then converted to, stored and processed in NIfTI image format. To efficiently process incoming data, QuNex provides a set of tools for organizing, sorting and converting raw DICOM files to NIfTI images. The tools range from commands that perform single operations to ones that provide a single step data import and processing.
The naming conventions used in this chapter are explained on page about preparation of QuNex study folder hierarchy.
To better understand the process, these are the steps in the lives of a session's DICOM files:
Initial data drop
All the incoming session's DICOM or PAR/REC files are first stored in the session's
inboxfolder. They can be synchronized, pulled, pushed, downloaded or unpacked there. No specific naming or folder organization is expected. A number of commands can be used to accomplish this.
Sorting of DICOM files
In the next step, the session's
inboxfolder is scanned and all the files in the folder and its subfolders are inspected to see if they are valid DICOM or PAR/REC files. If files have a
.gzextension they will be gunzipped on the fly. All the valid DICOM files are then moved to a new
dicomfolder so that all DICOM files belonging to the same sequence will be placed in their own subfolder and renamed with unique names consisting of subject code, series number, unique identifier (SOPInstanceUID or index) and
.dcmextension. Now DICOM files from each image are stored in a separate folder. This step is completed by
sort_dicomcommand, which might be called automatically as part of other, more general commands.
Conversion to NIfTI
Once DICOM or PAR/REC files are sorted, they are converted to NIfTI files and placed in the
niifolder. To accomplish this,
dcm2niixis called for each image DICOM or PAR/REC folder created in the previous step. The resulting NIfTI files are given unique names, which can be either the index of the image recorded (e.g. 1, 2, 3 ...), or in the case of DICOM or PAR/REC files from Philips MRI systems, the actual series number. This step is completed by
dicom2niixcommand, which again might be called automatically as part of other more general commands.
For efficiency, this step is parallelized, so a number of DICOM conversions might be running at the same time utilizing multiple computer cores (through the
parelementsparameter). Also, a number of logs are generated in this step. For each image converted, there will be a corresponding
dicm2nii_[image id].logfile stored in the
dicomfolder. Next, a
DICOM-Report.txtfile will be generated and stored in the
dicomfolder with basic information on the sequences that were found and converted to NIfTI files.
session.txtfile will be generated with information on the location of the data, a list of all the generated NIfTI image files, and the sequence names taken from DICOM files from which they were generated.
import_dicom - importing and data organization utility#
To simplify and streamline importing of DICOM files either from one or from multiple sessions, QuNex provides
import_dicom command that identifies the relevant data and automatically completes the steps listed above.
import_dicom is typically used in two scenarios. First, the data is downloaded from a scanner into an 'inbox' folder, either as one folder or one compressed package of data for each recording session. Second, the raw scanning data is organized into
<study>/sessions/<session id>/inbox folders, again either as a set of dicom files or as a compressed image with dicom files. A review of these two scenarios can be found in the Notes section of