Commit c8c3f8afe1feb511aefe035435abee1e4804edae
1 parent
27bd47f0
Exists in
master
Using IPPSorter when dicom orientation is coronal
Showing
2 changed files
with
21 additions
and
21 deletions
Show diff stats
invesalius/reader/dicom_grouper.py
| @@ -130,23 +130,23 @@ class DicomGroup: | @@ -130,23 +130,23 @@ class DicomGroup: | ||
| 130 | else: | 130 | else: |
| 131 | filelist = [dicom.image.file for dicom in | 131 | filelist = [dicom.image.file for dicom in |
| 132 | self.slices_dict.values()] | 132 | self.slices_dict.values()] |
| 133 | - | 133 | + |
| 134 | # Sort slices using GDCM | 134 | # Sort slices using GDCM |
| 135 | - if (self.dicom.image.orientation_label != "CORONAL"): | ||
| 136 | - #Organize reversed image | ||
| 137 | - sorter = gdcm.IPPSorter() | ||
| 138 | - sorter.SetComputeZSpacing(True) | ||
| 139 | - sorter.SetZSpacingTolerance(1e-10) | ||
| 140 | - try: | ||
| 141 | - sorter.Sort([utils.encode(i, const.FS_ENCODE) for i in filelist]) | ||
| 142 | - except TypeError: | ||
| 143 | - sorter.Sort(filelist) | ||
| 144 | - filelist = sorter.GetFilenames() | 135 | + #if (self.dicom.image.orientation_label != "CORONAL"): |
| 136 | + #Organize reversed image | ||
| 137 | + sorter = gdcm.IPPSorter() | ||
| 138 | + sorter.SetComputeZSpacing(True) | ||
| 139 | + sorter.SetZSpacingTolerance(1e-10) | ||
| 140 | + try: | ||
| 141 | + sorter.Sort([utils.encode(i, const.FS_ENCODE) for i in filelist]) | ||
| 142 | + except TypeError: | ||
| 143 | + sorter.Sort(filelist) | ||
| 144 | + filelist = sorter.GetFilenames() | ||
| 145 | 145 | ||
| 146 | # for breast-CT of koning manufacturing (KBCT) | 146 | # for breast-CT of koning manufacturing (KBCT) |
| 147 | if list(self.slices_dict.values())[0].parser.GetManufacturerName() == "Koning": | 147 | if list(self.slices_dict.values())[0].parser.GetManufacturerName() == "Koning": |
| 148 | filelist.sort() | 148 | filelist.sort() |
| 149 | - | 149 | + |
| 150 | return filelist | 150 | return filelist |
| 151 | 151 | ||
| 152 | def GetHandSortedList(self): | 152 | def GetHandSortedList(self): |
invesalius/reader/dicom_reader.py
| @@ -82,15 +82,15 @@ def SelectLargerDicomGroup(patient_group): | @@ -82,15 +82,15 @@ def SelectLargerDicomGroup(patient_group): | ||
| 82 | def SortFiles(filelist, dicom): | 82 | def SortFiles(filelist, dicom): |
| 83 | # Sort slices | 83 | # Sort slices |
| 84 | # FIXME: Coronal Crash. necessary verify | 84 | # FIXME: Coronal Crash. necessary verify |
| 85 | - if (dicom.image.orientation_label != "CORONAL"): | ||
| 86 | - ##Organize reversed image | ||
| 87 | - sorter = gdcm.IPPSorter() | ||
| 88 | - sorter.SetComputeZSpacing(True) | ||
| 89 | - sorter.SetZSpacingTolerance(1e-10) | ||
| 90 | - sorter.Sort(filelist) | ||
| 91 | - | ||
| 92 | - #Getting organized image | ||
| 93 | - filelist = sorter.GetFilenames() | 85 | + # if (dicom.image.orientation_label != "CORONAL"): |
| 86 | + ##Organize reversed image | ||
| 87 | + sorter = gdcm.IPPSorter() | ||
| 88 | + sorter.SetComputeZSpacing(True) | ||
| 89 | + sorter.SetZSpacingTolerance(1e-10) | ||
| 90 | + sorter.Sort(filelist) | ||
| 91 | + | ||
| 92 | + #Getting organized image | ||
| 93 | + filelist = sorter.GetFilenames() | ||
| 94 | 94 | ||
| 95 | return filelist | 95 | return filelist |
| 96 | 96 |