Commit 6fdc80c1f63c7b10fe9acb844bece8e072ac7162
1 parent
c5ede16c
Exists in
master
and in
6 other branches
ENH: Edited mask to load project
Showing
2 changed files
with
12 additions
and
9 deletions
Show diff stats
invesalius/data/mask.py
... | ... | @@ -72,11 +72,10 @@ class Mask(): |
72 | 72 | edited_points = {} |
73 | 73 | for p in mask[key]: |
74 | 74 | k = [float(i) for i in p.replace('(', '').replace(')', '').split(',')] |
75 | - print k | |
76 | 75 | edited_points[tuple(k)] = mask[key][p] |
76 | + | |
77 | 77 | setattr(self, key, edited_points) |
78 | 78 | else: |
79 | 79 | setattr(self, key, mask[key]) |
80 | - print "edited points", self.edited_points | |
81 | 80 | |
82 | 81 | ... | ... |
invesalius/data/slice_.py
... | ... | @@ -333,7 +333,6 @@ class Slice(object): |
333 | 333 | else: |
334 | 334 | self.__load_masks(imagedata, mask_dict) |
335 | 335 | imagedata_mask = self.img_colours_mask.GetOutput() |
336 | - | |
337 | 336 | |
338 | 337 | |
339 | 338 | mask_opacity = self.current_mask.opacity |
... | ... | @@ -526,8 +525,6 @@ class Slice(object): |
526 | 525 | ps.Publisher().sendMessage('Change mask selected', mask.index) |
527 | 526 | ps.Publisher().sendMessage('Update slice viewer') |
528 | 527 | |
529 | - | |
530 | - | |
531 | 528 | def __build_mask(self, imagedata, create=True): |
532 | 529 | # create new mask instance and insert it into project |
533 | 530 | if create: |
... | ... | @@ -551,16 +548,23 @@ class Slice(object): |
551 | 548 | lut_mask.SetRampToLinear() |
552 | 549 | lut_mask.Build() |
553 | 550 | self.lut_mask = lut_mask |
554 | - | |
555 | - # threshold pipeline | |
551 | + | |
556 | 552 | mask_thresh_imagedata = self.__create_mask_threshold(imagedata) |
557 | - current_mask.imagedata.DeepCopy(mask_thresh_imagedata) | |
558 | - | |
553 | + | |
554 | + if create: | |
555 | + # threshold pipeline | |
556 | + current_mask.imagedata.DeepCopy(mask_thresh_imagedata) | |
557 | + else: | |
558 | + mask_thresh_imagedata = vtk.vtkImageData() | |
559 | + mask_thresh_imagedata.DeepCopy(self.current_mask.imagedata) | |
560 | + | |
559 | 561 | # map the input image through a lookup table |
560 | 562 | img_colours_mask = vtk.vtkImageMapToColors() |
561 | 563 | img_colours_mask.SetOutputFormatToRGBA() |
562 | 564 | img_colours_mask.SetLookupTable(lut_mask) |
565 | + | |
563 | 566 | img_colours_mask.SetInput(mask_thresh_imagedata) |
567 | + | |
564 | 568 | self.img_colours_mask = img_colours_mask |
565 | 569 | |
566 | 570 | return img_colours_mask.GetOutput() | ... | ... |