Commit ee819756337b4e644b28129f5e50fab7f1e1e35c
1 parent
a9f22507
Exists in
master
and in
6 other branches
ADD: Project status, OPEN_PROJECT, NEW_PROJECT and SAVE_PROJECT
Showing
4 changed files
with
14 additions
and
6 deletions
Show diff stats
invesalius/control.py
... | ... | @@ -33,6 +33,7 @@ import reader.dicom_grouper as dg |
33 | 33 | import gui.dialogs as dialog |
34 | 34 | import reader.dicom_reader as dcm |
35 | 35 | import reader.analyze_reader as analyze |
36 | +import session | |
36 | 37 | |
37 | 38 | DEFAULT_THRESH_MODE = 0 |
38 | 39 | |
... | ... | @@ -45,7 +46,8 @@ class Controller(): |
45 | 46 | self.frame = frame |
46 | 47 | self.progress_dialog = None |
47 | 48 | self.cancel_import = False |
48 | - | |
49 | + #Init session | |
50 | + session.Session() | |
49 | 51 | |
50 | 52 | def __bind_events(self): |
51 | 53 | ps.Publisher().subscribe(self.OnImportMedicalImages, 'Import directory') |
... | ... | @@ -271,11 +273,11 @@ class Controller(): |
271 | 273 | prj.Project().name = filename |
272 | 274 | prj.Project().path = filename |
273 | 275 | prj.Project().SavePlistProject(dir_, filename) |
276 | + session.Session().project_status = const.SAVE_PROJECT | |
274 | 277 | |
275 | 278 | def OnOpenProject(self, pubsub_evt): |
276 | 279 | filename = os.path.abspath(pubsub_evt.data) |
277 | - | |
278 | - | |
280 | + session.Session().project_status = const.OPEN_PROJECT | |
279 | 281 | proj = prj.Project() |
280 | 282 | proj.OpenPlistProject(filename) |
281 | 283 | proj.SetAcquisitionModality(proj.modality) |
... | ... | @@ -285,5 +287,4 @@ class Controller(): |
285 | 287 | const.THRESHOLD_INVALUE = proj.threshold_range[1] |
286 | 288 | const.WINDOW_LEVEL['Default'] = (proj.window, proj.level) |
287 | 289 | const.WINDOW_LEVEL['Manual'] = (proj.window, proj.level) |
288 | - | |
289 | - self.LoadProject() | |
290 | + self.LoadProject() | |
290 | 291 | \ No newline at end of file | ... | ... |
invesalius/data/slice_.py
... | ... | @@ -25,6 +25,7 @@ import constants as const |
25 | 25 | import imagedata_utils as iu |
26 | 26 | from mask import Mask |
27 | 27 | from project import Project |
28 | +import session | |
28 | 29 | from utils import Singleton |
29 | 30 | |
30 | 31 | |
... | ... | @@ -115,7 +116,10 @@ class Slice(object): |
115 | 116 | |
116 | 117 | def __set_current_mask_threshold(self, evt_pubsub): |
117 | 118 | #FIXME: find a better way to implement this |
118 | - if (self.num_gradient >= 2): | |
119 | + print session.Session().project_status | |
120 | + if (self.num_gradient >= 2) or \ | |
121 | + (session.Session().project_status != const.OPEN_PROJECT): | |
122 | + print "ENTROU........................................................" | |
119 | 123 | threshold_range = evt_pubsub.data |
120 | 124 | index = self.current_mask.index |
121 | 125 | self.SetMaskThreshold(index, threshold_range) | ... | ... |
invesalius/project.py
invesalius/reader/dicom_reader.py
... | ... | @@ -32,6 +32,7 @@ import constants as const |
32 | 32 | import dicom |
33 | 33 | import dicom_grouper |
34 | 34 | import data.imagedata_utils as iu |
35 | +import session | |
35 | 36 | |
36 | 37 | def ReadDicomGroup(dir_): |
37 | 38 | |
... | ... | @@ -40,6 +41,7 @@ def ReadDicomGroup(dir_): |
40 | 41 | filelist, dicom, zspacing = SelectLargerDicomGroup(patient_group) |
41 | 42 | filelist = SortFiles(filelist, dicom) |
42 | 43 | imagedata = CreateImageData(filelist, zspacing) |
44 | + session.Session().project_status = const.NEW_PROJECT | |
43 | 45 | return imagedata, dicom |
44 | 46 | else: |
45 | 47 | return False | ... | ... |