Commit b5e06cb4aadcba95534b38665f643e84bfb1a1c0
1 parent
fa852f10
Exists in
master
and in
68 other branches
ENH: Changed parameters style
Showing
3 changed files
with
15 additions
and
20 deletions
Show diff stats
invesalius/control.py
@@ -9,7 +9,7 @@ import project as prj | @@ -9,7 +9,7 @@ import project as prj | ||
9 | import data.imagedata_utils as utils | 9 | import data.imagedata_utils as utils |
10 | import data.surface as surface | 10 | import data.surface as surface |
11 | import data.volume as volume | 11 | import data.volume as volume |
12 | -import reader.dicom_reader as dicom | 12 | +import reader.dicom_reader as dcm |
13 | import reader.analyze_reader as analyze | 13 | import reader.analyze_reader as analyze |
14 | 14 | ||
15 | DEFAULT_THRESH_MODE = 0 | 15 | DEFAULT_THRESH_MODE = 0 |
@@ -45,21 +45,22 @@ class Controller(): | @@ -45,21 +45,22 @@ class Controller(): | ||
45 | dir_ = pubsub_evt.data | 45 | dir_ = pubsub_evt.data |
46 | 46 | ||
47 | # Select medical images from directory and generate vtkImageData | 47 | # Select medical images from directory and generate vtkImageData |
48 | - output = dicom.LoadImages(dir_) | 48 | + output = dcm.LoadImages(dir_) |
49 | proj = prj.Project() | 49 | proj = prj.Project() |
50 | proj.name = "Untitled" | 50 | proj.name = "Untitled" |
51 | 51 | ||
52 | if output: | 52 | if output: |
53 | - imagedata, acquisition_modality, tilt_value, orientation,\ | ||
54 | - window, level = output | ||
55 | - | 53 | + #acquisition_modality, tilt_value, orientation,window, level |
54 | + imagedata, dicom = output | ||
55 | + orientation = dicom.image.orientation_label | ||
56 | if (orientation == "CORONAL"): | 56 | if (orientation == "CORONAL"): |
57 | orientation = const.CORONAL | 57 | orientation = const.CORONAL |
58 | elif(orientation == "SAGITTAL"): | 58 | elif(orientation == "SAGITTAL"): |
59 | orientation = const.SAGITAL | 59 | orientation = const.SAGITAL |
60 | else: | 60 | else: |
61 | orientation = const.AXIAL | 61 | orientation = const.AXIAL |
62 | - | 62 | + |
63 | + tilt_value = dicom.acquisition.tilt | ||
63 | if (tilt_value): | 64 | if (tilt_value): |
64 | #TODO: Show dialog so user can set not other value | 65 | #TODO: Show dialog so user can set not other value |
65 | tilt_value *= -1 | 66 | tilt_value *= -1 |
@@ -86,11 +87,11 @@ class Controller(): | @@ -86,11 +87,11 @@ class Controller(): | ||
86 | print "Sorry, but there are no medical images supported on this dir." | 87 | print "Sorry, but there are no medical images supported on this dir." |
87 | else: | 88 | else: |
88 | # Create new project | 89 | # Create new project |
89 | - proj.SetAcquisitionModality(acquisition_modality) | 90 | + proj.SetAcquisitionModality(dicom.acquisition.modality) |
90 | proj.imagedata = imagedata | 91 | proj.imagedata = imagedata |
91 | proj.original_orientation = orientation | 92 | proj.original_orientation = orientation |
92 | - proj.window = window = float(window) | ||
93 | - proj.level = level = float(level) | 93 | + proj.window = window = float(dicom.image.window) |
94 | + proj.level = level = float(dicom.image.level) | ||
94 | const.WINDOW_LEVEL['Default'] = (window, level) | 95 | const.WINDOW_LEVEL['Default'] = (window, level) |
95 | const.WINDOW_LEVEL['Other'] = (window, level) | 96 | const.WINDOW_LEVEL['Other'] = (window, level) |
96 | 97 |
invesalius/reader/dicom.py
@@ -1668,6 +1668,7 @@ class Acquisition(object): | @@ -1668,6 +1668,7 @@ class Acquisition(object): | ||
1668 | self.tilt = parser.GetAcquisitionGantryTilt() | 1668 | self.tilt = parser.GetAcquisitionGantryTilt() |
1669 | self.serie_number = parser.GetImageSeriesNumber() | 1669 | self.serie_number = parser.GetImageSeriesNumber() |
1670 | self.id_study = parser.GetStudyID() | 1670 | self.id_study = parser.GetStudyID() |
1671 | + self.modality = parser.GetAcquisitionModality() | ||
1671 | 1672 | ||
1672 | class Image(object): | 1673 | class Image(object): |
1673 | 1674 |
invesalius/reader/dicom_reader.py
@@ -69,17 +69,9 @@ def LoadImages(dir_): | @@ -69,17 +69,9 @@ def LoadImages(dir_): | ||
69 | dicom = groups[key][0][x] | 69 | dicom = groups[key][0][x] |
70 | file_list.append(dicom.image.file) | 70 | file_list.append(dicom.image.file) |
71 | 71 | ||
72 | - information = groups[key][0][x] | ||
73 | - | ||
74 | - tilt = dicom.acquisition.tilt#groups[key][0][x][11] | ||
75 | - spacing = dicom.image.spacing#groups[key][1][14] | ||
76 | - #spacing_z = #groups[key][1][30] | ||
77 | - orientation = dicom.image.orientation_label#groups[key][0][x][7] | ||
78 | - window = dicom.image.window#groups[key][0][x][12] | ||
79 | - level = dicom.image.level#groups[key][0][x][13] | ||
80 | - | ||
81 | files = file_list | 72 | files = file_list |
82 | - print dicom.image.orientation_label | 73 | + spacing = dicom.image.spacing |
74 | + | ||
83 | #Coronal Crash. necessary verify | 75 | #Coronal Crash. necessary verify |
84 | if (dicom.image.orientation_label <> "CORONAL"): | 76 | if (dicom.image.orientation_label <> "CORONAL"): |
85 | #Organize reversed image | 77 | #Organize reversed image |
@@ -87,6 +79,7 @@ def LoadImages(dir_): | @@ -87,6 +79,7 @@ def LoadImages(dir_): | ||
87 | sorter.SetComputeZSpacing(True) | 79 | sorter.SetComputeZSpacing(True) |
88 | sorter.SetZSpacingTolerance(1e-10) | 80 | sorter.SetZSpacingTolerance(1e-10) |
89 | sorter.Sort(file_list) | 81 | sorter.Sort(file_list) |
82 | + | ||
90 | #Getting organized image | 83 | #Getting organized image |
91 | files = sorter.GetFilenames() | 84 | files = sorter.GetFilenames() |
92 | 85 | ||
@@ -130,7 +123,7 @@ def LoadImages(dir_): | @@ -130,7 +123,7 @@ def LoadImages(dir_): | ||
130 | 123 | ||
131 | image_data.Update() | 124 | image_data.Update() |
132 | 125 | ||
133 | - return image_data, acquisition_modality, tilt, orientation, window, level | 126 | + return image_data, dicom |
134 | 127 | ||
135 | def GetDicomFiles(path, recursive = False): | 128 | def GetDicomFiles(path, recursive = False): |
136 | # TODO!!! SUPER GAMBIARRA!!! DO THIS BETTER | 129 | # TODO!!! SUPER GAMBIARRA!!! DO THIS BETTER |