Commit 3ee7eebec630d551cbabaf9f15e682af39529dbb

Authored by Thiago Franco de Moraes
1 parent c79f0659

Using get_voxel_clicked FloodFillMaskInteractorStyle and removed a bunch of related codes

Showing 1 changed file with 1 additions and 52 deletions   Show diff stats
invesalius/data/styles.py
@@ -1804,24 +1804,10 @@ class FloodFillMaskInteractorStyle(DefaultInteractorStyle): @@ -1804,24 +1804,10 @@ class FloodFillMaskInteractorStyle(DefaultInteractorStyle):
1804 1804
1805 viewer = self.viewer 1805 viewer = self.viewer
1806 iren = viewer.interactor 1806 iren = viewer.interactor
1807 -  
1808 mouse_x, mouse_y = iren.GetEventPosition() 1807 mouse_x, mouse_y = iren.GetEventPosition()
1809 - render = iren.FindPokedRenderer(mouse_x, mouse_y)  
1810 - slice_data = viewer.get_slice_data(render)  
1811 -  
1812 - self.picker.Pick(mouse_x, mouse_y, 0, render)  
1813 -  
1814 - coord = self.get_coordinate_cursor()  
1815 - position = slice_data.actor.GetInput().FindPoint(coord)  
1816 -  
1817 - if position != -1:  
1818 - coord = slice_data.actor.GetInput().GetPoint(position)  
1819 -  
1820 - if position < 0:  
1821 - position = viewer.calculate_matrix_position(coord) 1808 + x, y, z = self.viewer.get_voxel_clicked(mouse_x, mouse_y, self.picker)
1822 1809
1823 mask = self.viewer.slice_.current_mask.matrix[1:, 1:, 1:] 1810 mask = self.viewer.slice_.current_mask.matrix[1:, 1:, 1:]
1824 - x, y, z = self.calcultate_scroll_position(position)  
1825 if mask[z, y, x] < self.t0 or mask[z, y, x] > self.t1: 1811 if mask[z, y, x] < self.t0 or mask[z, y, x] > self.t1:
1826 return 1812 return
1827 1813
@@ -1878,43 +1864,6 @@ class FloodFillMaskInteractorStyle(DefaultInteractorStyle): @@ -1878,43 +1864,6 @@ class FloodFillMaskInteractorStyle(DefaultInteractorStyle):
1878 self.viewer.slice_.current_mask.was_edited = True 1864 self.viewer.slice_.current_mask.was_edited = True
1879 Publisher.sendMessage('Reload actual slice') 1865 Publisher.sendMessage('Reload actual slice')
1880 1866
1881 - def get_coordinate_cursor(self):  
1882 - # Find position  
1883 - x, y, z = self.picker.GetPickPosition()  
1884 - bounds = self.viewer.slice_data.actor.GetBounds()  
1885 - if bounds[0] == bounds[1]:  
1886 - x = bounds[0]  
1887 - elif bounds[2] == bounds[3]:  
1888 - y = bounds[2]  
1889 - elif bounds[4] == bounds[5]:  
1890 - z = bounds[4]  
1891 - return x, y, z  
1892 -  
1893 - def calcultate_scroll_position(self, position):  
1894 - # Based in the given coord (x, y, z), returns a list with the scroll positions for each  
1895 - # orientation, being the first position the sagital, second the coronal  
1896 - # and the last, axial.  
1897 -  
1898 - if self.orientation == 'AXIAL':  
1899 - image_width = self.slice_actor.GetInput().GetDimensions()[0]  
1900 - axial = self.slice_data.number  
1901 - coronal = position / image_width  
1902 - sagital = position % image_width  
1903 -  
1904 - elif self.orientation == 'CORONAL':  
1905 - image_width = self.slice_actor.GetInput().GetDimensions()[0]  
1906 - axial = position / image_width  
1907 - coronal = self.slice_data.number  
1908 - sagital = position % image_width  
1909 -  
1910 - elif self.orientation == 'SAGITAL':  
1911 - image_width = self.slice_actor.GetInput().GetDimensions()[1]  
1912 - axial = position / image_width  
1913 - coronal = position % image_width  
1914 - sagital = self.slice_data.number  
1915 -  
1916 - return sagital, coronal, axial  
1917 -  
1918 1867
1919 class RemoveMaskPartsInteractorStyle(FloodFillMaskInteractorStyle): 1868 class RemoveMaskPartsInteractorStyle(FloodFillMaskInteractorStyle):
1920 def __init__(self, viewer): 1869 def __init__(self, viewer):