Slicer 5.4
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkMRMLWindowLevelWidget.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Program: 3D Slicer
4
5 Copyright (c) Kitware Inc.
6
7 See COPYRIGHT.txt
8 or http://www.slicer.org/copyright/copyright.txt for details.
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16==============================================================================*/
17
28#ifndef vtkMRMLWindowLevelWidget_h
29#define vtkMRMLWindowLevelWidget_h
30
31#include "vtkMRMLDisplayableManagerExport.h" // For export macro
33#include "vtkMRMLSliceLogic.h"
34#include "vtkMRMLSliceNode.h"
35
36#include <vtkCallbackCommand.h>
37#include <vtkCollection.h>
38#include <vtkSmartPointer.h>
39#include <vtkWeakPointer.h>
40
41class vtkSliceIntersectionRepresentation2D;
44
45
46class VTK_MRML_DISPLAYABLEMANAGER_EXPORT vtkMRMLWindowLevelWidget : public vtkMRMLAbstractWidget
47{
48public:
53
54 enum
55 {
59 Mode_Last
60 };
61
63
67 void PrintSelf(ostream& os, vtkIndent indent) override;
69
74
77
79
80 vtkGetMacro(BackgroundVolumeEditable, bool);
81 vtkSetMacro(BackgroundVolumeEditable, bool);
82 vtkBooleanMacro(BackgroundVolumeEditable, bool);
83
84 vtkGetMacro(ForegroundVolumeEditable, bool);
85 vtkSetMacro(ForegroundVolumeEditable, bool);
86 vtkBooleanMacro(ForegroundVolumeEditable, bool);
87
88 void SetMRMLApplicationLogic(vtkMRMLApplicationLogic* applicationLogic) override;
89
91 bool CanProcessInteractionEvent(vtkMRMLInteractionEventData* eventData, double &distance2) override;
92
95
97 void Leave(vtkMRMLInteractionEventData* eventData) override;
98
100 enum
101 {
102 WidgetStateAdjustWindowLevel = WidgetStateUser,
106 };
107
109 enum
110 {
111 WidgetEventResetWindowLevel = WidgetEventUser,
125 };
126
127 bool UpdateWindowLevelFromRectangle(int layer, int cornerPoint1[2], int cornerPoint2[2]);
128
129 static const char* GetInteractionNodeAdjustWindowLevelModeAttributeName() { return "AdjustWindowLevelMode"; };
130
131 static const char* GetAdjustWindowLevelModeAsString(int id);
132 static int GetAdjustWindowLevelModeFromString(const char* name);
133
134protected:
137
141
144
147 // If updateWindowLevel is set to false then the operation is cancelled without changing the window/level
148 bool ProcessSetWindowLevelFromRegionEnd(vtkMRMLInteractionEventData* eventData, bool updateWindowLevel=true);
149
151
153
155
156 bool SetVolumeWindowLevel(double window, double level, bool isAutoWindowLevel);
157
159 vtkGetMacro(CenteredRubberBand, bool);
160 vtkSetMacro(CenteredRubberBand, bool);
161 vtkBooleanMacro(CenteredRubberBand, bool);
162
163 vtkWeakPointer<vtkMRMLSliceNode> SliceNode;
164 vtkWeakPointer<vtkMRMLSliceLogic> SliceLogic;
165
167
168 int StartEventPosition[2];
169 int PreviousEventPosition[2];
170
171 double VolumeScalarRange[2];
172
173 // Auto window/level was active before starting to adjust it
175 double StartVolumeWindowLevel[2];
176 double LastVolumeWindowLevel[2];
177
179
182
184
185private:
187 void operator=(const vtkMRMLWindowLevelWidget&) = delete;
188};
189
190#endif
Process interaction events to update state of MRML widget nodes.
MRML node for representing segmentation display attributes.
Slicer logic class for slice manipulation.
MRML node for storing a slice through RAS space.
MRML node for representing a volume (image stack).
Show slice intersection lines.
void SetSliceNode(vtkMRMLSliceNode *sliceNode)
void ProcessSetWindowLevelFromRegion(vtkMRMLInteractionEventData *eventData)
bool ProcessSetWindowLevelFromRegionStart(vtkMRMLInteractionEventData *eventData)
bool ProcessEndMouseDrag(vtkMRMLInteractionEventData *eventData)
bool ProcessResetWindowLevel(vtkMRMLInteractionEventData *eventData)
~vtkMRMLWindowLevelWidget() override
void SetMRMLApplicationLogic(vtkMRMLApplicationLogic *applicationLogic) override
static const char * GetInteractionNodeAdjustWindowLevelModeAttributeName()
void Leave(vtkMRMLInteractionEventData *eventData) override
Called when the the widget loses the focus.
void ProcessAdjustWindowLevel(vtkMRMLInteractionEventData *eventData)
bool CanProcessInteractionEvent(vtkMRMLInteractionEventData *eventData, double &distance2) override
Return true if the widget can process the event.
void PrintSelf(ostream &os, vtkIndent indent) override
bool ProcessInteractionEvent(vtkMRMLInteractionEventData *eventData) override
Process interaction event.
bool ProcessStartMouseDrag(vtkMRMLInteractionEventData *eventData)
bool ProcessAdjustWindowLevelStart(vtkMRMLInteractionEventData *eventData)
vtkMRMLSliceNode * GetSliceNode()
bool SetVolumeWindowLevel(double window, double level, bool isAutoWindowLevel)
vtkWeakPointer< vtkMRMLSliceNode > SliceNode
vtkMRMLSliceLogic * GetSliceLogic()
static int GetAdjustWindowLevelModeFromString(const char *name)
int GetEditableLayerAtEventPosition(vtkMRMLInteractionEventData *eventData)
vtkMRMLVolumeNode * GetVolumeNodeFromSliceLayer(int editedLayer)
static const char * GetAdjustWindowLevelModeAsString(int id)
bool ProcessMouseMove(vtkMRMLInteractionEventData *eventData)
vtkWeakPointer< vtkMRMLSliceLogic > SliceLogic
bool UpdateWindowLevelFromRectangle(int layer, int cornerPoint1[2], int cornerPoint2[2])
bool ProcessSetWindowLevelFromRegionEnd(vtkMRMLInteractionEventData *eventData, bool updateWindowLevel=true)
static vtkMRMLWindowLevelWidget * New()