How can I convert DICOM series to NRRD files in batch mode?

Dear Dr. Fedorov,

I want to convert DICOM series to NRRD files in batch mode in order to feed the NRRD files to make rCBV maps using DSCMRIAnalysis module in batch mode.
However, I can’t figure out how to convert DICOM series to NRRD files in command lines.

You suggested me to see the following site:

However, I do not see any arguments “input file directory” that I should put in some location.

Could you please be more specific? or are there any other ways to convert DSC DICOM series into NRRD multivomes in batch mode?

Thank you in advance!
Kyu Sung

Here is how you can do the conversion in batch mode.

First, install mpReview extension. This will add two new modules: mpReview and mpReviewPreprocessor.

mpReviewPreprocessor can be used to volume-reconstruct any collection of DICOM files in batch mode using Slicer DICOM plugins. It can be accessed from the Slicer GUI, but you can also run the script as from the command line follows (you will need to update the path to the preprocessor to the on your system after installing the script, or you can just download the script from the GitHub repository here):

Slicer --no-main-window --no-splash --python-script \
/Applications/Slicer.app/Contents/Extensions-27269/mpReview/lib/Slicer-4.9/qt-scripted-modules/mpReviewPreprocessor.py \
-- -i DSC-DICOM -o DSC-mpReview

-i takes a directory with DICOM files (it can have any hierarchy of subordinate content, will be scanned recursively

-o is the output directory.

After script is completed, it will have a hierarchy of directories similar to what is shown below (the example I show is for the dataset you shared earlier) -

<PatientID> \ RESOURCES \ <SeriesNumber> \ Reconstructions \ <SeriesNumber>.nrrd

image

The NRRD file will be the one that corresponds to the default loadable when the corresponding DICOM series is loaded using DICOM Browser. If you need to customize this behavior, you would need to look into the script, but the default behavior might be sufficient for you.

Note that to correctly parse your specific DSC MRI dataset patch that I introduced last week will be needed, otherwise the resulting volume will not have the timing information. The patch was integrated today, and, if things go well, you should be able to access the updated nightly tomorrow.

Let us know if this answers your question.

1 Like

Thank you so much, and it worked perfect for DSC MRI dataset that I’ve got.

Since you said the patch was integrated for the specific DSC MRI dataset that I have sent you before, I re-installed DSCMRIAnalysis now, which still did not work for the specific dataset.

Do I have to re-install the Slicer with nightly build version? or DSCMRIAnalysis module using extension manager?

All the best,
Kyu Sung

1 Like

Yes, you will have to re-install Slicer, and then re-install the extensions that you need for your work.

Dear Dr.Fedorov,

I am so sorry that updated (Extensions-27273) mpReviewPreprocess module did not work for the specific dataset I sent to you, which I was confused.
When I preprocess the specific DICOM dataset with mpReviewPreprocess module on GUI, and then put it into DSCMRIAnalysis module on GUI, then I’ve got error msg attached below.

image

Same error msg in the command line.

image

However, I do not get error msg when I preprocess the specific DICOM dataset with DICOM module on GUI, and then put it into DSCMRIAnalysis module on GUI.

image

Could you please let me know how to use DICOM module on command line? or could you please fix mpReviewPreprocess module?
Sorry to bother you again.

All the best,
Kyu Sung

Indeed, there was a bug in the mpReviewPreprocessor script. The loadables that were produced by the multivolume plugin were not sorted by confidence by the script. It is now fixed, and should work as expected (consistent with how multivolume is loaded using Slicer DICOM Browser) in the next nightly (as before, you would need to re-install Slicer, and install mpReview extension).

Alternatively, if you want to try the update earlier, you can locate the mpReviewPreprocessor.py script, and add one line to the source code as shown here: https://github.com/SlicerProstate/mpReview/commit/ab6a388eb1d42b3b477386ca99264c46e7808765.

Sorry for the trouble, and thank you for your patience. Your feedback is very helpful in improving the tool.

Dear Dr.Fedorov,

I re-installed Slicer-4.9.0 with 2018-07-22 nightly build version, and tried to re-install the extension DSCMRIAnalysis.
However, it says, “No extensions found for linux:64-bit, revision: ‘27291’. Please try a different combination”

image

I think it could be a problem regarding the version of the extension.
Could you please tell me how I can re-install DSCMRIAnalysis?
Please let me test what you fixed.

All the best,
Kyu Sung Choi

It could be that the extensions were not yet built/packaged at the time you tried. Looking at the dashboard here, the package of DSCAnalysis extension is now ready, so you should try again.

Dear Dr.Fedorov,

I re-installed Slicer-4.9.0 with 2018-07-22 nightly build version, and re-installed the extension DSCMRIAnalysis (27291).
However, same as the last time, it worked with DICOM module to make dicom files of DSC into nrrd files, but mpReview Preprocessor won’t work in GUI as well as in command lines.
I think I correctly entered the directory path of mpReviewPreprocessor.py.
image
Could you please fix it ? or please let me know how to use DICOM modules in command line.

All the best,
Kyu Sung

It seems that there are special characters in the path. Please try again by installing Slicer in a folder that only has ASCII characters in the path and store all data in folders that only contain ASCII characters.

I changed the path of data folder in English.
image
Slicer was already installed in the path which contains only ASCII characters: image
However, it made the same error msg.
image
However, I tried it on my Windows desktop and Ubuntu workstation.
I was able to run mpReview GUI on my Windows desktop, however it doesn’t work on Ubuntu workstation.
Could you please tell me how to use DICOM modules in command lines?

I reboot my workstation, and I don’t know why but it works!
Thank you for your comments.
I really appreciate it.

2 Likes