Commit b7bb24bd090e7ac4b850dda8abb2302d191ee335
1 parent
2abd1cd3
Exists in
measure_improvements
Improvements
Showing
3 changed files
with
20 additions
and
13 deletions
Show diff stats
invesalius/data/measures.py
... | ... | @@ -107,7 +107,7 @@ class MeasurementManager(object): |
107 | 107 | spacing = 1.0, 1.0, 1.0 |
108 | 108 | for i in dict: |
109 | 109 | m = dict[i] |
110 | - | |
110 | + | |
111 | 111 | if m.location == const.AXIAL: |
112 | 112 | radius = min(spacing[1], spacing[2]) * const.PROP_MEASURE |
113 | 113 | |
... | ... | @@ -130,8 +130,10 @@ class MeasurementManager(object): |
130 | 130 | for point in m.points: |
131 | 131 | x, y, z = point |
132 | 132 | actors = mr.AddPoint(x, y, z) |
133 | - # Publisher.sendMessage(("Add actors " + str(m.location)), | |
134 | - # (actors, m.slice_number)) | |
133 | + | |
134 | + if m.location == const.SURFACE: | |
135 | + Publisher.sendMessage(("Add actors " + str(m.location)), | |
136 | + (actors, m.slice_number)) | |
135 | 137 | self.current = None |
136 | 138 | |
137 | 139 | if not m.is_shown: |
... | ... | @@ -145,7 +147,6 @@ class MeasurementManager(object): |
145 | 147 | position = pubsub_evt.data[0] |
146 | 148 | type = pubsub_evt.data[1] # Linear or Angular |
147 | 149 | location = pubsub_evt.data[2] # 3D, AXIAL, SAGITAL, CORONAL |
148 | - renderer = pubsub_evt.data[-1] | |
149 | 150 | |
150 | 151 | if location == const.SURFACE: |
151 | 152 | slice_number = 0 |
... | ... | @@ -193,7 +194,6 @@ class MeasurementManager(object): |
193 | 194 | mr = LinearMeasure(m.colour, representation) |
194 | 195 | else: |
195 | 196 | mr = AngularMeasure(m.colour, representation) |
196 | - mr.renderer = renderer | |
197 | 197 | if to_remove: |
198 | 198 | print "---To REMOVE" |
199 | 199 | # actors = self.current[1].GetActors() |
... | ... | @@ -217,8 +217,10 @@ class MeasurementManager(object): |
217 | 217 | x, y, z = position |
218 | 218 | actors = mr.AddPoint(x, y, z) |
219 | 219 | m.points.append(position) |
220 | - # Publisher.sendMessage("Add actors " + str(location), | |
221 | - # (actors, m.slice_number)) | |
220 | + | |
221 | + if m.location == const.SURFACE: | |
222 | + Publisher.sendMessage("Add actors " + str(location), | |
223 | + (actors, m.slice_number)) | |
222 | 224 | |
223 | 225 | if self.current not in self.measures: |
224 | 226 | self.measures.append(self.current) |
... | ... | @@ -250,13 +252,17 @@ class MeasurementManager(object): |
250 | 252 | |
251 | 253 | def _remove_measurements(self, pubsub_evt): |
252 | 254 | indexes = pubsub_evt.data |
253 | - print indexes | |
254 | 255 | for index in indexes: |
255 | 256 | m, mr = self.measures.pop(index) |
256 | - actors = mr.GetActors() | |
257 | + try: | |
258 | + mr.Remove() | |
259 | + except AttributeError: | |
260 | + # The is not being displayed | |
261 | + pass | |
257 | 262 | prj.Project().RemoveMeasurement(index) |
258 | - Publisher.sendMessage(('Remove actors ' + str(m.location)), | |
259 | - (actors, m.slice_number)) | |
263 | + if m.location == const.SURFACE: | |
264 | + Publisher.sendMessage(('Remove actors ' + str(m.location)), | |
265 | + (mr.GetActors(), m.slice_number)) | |
260 | 266 | Publisher.sendMessage('Update slice viewer') |
261 | 267 | Publisher.sendMessage('Render volume viewer') |
262 | 268 | |
... | ... | @@ -275,7 +281,7 @@ class MeasurementManager(object): |
275 | 281 | |
276 | 282 | def _rm_incomplete_measurements(self, pubsub_evt): |
277 | 283 | if self.current is None: |
278 | - return | |
284 | + return | |
279 | 285 | |
280 | 286 | mr = self.current[1] |
281 | 287 | print "RM INC M", self.current, mr.IsComplete() | ... | ... |
invesalius/data/styles.py
... | ... | @@ -389,7 +389,7 @@ class LinearMeasureInteractorStyle(DefaultInteractorStyle): |
389 | 389 | Publisher.sendMessage("Add measurement point", |
390 | 390 | ((x, y,z), const.LINEAR, |
391 | 391 | ORIENTATIONS[self.orientation], |
392 | - slice_number, self.radius, renderer)) | |
392 | + slice_number, self.radius)) | |
393 | 393 | Publisher.sendMessage('Reload actual slice %s' % self.orientation) |
394 | 394 | |
395 | 395 | def OnReleaseMeasurePoint(self, obj, evt): | ... | ... |
invesalius/data/viewer_slice.py
... | ... | @@ -1189,6 +1189,7 @@ class Viewer(wx.Panel): |
1189 | 1189 | self.slice_data.renderer.RemoveActor(actor) |
1190 | 1190 | |
1191 | 1191 | for (m, mr) in self.measures.get(self.orientation, index): |
1192 | + mr.renderer = self.slice_data.renderer | |
1192 | 1193 | for actor in mr.GetActors(): |
1193 | 1194 | self.slice_data.renderer.AddActor(actor) |
1194 | 1195 | ... | ... |