Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: DICOM To NRRD Module Implementation #30

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ add_subdirectory(AutoSave)
add_subdirectory(CharacterizeTransformMatrix)
add_subdirectory(CombineModels)
add_subdirectory(CurvedPlanarReformat)
add_subdirectory(DICOMToNRRD)
add_subdirectory(DocumentationTools)
if (Slicer_VERSION VERSION_LESS 5.1)
# Latest Slicer 5.1 and above has ITK-Snap Label Description File importer built in
Expand Down
27 changes: 27 additions & 0 deletions DICOMToNRRD/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#-----------------------------------------------------------------------------
set(MODULE_NAME DICOMToNRRD)

#-----------------------------------------------------------------------------
set(MODULE_PYTHON_SCRIPTS
${MODULE_NAME}.py
)

set(MODULE_PYTHON_RESOURCES
# Royalty free CPU icon retrieved from https://publicdomainvectors.org/
Resources/Icons/${MODULE_NAME}.png
)

#-----------------------------------------------------------------------------
slicerMacroBuildScriptedModule(
NAME ${MODULE_NAME}
SCRIPTS ${MODULE_PYTHON_SCRIPTS}
RESOURCES ${MODULE_PYTHON_RESOURCES}
WITH_GENERIC_TESTS
)

#-----------------------------------------------------------------------------
if(BUILD_TESTING)
# run ctest -C Release -R py_DICOMToNRRD -VV in Slicer-build to test this out individually
slicer_add_python_unittest(SCRIPT ${MODULE_NAME}.py)

endif()
12 changes: 12 additions & 0 deletions DICOMToNRRD/DICOM To NRRD Slicer Test Cases.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Test Case #,Description,“Create DICOM information file/s” Checked? Y / N," ""NRRD Scalar Volumes Only"" Checked ? Y / N",# NRRD Files Generated,# PatientDICOMInfo.json Files Generated,Data Description URI,Date Tested
1,I tested 5 / 126 Liver Cancer B-mode-and-CEUS-Liver scans,Y,N,5,5,https://www.cancerimagingarchive.net/collection/b-mode-and-ceus-liver/,06/26/24
2,I tested 5 / 126 Liver Cancer B-mode-and-CEUS-Liver scans,N,Y,5,0,https://www.cancerimagingarchive.net/collection/b-mode-and-ceus-liver/,06/26/24
3,I tested ReMIND-001,Y,Y,6,6,https://www.cancerimagingarchive.net/collection/remind/,06/26/24
4,I tested ReMIND-001,N,N,6,0,https://www.cancerimagingarchive.net/collection/remind/,06/26/24
5,I tested folder 144126-210-T-1637,Y,Y,2,2,https://www.cancerimagingarchive.net/collection/pdmr-texture-analysis/,06/26/24
6,I tested folder CMB-MML-MSB-07473,N,N,1,1,https://www.cancerimagingarchive.net/collection/cmb-mml/,06/26/24
7,I tested 105 random DICOM scans,Y,Y,105,105,https://www.cancerimagingarchive.net/browse-collections/,06/26/24
8,I tested C3N-02715,N,N,7,7,https://www.cancerimagingarchive.net/collection/cptac-luad/,06/26/24
9,I tested 500 scans from NLST,Y,Y,500,500,https://www.cancerimagingarchive.net/collection/nlst/,06/26/24
10,Tested one folder CMB-MML-MSB-01103,Y,Y,8,8,https://www.cancerimagingarchive.net/collection/cmb-mml/,12/06/24
11,Tested the whole CMB-MML folder,Y,N,186,186,https://www.cancerimagingarchive.net/collection/cmb-mml/,12/06/24
404 changes: 404 additions & 0 deletions DICOMToNRRD/DICOMToNRRD.py

Large diffs are not rendered by default.

Binary file added DICOMToNRRD/Resources/DICOMToNRRD.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added DICOMToNRRD/Resources/DICOMToNRRD.xcf
Binary file not shown.
Binary file added DICOMToNRRD/Resources/Icons/DICOMToNRRD.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added DICOMToNRRD/Resources/Icons/DICOMToNRRD.xcf
Binary file not shown.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,22 @@ Example module that allows opening a file in 3D Slicer by clicking on a link in
Example links that open image and/or segmentation in 3D Slicer:
- LungCTAnalyzerChestCT image: `slicer://viewer/?download=https%3A%2F%2Fgithub.com%2Frbumm%2FSlicerLungCTAnalyzer%2Freleases%2Fdownload%2FSampleData%2FLungCTAnalyzerChestCT.nrrd`
- LungCTAnalyzerChestCT image + segmentation" `slicer://viewer/?show3d=true&segmentation=https%3A%2F%2Fgithub.com%2Frbumm%2FSlicerLungCTAnalyzer%2Freleases%2Fdownload%2FSampleData%2FLungCTAnalyzerMaskSegmentation.seg.nrrd&image=https%3A%2F%2Fgithub.com%2Frbumm%2FSlicerLungCTAnalyzer%2Freleases%2Fdownload%2FSampleData%2FLungCTAnalyzerChestCT.nrrd`

## DICOMToNRRD

The DICOM To NRRD module provides batch processing for converting DICOM files into NRRD files and outputs the files into a DICOM standard conforming folder hierarchy of Patient/Study/Series. Nearly Raw Raster Data (NRRD) was developed by Professor Gordon Kindlmann: https://people.cs.uchicago.edu/~glk/software/

![image](DICOMToNRRD/Resources/DICOMToNRRD.png)

### Tutorial

- Click the magnifying glass next to "Modules:" (near the top left of the window)
- Scroll down and click `DICOM To NRRD`
- Ensure the Parameters window is expanded (you may need to click the arrow to the left of Parameters)
- Select an input DICOM directory
- Select an output NRRD directory
- Optionally uncheck "NRRD Scalar Volumes Only:"
- Optionally uncheck "Create DICOM metadata file/s:"
- Click Process button to convert DICOM files to NRRD files
- Wait for the popup window: "DICOM to NRRD processing finished" and then click OK
- The outputted DICOM NRRD directory shall contain a hierarchy of Patient/Study/Series folders each with a NRRD file