This container can be used to convert raw magnitude dicom files to nifti format. Within this container we have included nimsdata, nimsscripts, and all their dependencies. Please view the nimsdata and nimsscripts github pages for more information regarding their usage.
dicomsort is a python function that will organize an assorted mess of dicom files (Siemens or GE) into exams/series. See the nimsscripts GitHub page for more information.
First, place all dicom images (un compressed) into a single folder tree [ we will refer to this as /path/to/dicoms/]. We will mount that directory into the container and write out the tars to that same directory in a folder called 'tarfiles' using the following docker run command:
docker run -t -i -v /path/to/dicoms/:/data \ vistalab/nimsdata \ dicomsort tarsort /data /data/sorted /data/tarfiles
Convert tar archives of dicom files to nifti. nimsdata Provides class and functions for parsing, identifying and writing scientific datasets. Currently, medical images (such as various flavors of MRI, dicoms, niftis, and some raw-files) are supported. Please see the nimsdata GitHub page for more information.
Now we will take one of the tar files we created in the previous section and from that we will create a nifti file. To do that we will mount the pat to the tar file and run the following docker run command:
docker run -t -i -v /path/to/dicoms/tarfiles/:/data \ vistalab/nimsdata \ nimsdata -p dicom -w nifti --writer_kwarg voxel_order=LPS -i /data/tarFileFromDicoms.tgz /data/nifti_from_dicom
Reconstruct and concatenate two niftis in the order the dicoms.tgz sources are provided on the command line. To reconstruct a Siemens multicoil scan, give the individual coil dicom.tgz as the first input, and the combined coil dicom.tgz as the second input.
To combine 2 multicoil tars [tar1.tgz and tar2.tgz], resulting from a run of dicomsort, we will run the following command using the names of the tar files as inputs to siemens_multicoil using the following docker run command:
docker run -t -i -v /path/to/dicoms/tarfiles/:/data \ vistalab/nimsdata \ siemens_multicoil /data/tar1.tgz /data/tar2.tgz -o combined_tar1_tar2.nii.gz
To test each function included in this container you can run the following command:
This will make certain you have the latest version of the container (important if you already have a version of the container.
docker pull vistalab/nimsdata
Run the test command in the container
docker run -t -i vistalab/nimsdata test_nimsdata
This command will run a script that downloads three example datasets -- 2 GE (T1 and DWI) and 1 Siemens -- from the Vistalab server and first sorts all the dicoms and creates archives from each set (using dicomsort) then creates the nifti files from those archives and finally combines a Siemens multi-coil dataset using 'siemens_multicoil'.
If all goes well you will see the following:
Success! ALL TESTS PASSED!