Slicer 5.13
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkMRMLSliceIntersectionWidget.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkMRMLSliceIntersectionWidget.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or https://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
24
25#ifndef vtkMRMLSliceIntersectionWidget_h
26#define vtkMRMLSliceIntersectionWidget_h
27
28#include "vtkMRMLDisplayableManagerExport.h" // For export macro
30#include "vtkMRMLSliceLogic.h"
31#include "vtkMRMLSliceNode.h"
32
33#include <vtkCallbackCommand.h>
34#include <vtkCollection.h>
35#include <vtkSmartPointer.h>
36#include <vtkWeakPointer.h>
37
38class vtkSliceIntersectionRepresentation2D;
42
43class VTK_MRML_DISPLAYABLEMANAGER_EXPORT vtkMRMLSliceIntersectionWidget : public vtkMRMLAbstractWidget
44{
45public:
50
52
56 void PrintSelf(ostream& os, vtkIndent indent) override;
58
63
66
68
69 void SetMRMLApplicationLogic(vtkMRMLApplicationLogic* applicationLogic) override;
70
72 bool CanProcessInteractionEvent(vtkMRMLInteractionEventData* eventData, double& distance2) override;
73
76
78 void Leave(vtkMRMLInteractionEventData* eventData) override;
79
81 enum
82 {
83 // Interactions without handles
91
92 // Interactions with slice intersection handles
99
100 // Interactions with intersecting slice thick slab handles
103
105 };
106
108 enum
109 {
110 // Interactions without handles
129 WidgetEventToggleAllSlicesVisibility, // currently does not work, only toggles current slice
135 WidgetEventRotateIntersectingSlicesStart, // rotate all intersecting slices (ctrl-alt-left-click-and-drag)
142 WidgetEventSetCrosshairPositionBackground, //< set crosshair position without consuming the event (so that other widgets can process the event)
144
145 // Interactions with slice intersection handles
146 // WidgetStateOnTranslateIntersectingSlicesHandle/WidgetStateTranslateIntersectingSlicesHandle
149 // WidgetStateOnRotateIntersectingSlicesHandle/WidgetStateRotateIntersectingSlicesHandle
152 // WidgetStateOnTranslateSingleIntersectingSliceHandle/WidgetStateOnTranslateSingleIntersectingSliceHandle
155
156 // Interactions with slice thickslab handles
157 // WidgetStateOnTranslateIntersectingThickSlabHandle/WidgetStateTranslateIntersectingThickSlabHandle
160 };
161
163 enum
164 {
168 ActionRotate = 4, /* not used */
169 ActionBlend = 8, /* fg to bg, labelmap to bg */
172 ActionAdjustLightbox = 256, /* not used */
174 ActionSetCursorPosition = 1024, /* adjust cursor position in crosshair node as mouse is moved */
175 ActionSetCrosshairPosition = 2048, /* adjust cursor position in crosshair node as mouse is moved */
180 };
181
186 vtkSetMacro(TouchRotationThreshold, double);
187 vtkGetMacro(TouchRotationThreshold, double);
188 vtkSetMacro(TouchTranslationThreshold, double);
189 vtkGetMacro(TouchTranslationThreshold, double);
190 vtkSetMacro(TouchZoomThreshold, double);
191 vtkGetMacro(TouchZoomThreshold, double);
192
194 void SetActionsEnabled(int actions);
195
198
203 void SetActionEnabled(int actionsMask, bool enable = true);
206 bool GetActionEnabled(int actionsMask);
207
209
210 // Allows the widget to request a cursor shape
211 int GetMouseCursor() override;
212
213protected:
216
221
226 double GetSliceRotationAngleRad(double eventPos[2]);
227
228 // Pan (move slice in-plane) by click-and-drag
230
232
233 // Scroll (browse) slices by click-and-drag in vertical direction (only in Scroll mouse mode)
236
242
251
253
255
257 bool Rotate(double sliceRotationAngleRad);
258
262 void ScaleZoom(double zoomScaleFactor, vtkMRMLInteractionEventData* eventData);
263
265 void SetLabelOpacity(double opacity);
267
270 bool IsEventInsideVolume(bool background, vtkMRMLInteractionEventData* eventData);
271
273
274 static void SliceModifiedCallback(vtkObject* caller, unsigned long eid, void* clientData, void* callData);
275 static void SliceLogicsModifiedCallback(vtkObject* caller, unsigned long eid, void* clientData, void* callData);
276
277 vtkWeakPointer<vtkCollection> SliceLogics;
278 vtkWeakPointer<vtkMRMLSliceNode> SliceNode;
279 vtkWeakPointer<vtkMRMLSliceLogic> SliceLogic;
280 vtkNew<vtkCallbackCommand> SliceLogicsModifiedCommand;
281 vtkNew<vtkCallbackCommand> SliceModifiedCommand;
282
288
292
296
297 double StartActionFOV[3];
299
300 enum
301 {
305 };
306
307 // Blend
311
312 // Browse slice
320 void MoveSlice(double delta);
321
322 // Scroll (browse slices by click-and-drag)
325
331 void CycleVolumeLayer(int layer, int direction);
332
335
339
341
351
352 // Last intersecting slice node where interaction occurred
354
355private:
357 void operator=(const vtkMRMLSliceIntersectionWidget&) = delete;
358};
359
360#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.
MRML node to store display properties of slice nodes.
static void SliceLogicsModifiedCallback(vtkObject *caller, unsigned long eid, void *clientData, void *callData)
vtkWeakPointer< vtkMRMLSliceNode > SliceNode
void ProcessScroll(vtkMRMLInteractionEventData *eventData)
void SetMRMLApplicationLogic(vtkMRMLApplicationLogic *applicationLogic) override
void SetLabelOpacity(double opacity)
Get/Set labelmap or segmentation opacity.
vtkMRMLSliceDisplayNode * GetSliceDisplayNode()
bool ProcessMaximizeView(vtkMRMLInteractionEventData *eventData)
double GetSliceRotationAngleRad(double eventPos[2])
bool ProcessZoomSlice(vtkMRMLInteractionEventData *eventData)
bool ProcessTouchGestureEnd(vtkMRMLInteractionEventData *eventData)
void SetActionEnabled(int actionsMask, bool enable=true)
void PrintSelf(ostream &os, vtkIndent indent) override
void IncrementSlice()
Adjust the slice position with respect to current slice node offset.
bool ProcessRotateIntersectingSlicesHandle(vtkMRMLInteractionEventData *eventData)
static vtkMRMLSliceIntersectionWidget * New()
void CycleVolumeLayer(int layer, int direction)
void Leave(vtkMRMLInteractionEventData *eventData) override
Called when the the widget loses the focus.
bool ProcessTranslateIntersectingSlicesHandle(vtkMRMLInteractionEventData *eventData)
bool ProcessRotateIntersectingSlicesHandleStart(vtkMRMLInteractionEventData *eventData)
bool ProcessTouchRotate(vtkMRMLInteractionEventData *eventData)
bool ProcessWidgetMenu(vtkMRMLInteractionEventData *eventData)
vtkMRMLSegmentationDisplayNode * GetVisibleSegmentationDisplayNode()
bool ProcessTranslateIntersectingThickSlabHandle(vtkMRMLInteractionEventData *eventData)
vtkNew< vtkCallbackCommand > SliceLogicsModifiedCommand
bool ProcessTranslateSingleIntersectingSliceHandleStart(vtkMRMLInteractionEventData *eventData)
static void SliceModifiedCallback(vtkObject *caller, unsigned long eid, void *clientData, void *callData)
vtkMRMLSliceNode * GetSliceNode()
bool ProcessBlend(vtkMRMLInteractionEventData *eventData)
vtkWeakPointer< vtkCollection > SliceLogics
bool ProcessRotateIntersectingSlices(vtkMRMLInteractionEventData *eventData)
void MoveSlice(double delta)
~vtkMRMLSliceIntersectionWidget() override
vtkMRMLSegmentationDisplayNode * StartActionSegmentationDisplayNode
bool GetActionEnabled(int actionsMask)
bool ProcessTouchGestureStart(vtkMRMLInteractionEventData *eventData)
bool ProcessTouchZoom(vtkMRMLInteractionEventData *eventData)
bool IsEventInsideVolume(bool background, vtkMRMLInteractionEventData *eventData)
bool ProcessStartMouseDrag(vtkMRMLInteractionEventData *eventData)
bool ProcessTouchTranslate(vtkMRMLInteractionEventData *eventData)
bool ProcessTranslateIntersectingSlicesHandleStart(vtkMRMLInteractionEventData *eventData)
bool ProcessSetCrosshairBackground(vtkMRMLInteractionEventData *eventData)
int GetActionsEnabled()
Set full list of enabled actions.
bool ProcessEndMouseDrag(vtkMRMLInteractionEventData *eventData)
@ WidgetStateMoveCrosshair
Move crosshair position, can be used for moving the crosshair with click-and-drag.
@ WidgetStateScroll
Scroll (browse) slices using left-click-and-drag (only in Scroll mouse mode)
@ WidgetStateBlend
Fade between foreground/background volumes.
@ WidgetStateTranslateIntersectingSlicesHandle
translating all intersecting slices by drag-and-dropping handle
@ WidgetStateOnTranslateIntersectingThickSlabHandle
hovering over a slice thick slab translation handle
@ WidgetStateTranslateIntersectingThickSlabHandle
adjusting a slice thick slab thickness by drag-and-dropping handle
@ WidgetStateRotateIntersectingSlices
Rotate all intersecting slices (ctrl+alt+left-click-and-drag)
@ WidgetStateTouchGesture
Pinch/zoom/pan using touch gestures.
@ WidgetStateTranslateSlice
Pan (translate in-plane) the current slice (using shift+left-click-and-drag or middle-click-and-drag)
@ WidgetStateOnTranslateSingleIntersectingSliceHandle
hovering over a single-slice translation interaction handle
@ WidgetStateTranslateSingleIntersectingSliceHandle
translating a single slice by drag-and-dropping handle
@ WidgetStateZoomSlice
Zoom slice (using right-button or mouse wheel)
@ WidgetStateRotateIntersectingSlicesHandle
rotating all intersecting slices by drag-and-dropping handle
@ WidgetStateOnRotateIntersectingSlicesHandle
hovering over a rotation interaction handle
@ WidgetStateOnTranslateIntersectingSlicesHandle
hovering over a slice intersection point
bool ProcessRotateIntersectingSlicesStart(vtkMRMLInteractionEventData *eventData)
vtkNew< vtkCallbackCommand > SliceModifiedCommand
bool ProcessTranslateSingleIntersectingSliceHandle(vtkMRMLInteractionEventData *eventData)
bool CanProcessInteractionEvent(vtkMRMLInteractionEventData *eventData, double &distance2) override
Return true if the widget can process the event.
bool ProcessTranslateSlice(vtkMRMLInteractionEventData *eventData)
vtkWeakPointer< vtkMRMLSliceLogic > SliceLogic
bool ProcessMouseMove(vtkMRMLInteractionEventData *eventData)
bool ProcessSetCrosshair(vtkMRMLInteractionEventData *eventData)
void ScaleZoom(double zoomScaleFactor, vtkMRMLInteractionEventData *eventData)
void SetActionsEnabled(int actions)
Set exact list of actions to enable.
bool Rotate(double sliceRotationAngleRad)
Rotate the message by the specified amount. Used for touchpad events.
bool ProcessScrollStart(vtkMRMLInteractionEventData *eventData)
void SetSliceNode(vtkMRMLSliceNode *sliceNode)
bool ProcessTranslateIntersectingThickSlabHandleStart(vtkMRMLInteractionEventData *eventData)
bool ProcessInteractionEvent(vtkMRMLInteractionEventData *eventData) override
Process interaction event.
MRML node for storing a slice through RAS space.