Slicer 5.9
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
27
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
45class VTK_MRML_DISPLAYABLEMANAGER_EXPORT vtkMRMLWindowLevelWidget : public vtkMRMLAbstractWidget
46{
47public:
52
53 enum
54 {
59 };
60
62
66 void PrintSelf(ostream& os, vtkIndent indent) override;
68
73
76
78
79 vtkGetMacro(BackgroundVolumeEditable, bool);
80 vtkSetMacro(BackgroundVolumeEditable, bool);
81 vtkBooleanMacro(BackgroundVolumeEditable, bool);
82
83 vtkGetMacro(ForegroundVolumeEditable, bool);
84 vtkSetMacro(ForegroundVolumeEditable, bool);
85 vtkBooleanMacro(ForegroundVolumeEditable, bool);
86
87 void SetMRMLApplicationLogic(vtkMRMLApplicationLogic* applicationLogic) override;
88
90 bool CanProcessInteractionEvent(vtkMRMLInteractionEventData* eventData, double& distance2) override;
91
94
96 void Leave(vtkMRMLInteractionEventData* eventData) override;
97
99 enum
100 {
105 };
106
108 enum
109 {
124 };
125
126 bool UpdateWindowLevelFromRectangle(int layer, int cornerPoint1[2], int cornerPoint2[2]);
127
128 static const char* GetInteractionNodeAdjustWindowLevelModeAttributeName() { return "AdjustWindowLevelMode"; };
129
130 static const char* GetAdjustWindowLevelModeAsString(int id);
131 static int GetAdjustWindowLevelModeFromString(const char* name);
132
133protected:
136
140
143
146 // If updateWindowLevel is set to false then the operation is cancelled without changing the window/level
147 bool ProcessSetWindowLevelFromRegionEnd(vtkMRMLInteractionEventData* eventData, bool updateWindowLevel = true);
148
150
152
154
155 bool SetVolumeWindowLevel(double window, double level, bool isAutoWindowLevel);
156
158 vtkGetMacro(CenteredRubberBand, bool);
159 vtkSetMacro(CenteredRubberBand, bool);
160 vtkBooleanMacro(CenteredRubberBand, bool);
161
162 vtkWeakPointer<vtkMRMLSliceNode> SliceNode;
163 vtkWeakPointer<vtkMRMLSliceLogic> SliceLogic;
164
166
169
171
172 // Auto window/level was active before starting to adjust it
176
178
181
183
184private:
186 void operator=(const vtkMRMLWindowLevelWidget&) = delete;
187};
188
189#endif
@ WidgetStateUser
this is a starting index that can be used for widget-specific states
@ WidgetEventUser
this is a starting index that can be used for widget-specific events
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).
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()