Skip to content

Commit 92abed9

Browse files
authored
Merge pull request #102 from GaelleLeroux/MRI2CBCT
MRI2CBCT extension
2 parents 6b331d1 + 9595031 commit 92abed9

34 files changed

+4147
-9
lines changed

ASO_CBCT/LinearTransform_t.tfm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#Insight Transform File V1.0
2+
#Transform 0
3+
Transform: AffineTransform_double_3_3
4+
Parameters: 0.9763290732702393 0.15616745925611628 0.14964379491567228 -0.1421477793365056 0.9847545451025459 -0.10026213008697676 -0.16302008930489087 0.07661729941316797 0.9836433499565058 3.8520097928318386 10.915991569159537 -4.582919224464414
5+
FixedParameters: 0 0 0

AutoMatrix/AutoMatrix.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ def ProcessVolume(self)-> None:
468468
print("not a .nii.gz")
469469

470470
self.UpdateTime()
471-
if extension_scan!=".nii.gz":
471+
if extension_scan!=".nii.gz" and extension_scan!=".nrrd":
472472
model = slicer.util.loadModel(scan)
473473
else :
474474
model = slicer.util.loadVolume(scan)
@@ -616,7 +616,7 @@ def onProcessStarted(self)->None:
616616
Initialize the variables and progress bar.
617617
"""
618618
if os.path.isdir(self.ui.LineEditPatient.text):
619-
self.nbFiles = len(self.dico_patient[".vtk"]) + len(self.dico_patient['.vtp']) + len(self.dico_patient['.stl']) + len(self.dico_patient['.off']) + len(self.dico_patient['.obj']) + len(self.dico_patient['.nii.gz'])
619+
self.nbFiles = len(self.dico_patient[".vtk"]) + len(self.dico_patient['.vtp']) + len(self.dico_patient['.stl']) + len(self.dico_patient['.off']) + len(self.dico_patient['.obj']) + len(self.dico_patient['.nii.gz']) + len(self.dico_patient['nrrd'])
620620
else:
621621
self.nbFiles = 1
622622
self.ui.progressBar.setValue(0)
@@ -645,20 +645,20 @@ def CheckGoodEntre(self)->bool:
645645
warning_text = warning_text + "Enter file patient" + "\n"
646646
else :
647647
if self.ui.ComboBoxPatient.currentIndex==1 : #folder option
648-
self.dico_patient=search(self.ui.LineEditPatient.text,'.vtk','.vtp','.stl','.off','.obj','.nii.gz')
649-
if len(self.dico_patient['.vtk'])==0 and len(self.dico_patient['.vtp']) and len(self.dico_patient['.stl']) and len(self.dico_patient['.off']) and len(self.dico_patient['.obj']) and len(self.dico_patient['.nii.gz']) :
648+
self.dico_patient=search(self.ui.LineEditPatient.text,'.vtk','.vtp','.stl','.off','.obj','.nii.gz','nrrd')
649+
if len(self.dico_patient['.vtk'])==0 and len(self.dico_patient['.vtp']) and len(self.dico_patient['.stl']) and len(self.dico_patient['.off']) and len(self.dico_patient['.obj']) and len(self.dico_patient['.nii.gz']) and len(self.dico_patient['.nrrd']) :
650650
warning_text = warning_text + "Folder empty or wrong type of file patient" + "\n"
651-
warning_text = warning_text + "File authorized : .vtk / .vtp / .stl / .off / .obj / .nii.gz" + "\n"
651+
warning_text = warning_text + "File authorized : .vtk / .vtp / .stl / .off / .obj / .nii.gz / .nrrd" + "\n"
652652
elif self.ui.ComboBoxPatient.currentIndex==0 : # file option
653653
fname, extension = os.path.splitext(os.path.basename(self.ui.LineEditPatient.text))
654654
try :
655655
fname, extension2 = os.path.splitext(os.path.basename(fname))
656656
extension = extension2+extension
657657
except :
658658
print("not a .nii.gz")
659-
if extension != ".vtk" and extension != ".vtp" and extension != ".stl" and extension != ".off" and extension != ".obj" and extension != ".nii.gz" :
659+
if extension != ".vtk" and extension != ".vtp" and extension != ".stl" and extension != ".off" and extension != ".obj" and extension != ".nii.gz" and extension != ".nrrd":
660660
warning_text = warning_text + "Wrong type of file patient detected" + "\n"
661-
warning_text = warning_text + "File authorized : .vtk / .vtp / .stl / .off / .obj / .nii.gz" + "\n"
661+
warning_text = warning_text + "File authorized : .vtk / .vtp / .stl / .off / .obj / .nii.gz / .nrrd" + "\n"
662662

663663

664664
if self.ui.LineEditMatrix.text=="":

AutoMatrix/Method/General_tools.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def GetPatients(file_path:str,matrix_path:str):
4545
files = []
4646

4747
if Path(file_path).is_dir():
48-
files_original = search(file_path,'.vtk','.vtp','.stl','.off','.obj','.nii.gz')
48+
files_original = search(file_path,'.vtk','.vtp','.stl','.off','.obj','.nii.gz','.nrrd')
4949
files = []
5050
for i in range(len(files_original['.vtk'])):
5151
files.append(files_original['.vtk'][i])
@@ -64,6 +64,9 @@ def GetPatients(file_path:str,matrix_path:str):
6464

6565
for i in range(len(files_original['.nii.gz'])):
6666
files.append(files_original['.nii.gz'][i])
67+
68+
for i in range(len(files_original['.nrrd'])):
69+
files.append(files_original['.nrrd'][i])
6770

6871
for i in range(len(files)):
6972
file = files[i]
@@ -87,7 +90,7 @@ def GetPatients(file_path:str,matrix_path:str):
8790
except :
8891
print("not a .nii.gz")
8992

90-
if extension ==".vtk" or extension ==".vtp" or extension ==".stl" or extension ==".off" or extension ==".obj" or extension==".nii.gz" :
93+
if extension ==".vtk" or extension ==".vtp" or extension ==".stl" or extension ==".off" or extension ==".obj" or extension==".nii.gz" or extension==".nrrd" :
9194
files = [file_path]
9295
file_pat = os.path.basename(file_path).split('_Seg')[0].split('_seg')[0].split('_Scan')[0].split('_scan')[0].split('_Or')[0].split('_OR')[0].split('_MAND')[0].split('_MD')[0].split('_MAX')[0].split('_MX')[0].split('_CB')[0].split('_lm')[0].split('_T2')[0].split('_T1')[0].split('_Cl')[0].split('.')[0].replace('.','')
9396
for i in range(50):

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ add_subdirectory(AREG)
3535
add_subdirectory(AutoMatrix)
3636
add_subdirectory(AutoCrop3D)
3737

38+
add_subdirectory(MRI2CBCT)
39+
add_subdirectory(MRI2CBCT_CLI)
3840
## NEXT_MODULE
3941

4042
#-----------------------------------------------------------------------------

MRI2CBCT/CMakeLists.txt

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#-----------------------------------------------------------------------------
2+
set(MODULE_NAME MRI2CBCT)
3+
4+
#-----------------------------------------------------------------------------
5+
set(MODULE_PYTHON_SCRIPTS
6+
${MODULE_NAME}.py
7+
utils/Method.py
8+
utils/Preprocess_CBCT_MRI.py
9+
utils/Preprocess_CBCT.py
10+
utils/Preprocess_MRI.py
11+
utils/Reg_MRI2CBCT.py
12+
utils/utils_CBCT.py
13+
)
14+
15+
set(MODULE_PYTHON_RESOURCES
16+
Resources/Icons/${MODULE_NAME}.png
17+
Resources/UI/${MODULE_NAME}.ui
18+
)
19+
20+
#-----------------------------------------------------------------------------
21+
slicerMacroBuildScriptedModule(
22+
NAME ${MODULE_NAME}
23+
SCRIPTS ${MODULE_PYTHON_SCRIPTS}
24+
RESOURCES ${MODULE_PYTHON_RESOURCES}
25+
WITH_GENERIC_TESTS
26+
)
27+
28+
#-----------------------------------------------------------------------------
29+
if(BUILD_TESTING)
30+
31+
# Register the unittest subclass in the main script as a ctest.
32+
# Note that the test will also be available at runtime.
33+
slicer_add_python_unittest(SCRIPT ${MODULE_NAME}.py)
34+
35+
# Additional build-time testing
36+
add_subdirectory(Testing)
37+
endif()

0 commit comments

Comments
 (0)