Commit 1a0428b5f90769ab36c65bc9364149dad8f90929
1 parent
eb6cd6be
Exists in
master
and in
6 other branches
FIX: Open inv3 project and load masks
Showing
2 changed files
with
5 additions
and
34 deletions
Show diff stats
invesalius/data/imagedata_utils.py
... | ... | @@ -172,12 +172,7 @@ def Import(filename): |
172 | 172 | reader.WholeSlicesOn() |
173 | 173 | reader.Update() |
174 | 174 | |
175 | - cast = vtk.vtkImageCast() | |
176 | - cast.SetInput(reader.GetOutput()) | |
177 | - cast.SetOutputScalarType(11) | |
178 | - cast.Update() | |
179 | - | |
180 | - return cast.GetOutput() | |
175 | + return reader.GetOutput() | |
181 | 176 | |
182 | 177 | def View(imagedata): |
183 | 178 | viewer = vtk.vtkImageViewer() | ... | ... |
invesalius/data/slice_.py
... | ... | @@ -313,13 +313,6 @@ class Slice(object): |
313 | 313 | ps.Publisher().sendMessage('Create surface', |
314 | 314 | (imagedata,colour,threshold, edited_points)) |
315 | 315 | |
316 | - | |
317 | - | |
318 | - | |
319 | - | |
320 | - | |
321 | - | |
322 | - | |
323 | 316 | def GetOutput(self): |
324 | 317 | return self.cross.GetOutput() |
325 | 318 | |
... | ... | @@ -334,8 +327,8 @@ class Slice(object): |
334 | 327 | if not mask_dict: |
335 | 328 | imagedata_mask = self.__build_mask(imagedata, create=True) |
336 | 329 | else: |
337 | - self.__load_masks(mask_dict) | |
338 | - imagedata_mask = self.current_mask.imagedata | |
330 | + self.__load_masks(imagedata, mask_dict) | |
331 | + imagedata_mask = self.img_colours_mask.GetOutput() | |
339 | 332 | |
340 | 333 | |
341 | 334 | |
... | ... | @@ -350,17 +343,7 @@ class Slice(object): |
350 | 343 | else: |
351 | 344 | blend_filter.SetOpacity(1, 0) |
352 | 345 | blend_filter.SetInput(0, imagedata_bg) |
353 | - | |
354 | - #cast = vtk.vtkImageCast() | |
355 | - ##cast.SetInput(imagedata_mask) | |
356 | - #cast.SetOutputScalarType(3) | |
357 | - #cast.Update() | |
358 | - print 1 | |
359 | - #blend_filter.SetInput(1, cast.GetOutput()) | |
360 | 346 | blend_filter.SetInput(1, imagedata_mask) |
361 | - print "******", imagedata_mask.GetScalarType() #11 | |
362 | - print "******", imagedata_bg.GetScalarType() #11 | |
363 | - print 2 | |
364 | 347 | blend_filter.SetBlendModeToNormal() |
365 | 348 | blend_filter.GetOutput().ReleaseDataFlagOn() |
366 | 349 | self.blend_filter = blend_filter |
... | ... | @@ -384,13 +367,6 @@ class Slice(object): |
384 | 367 | |
385 | 368 | self.window_level = vtk.vtkImageMapToWindowLevelColors() |
386 | 369 | self.window_level.SetInput(self.imagedata) |
387 | - #cast = vtk.vtkImageCast() | |
388 | - #cast.SetInput(cross.GetOutput()) | |
389 | - #cast.GetOutput().SetUpdateExtentToWholeExtent() | |
390 | - #cast.SetOutputScalarTypeToUnsignedChar() | |
391 | - #cast.Update() | |
392 | - | |
393 | - #self.cast_filter = cast | |
394 | 370 | |
395 | 371 | |
396 | 372 | def UpdateCursorPosition(self, pubsub_evt): |
... | ... | @@ -525,7 +501,7 @@ class Slice(object): |
525 | 501 | ps.Publisher().sendMessage('Update slice viewer') |
526 | 502 | |
527 | 503 | |
528 | - def __load_masks(self, mask_dict): | |
504 | + def __load_masks(self, imagedata, mask_dict): | |
529 | 505 | keys = mask_dict.keys() |
530 | 506 | keys.sort() |
531 | 507 | for key in keys: |
... | ... | @@ -539,7 +515,7 @@ class Slice(object): |
539 | 515 | mask.colour)) |
540 | 516 | |
541 | 517 | self.current_mask = mask |
542 | - self.__build_mask(mask.imagedata, False) | |
518 | + self.__build_mask(imagedata, False) | |
543 | 519 | |
544 | 520 | ps.Publisher().sendMessage('Change mask selected', mask.index) |
545 | 521 | ps.Publisher().sendMessage('Update slice viewer') | ... | ... |