Skip to content

Commit e5de926

Browse files
committed
fixed nii/nrrd pipelines, added plastimatch instructions to README
1 parent 71f6705 commit e5de926

5 files changed

Lines changed: 20 additions & 9 deletions

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ The AI results shown above can also be found [here](samples/NSCLC_Radiomics_lung
5858
- pynrrd
5959
- SimpleITK
6060
- pyplastimatch
61+
- plastimatch
6162
- scipy
6263
- scikit-image
6364
- pandas
@@ -75,6 +76,8 @@ The AI results shown above can also be found [here](samples/NSCLC_Radiomics_lung
7576
Recommended and supported Python versions are **3.8** and **3.10**.
7677
Please follow to the installation instructions to ensure reproducibility of this code. The algorithm was developed on Ubuntu 20.04.6 LTS, using Python 3.10.13. GPU used was NVIDIA RTX A6000, 49GB.
7778

79+
**If you wish to leverage our tool on DICOM data, we internally rely on plastimatch and pyplastimatch tools for DICOM CT to .nrrd/.nii.gz conversion. Please follow the instructions [here](https://github.com/ImagingDataCommons/pyplastimatch?tab=readme-ov-file#plastimatch) for plastimatch installation, depending on your OS.**
80+
7881
### Windows instructions
7982

8083
```
@@ -241,7 +244,8 @@ ROCardS --input InputFolder --output OutputFolder
241244
```
242245

243246
### **Single case:**
244-
- DICOM
247+
248+
- DICOM
245249
```
246250
ROCardS --input inputDcmFolder --output outputFolder/
247251

ROCardS/pyROCardS.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ def process_dcm_case(inputPath, outFolder, workingDir, df_labels, modelPath):
4848

4949
#DICOM to NRRD to NIFTI
5050
patSrc = inputPath
51+
52+
#make sure input dcm folder has dicom objects
53+
try:
54+
assert len(glob.glob(os.path.join(inputPath, "*.dcm"))) > 0
55+
except:
56+
raise Exception(f"no DICOM objects found in case folder : {os.path.join(inputPath)}")
57+
5158
patDst = os.path.join(workingDir,"dcm_in")
5259
shutil.copytree(patSrc,patDst)
5360

@@ -155,6 +162,7 @@ def main_process_cases(inputPath, outFolder, df_labels, modelPath, verbose=False
155162
with suppress_output(verbose):
156163
#init working Dir
157164
with tempfile.TemporaryDirectory() as workingDir:
165+
assert os.path.exists(workingDir)
158166
if inputType == "dcm":
159167
#DICOM to NRRD to NIFTI
160168
ds = pydicom.dcmread(glob.glob(os.path.join(inputPath, "*.dcm"))[0])
@@ -215,7 +223,7 @@ def main_process_cases(inputPath, outFolder, df_labels, modelPath, verbose=False
215223
outFolderCase = os.path.join(outFolder, caseName)
216224
os.makedirs(outFolderCase, exist_ok=True)
217225
process_nii_case(caseIDPath, outFolderCase, workingDir,
218-
df_labels)
226+
df_labels, modelPath)
219227

220228
elif inputType == "nrrd":
221229
for caseIDPath in tqdm(sorted(glob.glob(os.path.join(inputPath, "*.nrrd"))), desc="Processing cases"):
@@ -228,7 +236,7 @@ def main_process_cases(inputPath, outFolder, df_labels, modelPath, verbose=False
228236
outFolderCase = os.path.join(outFolder, caseName)
229237
os.makedirs(outFolderCase, exist_ok=True)
230238
process_nrrd_case(caseIDPath, outFolderCase, workingDir,
231-
df_labels)
239+
df_labels, modelPath)
232240

233241
else:
234242
raise Exception(f"inputType not in nii.gz/nrrd/dcm, please double check your input type.")

ROCardS/utils_data_process.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,12 +575,12 @@ def detect_input_type_and_format(inputPath : str):
575575
return (singleCase, inputType)
576576

577577
#multiple cases, either nii(.nii.gz) or nrrd
578-
if len(filesLst) > 1 and extLst[0] in ["nii.gz", "nrrd"]:
578+
if len(filesLst) >= 1 and extLst[0] in ["nii.gz", "nrrd"]:
579579
folderCases = True
580580
singleCase = False
581581
inputType = extLst[0]
582582
return (singleCase, inputType)
583-
583+
584584
#input path is a file
585585
else:
586586
folderCases = False

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,12 @@ dependencies = [
3333
"scipy==1.14.1; python_version == '3.10'",
3434
"scikit-image==0.21.0; python_version in '3.8, 3.9'",
3535
"scikit-image==0.24.0; python_version == '3.10'",
36-
"tensorflow-io-gcs-filesystem==0.34.0; python_version in '3.8, 3.9'",
37-
"tensorflow-io-gcs-filesystem==0.37.1; python_version == '3.10'",
36+
"tensorflow-io-gcs-filesystem==0.31.0; python_version in '3.8, 3.9, 3.10'",
3837
"python-gdcm==3.0.24.1; python_version in '3.8, 3.9'"
3938
]
4039

4140
[project.urls]
42-
Homepage = "https://github.com/??/??"
41+
Homepage = "https://github.com/AIM-Harvard/ROCardS"
4342

4443
[project.scripts]
4544
ROCardS = "ROCardS.cli.ROCardS:main"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"pandas==2.3.1; python_version == '3.10'",
3535
"scipy==1.14.1; python_version == '3.10'",
3636
"scikit-image==0.24.0; python_version == '3.10'",
37-
"tensorflow-io-gcs-filesystem==0.37.1; python_version == '3.10'",
37+
"tensorflow-io-gcs-filesystem==0.34.0; python_version == '3.10'",
3838
# "nvidia-cublas-cu12==12.4.5.8; python_version == '3.10'",
3939
# "nvidia-cuda-cupti-cu12==12.4.127; python_version == '3.10'",
4040
# "nvidia-cuda-nvrtc-cu12==12.4.127; python_version == '3.10'",

0 commit comments

Comments
 (0)