Commit 693979e22bbc81857a9e39944d1ee512b10547e0
1 parent
423f557b
Exists in
master
and in
68 other branches
TEST: Testing svn keyword Revision
Showing
1 changed file
with
62 additions
and
7 deletions
Show diff stats
invesalius/project.py
... | ... | @@ -42,20 +42,20 @@ class Project(object): |
42 | 42 | # coordinate systems. It might be used, as well, for 3D raycasting. |
43 | 43 | # rendering. |
44 | 44 | # TODO: Discuss when this will be used. |
45 | - self.imagedata = None | |
45 | + self.imagedata = '' | |
46 | 46 | |
47 | 47 | # Masks are related to vtkImageData |
48 | 48 | self.mask_dict = {} |
49 | 49 | # Predefined threshold values |
50 | - self.min_threshold = None | |
51 | - self.max_threshold = None | |
50 | + self.min_threshold = '' | |
51 | + self.max_threshold = '' | |
52 | 52 | |
53 | - self.window = None | |
54 | - self.level = None | |
53 | + self.window = '' | |
54 | + self.level = '' | |
55 | 55 | |
56 | 56 | self.presets = Presets() |
57 | 57 | |
58 | - self.original_orientation = None | |
58 | + self.original_orientation = '' | |
59 | 59 | # MRI ? CT? |
60 | 60 | self.threshold_modes = self.presets.thresh_ct |
61 | 61 | |
... | ... | @@ -85,9 +85,10 @@ class Project(object): |
85 | 85 | # self.render_mode = {} |
86 | 86 | |
87 | 87 | # The raycasting preset setted in this project |
88 | - self.raycasting_preset = None | |
88 | + self.raycasting_preset = '' | |
89 | 89 | |
90 | 90 | self.debug = 0 |
91 | + self.version = "$Revision$" | |
91 | 92 | |
92 | 93 | ####### MASK OPERATIONS |
93 | 94 | |
... | ... | @@ -119,3 +120,57 @@ class Project(object): |
119 | 120 | path = os.path.join(RAYCASTING_PRESETS_DIRECTORY, label + '.plist') |
120 | 121 | preset = plistlib.readPlist(path) |
121 | 122 | ps.Publisher.sendMessage('Set raycasting preset', preset) |
123 | + | |
124 | + def SavePlistProjectOld(self, filename): | |
125 | + project = {} | |
126 | + | |
127 | + for key in self.__dict__: | |
128 | + if getattr(self.__dict__[key], 'SavePlist'): | |
129 | + project[key] = {'path': self.__dict__[key].SavePlist('.')} | |
130 | + else: | |
131 | + project[key] = self.__dict__[key] | |
132 | + | |
133 | + masks = {} | |
134 | + for index in self.mask_dict: | |
135 | + masks[str(index)] = "self.mask_dict[index]" | |
136 | + print index | |
137 | + | |
138 | + surfaces = {} | |
139 | + for index in self.surface_dict: | |
140 | + surfaces[str(index)] = "self.surface_dict[index]" | |
141 | + print index | |
142 | + | |
143 | + project['surface_dict'] = surfaces | |
144 | + project['mask_dict'] = masks | |
145 | + project['imagedata'] = 'imagedata' | |
146 | + | |
147 | + plistlib.writePlist(project, filename) | |
148 | + | |
149 | + def SavePlistProject(self, filename, object=None): | |
150 | + if object is None: | |
151 | + object = self | |
152 | + supported_types = (str, int, float, bool, tuple, list, dict, | |
153 | + plistlib.Data) | |
154 | + project = {} | |
155 | + for key in object.__dict__: | |
156 | + prop = object.__dict__[key] | |
157 | + if isinstance(prop, supported_types): | |
158 | + project[key] = prop | |
159 | + print key | |
160 | + print project | |
161 | + plistlib.writePlist(project, filename) | |
162 | + | |
163 | + def OpenPlistProject(self, filename): | |
164 | + project = plistlib.readPlist(filename) | |
165 | + masks = project['masks'] | |
166 | + for index in masks: | |
167 | + self.mask_dict[index] = masks[index] | |
168 | + | |
169 | + surfaces = project['surfaces'] | |
170 | + for index in surfaces: | |
171 | + self.surface_dict[index] = surfaces[index] | |
172 | + | |
173 | + self.min_threshold = project['min threshold'] | |
174 | + self.max_threshold = project['max threshold'] | |
175 | + self.window = project['window'] | |
176 | + self.level = project['level'] | ... | ... |