Commit dfd1d8a20628a38afa7aeaba3ba4fd89356fc8dc
1 parent
92f1f1a7
Exists in
watershed_improvements_bkp
Removed set operation from watershed style
Showing
1 changed file
with
7 additions
and
9 deletions
Show diff stats
invesalius/data/styles.py
| ... | ... | @@ -789,8 +789,6 @@ class WaterShedInteractorStyle(DefaultInteractorStyle): |
| 789 | 789 | self.orientation = self.viewer.orientation |
| 790 | 790 | self.matrix = None |
| 791 | 791 | |
| 792 | - self.operation = BRUSH_FOREGROUND | |
| 793 | - | |
| 794 | 792 | self.config = WatershedConfig() |
| 795 | 793 | |
| 796 | 794 | self.picker = vtk.vtkWorldPointPicker() |
| ... | ... | @@ -808,7 +806,6 @@ class WaterShedInteractorStyle(DefaultInteractorStyle): |
| 808 | 806 | self.AddObserver("MouseMoveEvent", self.OnBrushMove) |
| 809 | 807 | |
| 810 | 808 | Publisher.subscribe(self.expand_watershed, 'Expand watershed to 3D ' + self.orientation) |
| 811 | - Publisher.subscribe(self.set_operation, 'Set watershed operation') | |
| 812 | 809 | Publisher.subscribe(self.set_bsize, 'Set watershed brush size') |
| 813 | 810 | Publisher.subscribe(self.set_bformat, 'Set watershed brush format') |
| 814 | 811 | |
| ... | ... | @@ -825,7 +822,6 @@ class WaterShedInteractorStyle(DefaultInteractorStyle): |
| 825 | 822 | Publisher.unsubscribe(self.expand_watershed, 'Expand watershed to 3D ' + self.orientation) |
| 826 | 823 | Publisher.unsubscribe(self.set_bformat, 'Set watershed brush format') |
| 827 | 824 | Publisher.unsubscribe(self.set_bsize, 'Set watershed brush size') |
| 828 | - Publisher.unsubscribe(self.set_operation, 'Set watershed operation') | |
| 829 | 825 | self.RemoveAllObservers() |
| 830 | 826 | self.viewer.slice_.to_show_aux = '' |
| 831 | 827 | self.viewer.OnScrollBar() |
| ... | ... | @@ -863,9 +859,6 @@ class WaterShedInteractorStyle(DefaultInteractorStyle): |
| 863 | 859 | self.viewer.slice_data.SetCursor(cursor) |
| 864 | 860 | self.viewer.interactor.Render() |
| 865 | 861 | |
| 866 | - def set_operation(self, pubsub_evt): | |
| 867 | - self.operation = WATERSHED_OPERATIONS[pubsub_evt.data] | |
| 868 | - | |
| 869 | 862 | def set_bsize(self, pubsub_evt): |
| 870 | 863 | size = pubsub_evt.data |
| 871 | 864 | self.config.cursor_size = size |
| ... | ... | @@ -1078,10 +1071,12 @@ class WaterShedInteractorStyle(DefaultInteractorStyle): |
| 1078 | 1071 | tmp_image = ndimage.morphological_gradient( |
| 1079 | 1072 | get_LUT_value(image, ww, wl).astype('uint16'), |
| 1080 | 1073 | self.config.mg_size) |
| 1074 | + #tmp_image = get_LUT_value(image, ww, wl).astype('uint16') | |
| 1081 | 1075 | |
| 1082 | 1076 | tmp_mask = w_algorithm(tmp_image, markers.astype('int16'), bstruct) |
| 1083 | 1077 | else: |
| 1084 | - tmp_image = ndimage.morphological_gradient(image, self.config.mg_size) | |
| 1078 | + tmp_image = ndimage.morphological_gradient((image - image.min()).astype('uint16'), self.config.mg_size) | |
| 1079 | + #tmp_image = (image - image.min()).astype('uint16') | |
| 1085 | 1080 | tmp_mask = w_algorithm(tmp_image, markers.astype('int16'), bstruct) |
| 1086 | 1081 | |
| 1087 | 1082 | if self.viewer.overwrite_mask: |
| ... | ... | @@ -1190,13 +1185,16 @@ class WaterShedInteractorStyle(DefaultInteractorStyle): |
| 1190 | 1185 | if BRUSH_BACKGROUND in markers and BRUSH_FOREGROUND in markers: |
| 1191 | 1186 | w_algorithm = WALGORITHM[self.config.algorithm] |
| 1192 | 1187 | bstruct = generate_binary_structure(3, CON3D[self.config.con_3d]) |
| 1188 | + print bstruct | |
| 1193 | 1189 | if self.config.use_ww_wl: |
| 1194 | 1190 | tmp_image = ndimage.morphological_gradient( |
| 1195 | 1191 | get_LUT_value(image, ww, wl).astype('uint16'), |
| 1196 | 1192 | self.config.mg_size) |
| 1193 | + #tmp_image = get_LUT_value(image, ww, wl).astype('uint16') | |
| 1197 | 1194 | tmp_mask = w_algorithm(tmp_image, markers.astype('int16'), bstruct) |
| 1198 | 1195 | else: |
| 1199 | - tmp_image = ndimage.morphological_gradient(image, self.config.mg_size) | |
| 1196 | + tmp_image = ndimage.morphological_gradient((image - image.min()).astype('uint16'), self.config.mg_size) | |
| 1197 | + #tmp_image = (image - image.min()).astype('uint16') | |
| 1200 | 1198 | tmp_mask = w_algorithm(tmp_image, markers.astype('int16'), bstruct) |
| 1201 | 1199 | |
| 1202 | 1200 | if self.viewer.overwrite_mask: | ... | ... |