Commit c944ccf56d8a8462219089dd6251c62c8e807eab
1 parent
7c2bd0b8
Exists in
master
Using get_LUT_value from imagedata_utils in styles.py
Showing
1 changed file
with
1 additions
and
20 deletions
Show diff stats
invesalius/data/styles.py
... | ... | @@ -45,6 +45,7 @@ import invesalius.utils as utils |
45 | 45 | from invesalius.data.measures import (CircleDensityMeasure, MeasureData, |
46 | 46 | PolygonDensityMeasure) |
47 | 47 | |
48 | +from invesalius.data.imagedata_utils import get_LUT_value, get_LUT_value_255 | |
48 | 49 | from invesalius_cy import floodfill |
49 | 50 | |
50 | 51 | # For tracts |
... | ... | @@ -69,26 +70,6 @@ WATERSHED_OPERATIONS = {_("Erase"): BRUSH_ERASE, |
69 | 70 | _("Foreground"): BRUSH_FOREGROUND, |
70 | 71 | _("Background"): BRUSH_BACKGROUND,} |
71 | 72 | |
72 | -def get_LUT_value(data, window, level): | |
73 | - shape = data.shape | |
74 | - data_ = data.ravel() | |
75 | - data = np.piecewise(data_, | |
76 | - [data_ <= (level - 0.5 - (window-1)/2), | |
77 | - data_ > (level - 0.5 + (window-1)/2)], | |
78 | - [0, window, lambda data_: ((data_ - (level - 0.5))/(window-1) + 0.5)*(window)]) | |
79 | - data.shape = shape | |
80 | - return data | |
81 | - | |
82 | -def get_LUT_value_255(data, window, level): | |
83 | - shape = data.shape | |
84 | - data_ = data.ravel() | |
85 | - data = np.piecewise(data_, | |
86 | - [data_ <= (level - 0.5 - (window-1)/2), | |
87 | - data_ > (level - 0.5 + (window-1)/2)], | |
88 | - [0, 255, lambda data_: ((data_ - (level - 0.5))/(window-1) + 0.5)*(255)]) | |
89 | - data.shape = shape | |
90 | - return data | |
91 | - | |
92 | 73 | |
93 | 74 | class BaseImageInteractorStyle(vtk.vtkInteractorStyleImage): |
94 | 75 | def __init__(self, viewer): | ... | ... |