Commit ef4591da93362b6ad8938f4a840dc35418484428
1 parent
75348ea4
Exists in
master
and in
68 other branches
ADD: Part of the implementation new DICOM Class, selected the series with the la…
…rgest number of slices.
Showing
2 changed files
with
12 additions
and
10 deletions
Show diff stats
invesalius/reader/dicom_grouper.py
... | ... | @@ -94,6 +94,7 @@ class DicomGroup: |
94 | 94 | |
95 | 95 | def GetSpacing(self): |
96 | 96 | list_ = self.GetSortedList() |
97 | + | |
97 | 98 | if (len(list_) > 1): |
98 | 99 | dicom = list_[0] |
99 | 100 | axis = ORIENT_MAP[dicom.image.orientation_label] |
... | ... | @@ -142,7 +143,7 @@ class PatientGroup: |
142 | 143 | if not slice_added: |
143 | 144 | # If we're here, then Problem 2 occured |
144 | 145 | # TODO: Optimize recursion |
145 | - self.AddFile(file_path, index+1) | |
146 | + self.AddFile(dicom, index+1) | |
146 | 147 | |
147 | 148 | group.GetSpacing() |
148 | 149 | ... | ... |
invesalius/reader/dicom_reader.py
... | ... | @@ -32,19 +32,20 @@ def LoadImages(dir_): |
32 | 32 | # TODO!!! SUPER GAMBIARRA!!! DO THIS BETTER |
33 | 33 | |
34 | 34 | patient_group = GetDicomFiles(dir_) |
35 | - | |
35 | + #select the series with the largest | |
36 | + #number of slices. | |
37 | + nslices_old = 0 | |
36 | 38 | for patient in patient_group: |
37 | 39 | group_list = patient.GetGroups() |
38 | 40 | for group in group_list: |
39 | - d = group.GetList() | |
40 | - spacing = group.spacing | |
41 | - | |
42 | - #dcm_series = dicom_grouper.DicomGroup() | |
43 | - #dcm_series.SetFileList(dcm_files) | |
44 | - #dcm_series.Update() | |
45 | - | |
41 | + nslices = group.nslices | |
42 | + if (nslices >= nslices_old): | |
43 | + dicoms = group.GetList() | |
44 | + spacing = group.spacing | |
45 | + nslices_old = nslices | |
46 | + | |
46 | 47 | file_list = [] |
47 | - for dicom in d: | |
48 | + for dicom in dicoms: | |
48 | 49 | file_list.append(dicom.image.file) |
49 | 50 | |
50 | 51 | #Coronal Crash. necessary verify | ... | ... |