MeVisLab Toolbox Reference
SoOrthoView2DBase.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 
15 
16 #pragma once
17 
18 #include "SoView2DSystem.h"
19 #include "mlAPI.h"
20 
21 #include <Inventor/fields/SoSFBool.h>
22 #include <Inventor/fields/SoSFInt32.h>
23 #include <Inventor/fields/SoSFEnum.h>
24 #include <Inventor/fields/SoSFTrigger.h>
25 #include <Inventor/fields/SoSFFloat.h>
26 #include <Inventor/fields/SoSFVec3f.h>
27 #include <Inventor/fields/SoSFVec2f.h>
28 #include <Inventor/fields/SoSFColor.h>
29 #include <Inventor/fields/SoSFString.h>
30 #include <Inventor/fields/SoSFPlane.h>
31 #include <Inventor/nodes/SoSeparator.h>
32 #include <Inventor/nodes/SoSwitch.h>
33 #include <Inventor/nodes/SoSubNode.h>
34 #include <Inventor/SbViewportRegion.h>
35 #include <Inventor/sensors/SoFieldSensor.h>
36 
37 #include "SoSFMLConnector.h"
38 
39 class SoView2D;
40 class SoSFMLImage;
41 
42 //=============================================================
45 
49 //=============================================================
50 class SOVIEW2D_API SoOrthoView2DBase : public SoSeparator
51 {
52  SO_NODE_HEADER(SoOrthoView2DBase);
53 
54 public:
56 
58  SoSFBool drawImageData;
59 
61  SoSFString viewerId1;
63  SoSFString viewerId2;
65  SoSFString viewerId3;
66 
68  SoSFEnum blendMode;
70  SoSFEnum filterMode;
72  SoSFEnum cacheMode;
74  SoSFInt32 slab;
75 
77  SoSFEnum layoutMode;
79  SoSFVec3f worldPosition;
81  SoSFBool worldPosSticky;
82 
84  SoSFBool snapToCenter;
86  SoSFFloat sliceZoom;
87 
89  SoSFVec2f sliceOrigin1;
90 
92  SoSFVec2f sliceOrigin2;
93 
95  SoSFVec2f sliceOrigin3;
96 
99 
103 
109  SoSFVec3f viewingCenter;
110 
112  SoSFVec3f viewingCenter1;
113 
115  SoSFVec3f viewingCenter2;
116 
118  SoSFVec3f viewingCenter3;
119 
122 
124  SoSFTrigger unzoom;
125 
127  SoSFBool synchronizeZoom;
128 
130  SoSFFloat alphaFactor;
132  SoSFColor baseColor;
133 
135  SoSFBool extraViewSpace;
141  SoSFVec2f extraViewSize;
142 
144  SoSFInt32 timePoint;
146  SoSFInt32 maxTimePoint;
147 
149  SoSFVec2f margin;
150 
153 
155  SoSFTrigger deleteSelected;
157  SoSFTrigger edit;
158 
159 
162 
164  SoSFEnum zoomMode;
165 
167  SoSFFloat zoomModeParameter;
168 
171 
173  SoSFInt32 sliceStep1;
175  SoSFInt32 sliceStep2;
177  SoSFInt32 sliceStep3;
179  SoSFInt32 numSlices1;
181  SoSFInt32 numSlices2;
183  SoSFInt32 numSlices3;
185  SoSFInt32 numXSlices1;
187  SoSFInt32 numXSlices2;
189  SoSFInt32 numXSlices3;
190 
191 
193  SoSFPlane plane1;
195  SoSFPlane plane2;
197  SoSFPlane plane3;
198 
201 
203 
205  SoSFTrigger startCine;
207  SoSFTrigger stopCine;
209  SoSFInt32 cineCenterT;
211  SoSFInt32 cineIntervalT;
213  SoSFEnum cineDirection;
215  SoSFEnum cineRepeat;
217  SoSFFloat cineSpeed;
219  SoSFBool cineFullRangeT;
222  SoSFBool cineAlwaysReset;
223 
224 
226 
228  SoSFString status;
229 
231  SoSFString seriesInstanceUID;
232 
234 
236  static void initClass();
237 
238 protected:
239 
242 
243  ~SoOrthoView2DBase() override;
244 
247  virtual mlField* getMLImageField(int /*viewerIndex*/) { return nullptr; }
248 
251  virtual bool isViewerVisible(int viewerIndex) const;
252 
254  void positionChangedCB(SoField*);
257 
259  void sliceChangedCB(SoField*);
261  void sliceChanged(SoField* field);
262 
264  void sliceZoomChangedCB(SoField*);
266  void sliceZoomChanged1CB(SoField*);
268  void sliceZoomChanged2CB(SoField*);
270  void sliceZoomChanged3CB(SoField*);
272  void sliceZoomChanged(int which);
273 
275  void sliceOriginChanged1CB(SoField*);
277  void sliceOriginChanged2CB(SoField*);
279  void sliceOriginChanged3CB(SoField*);
280 
282  void resetPanning();
286  void viewingCenterChangedCB(SoField*);
288  void viewingCenterChanged1CB(SoField*);
290  void viewingCenterChanged2CB(SoField*);
292  void viewingCenterChanged3CB(SoField*);
294  void viewingCenterChanged(int which);
295 
297  void setSliceViewingCenterFor(int which, const SbVec3f& center);
298 
299 
301  void maxTimePointChangedCB(SoField*);
304 
306  void timeChangedCB(SoField*);
308  void timeChanged();
309 
311  void marginChangedCB(SoField*);
314 
316  void zoomModeChangedCB(SoField*);
323 
325  void plane1ChangedCB(SoField*);
329  void plane2ChangedCB(SoField*);
333  void plane3ChangedCB(SoField*);
336 
338  void filterMode1ChangedCB(SoField*);
342  void filterMode2ChangedCB(SoField*);
346  void filterMode3ChangedCB(SoField*);
349 
351  void startCineModeCB(SoField*);
355  void stopCineModeCB(SoField*);
357  void stopCineMode();
358 
363 
365  static int sliceInitCB(const SoView2D *view2D, SoSFMLImage *image, void *user);
367  int sliceInit(const SoView2D *view2D, SoSFMLImage *image);
368 
370  void updateLayoutCB(SoField*);
372  void updateLayout();
373 
376 
379 
381  SoSwitch* _switch1;
382 
384  SoView2D* _view[3];
385 
388 
390  int _timePoint[3];
391 
394 
396  SoFieldSensor* _posSensor;
397  SoFieldSensor* _sliceSensor1;
398  SoFieldSensor* _sliceSensor2;
399  SoFieldSensor* _sliceSensor3;
400 
401  SoFieldSensor* _zoomSensor;
402  SoFieldSensor* _zoomSensor1;
403  SoFieldSensor* _zoomSensor2;
404  SoFieldSensor* _zoomSensor3;
405 
406  SoFieldSensor* _viewingCenterSensor;
407 
411 };
#define SOVIEW2D_API
File to resolve system dependencies in View2D library.
SoOrthoView2DBase uses three SoView2D nodes to create a 3D ortho viewer with three 2D views.
SoSFEnum cacheMode
caching of slices
SoSFTrigger startCine
Cinemode fields, relayed from view2d. However, only timePoint-cine makes sense.
SoSFInt32 numXSlices3
number of slices that are rendered in X for 3rd viewer
SoSFFloat cineSpeed
speed of cine mode (in seconds), minimum cine speed is fixed to one repaint per image
SoSFBool useManagedInteraction
prefer to use managed interaction instead of classical event handling if a SoView2DExtension provides...
virtual mlField * getMLImageField(int)
return ML image field for viewer with given viewerIndex (0,1, or 2).
SoSFPlane plane3
plane representing the slice in world coordinates of 3rd viewer
SoSFString status
status of extensions (object editing)
void marginChanged()
handle margin change
SoSFVec3f viewingCenter3
world position of the current center of the viewer3
SoSFTrigger stopCine
stop the cine mode
SoSFEnum cineRepeat
flag to indicated if loop or ping-pong is used
SoSFEnum zoomMode
zoom mode that defines mapping to the viewer area
SoSFInt32 numSlices2
number of slices that are rendered for 2nd viewer
SoSFInt32 timePoint
timepoint that is rendered
SoSFVec2f extraViewSize
normalized 2d size of the requested extra space. (Only used in LAYOUT_CUBE_CUSTOMIZED mode)
SoSFVec2f sliceOrigin3
the internal origin of the slice in voxels (for shifting inside of the 3rd view)
void setSliceViewingCenterFor(int which, const SbVec3f &center)
set viewing center for viewer which to center
void updateTimePoints()
update time points from SoView2Ds to SoOrthoView
SoSFFloat minSliceZoomKeyboard
minimum slice zoom for keyboard modifications
void sliceOriginChanged1CB(SoField *)
callback which updates external field
SoFieldSensor * _viewingCenterSensor
SoSFVec3f worldPosition
current world position
SoSFInt32 numXSlices2
number of slices that are rendered in X for 2nd viewer
SoSFBool cineFullRangeT
flag if the full time range or the time interval is used
SoFieldSensor * _sliceSensor1
void filterMode1Changed()
handle filterMode1 change
void sliceChanged(SoField *field)
handle changed slice in one of the SoView2Ds
SoSFTrigger edit
trigger the edit mode in a SoView2DExtension
SoSFPlane plane1
plane representing the slice in world coordinates of 1st viewer
void startCineModeCB(SoField *)
callback that calls startCineMode();
SoSFString seriesInstanceUID
the DICOM seriesInstanceUID of the image currently displayed
SoSFVec2f sliceOrigin1
the internal origin of the slice in voxels (for shifting inside of the 1st view)
SoSFPlane plane2
plane representing the slice in world coordinates of 2nd viewer
void filterMode2ChangedCB(SoField *)
callback which forwards to filterMode2Changed()
void viewingCenterChanged2CB(SoField *)
callback which forwards to viewingCenterChanged()
SoSFString viewerId1
id string for 1st viewer, should be unique in a network
SoFieldSensor * _zoomSensor1
void stopCineModeCB(SoField *)
callback that calls stopCineMode();
SoSFInt32 numSlices1
number of slices that are rendered for 1st viewer
void synchronizePanningChangedCB(SoField *)
callback which reacts on synchronizePanning state change
void timeChanged()
handle timepoint change of one of the SoView2Ds
SoSFEnum layoutMode
layout of the 3 views
SoSFBool cineAlwaysReset
Always reset to start time point and forward direction on start press (start with current time point ...
SoSFVec3f viewingCenter1
world position of the current center of the viewer1
SoOrthoView2DBase()
constructor, protected since this class is abstract.
SoSFVec3f viewingCenter
Common center position (in world CO) of the viewers.
SoFieldSensor * _zoomSensor3
SoSFBool invertKeyPanningDirections
invert panning by keyboard
void plane1Changed()
handle plane1 change
void sliceZoomChanged1CB(SoField *)
callback which forwards to sliceZoomChanged()
void sliceZoomChanged3CB(SoField *)
callback which forwards to sliceZoomChanged()
SoSFEnum blendMode
blend mode used for slice rendering
void viewingCenterChanged1CB(SoField *)
callback which forwards to viewingCenterChanged()
SoSFTrigger deleteSelected
trigger the deletion of the selected object in a SoView2DExtension
void filterMode3Changed()
handle filterMode3 change
void filterMode2Changed()
handle filterMode2 change
SoSFTrigger unzoom
unzoom
SoSFVec2f sliceOrigin2
the internal origin of the slice in voxels (for shifting inside of the 2nd view)
void plane3ChangedCB(SoField *)
callback which forwards to plane3Changed()
SoFieldSensor * _zoomSensor
SoSFBool worldPosSticky
set if world position should no change when input image changes
void maxTimePointChanged()
find max time point in all view2ds and assign to maxTimePoint
void sliceChangedCB(SoField *)
callback which forwards to sliceChanged()
void updateLayout()
update layout depending on the layoutMode
SoSFInt32 cineCenterT
center of timepoint cine
SoSFBool synchronizeZoom
set if the zooms of the views are synchronized
void viewingCenterChangedCB(SoField *)
callback which forwards to viewingCenterChanged()
void marginChangedCB(SoField *)
callback which forwards to marginChanged()
SoSFInt32 sliceStep1
step to next rendered slice for 1st viewer
SoSFVec3f viewingCenter2
world position of the current center of the viewer2
void sliceZoomChangedCB(SoField *)
callback which forwards to sliceZoomChanged()
SoSFEnum filterMode
filter mode used for slice rendering
SoSFString viewerId2
id string for 2nd viewer, should be unique in a network
void maxTimePointChangedCB(SoField *)
callback which forwards to maxTimePointChanged()
SoSFInt32 numSlices3
number of slices that are rendered for 3rd viewer
SoSFInt32 slab
slab of slices that are rendered
void connectFieldsTo(SoView2D *view)
update internal connections on layout change
SoSFBool keepSlicesInView
if this is set, the slices are prevented from leaving the visible area.
void zoomModeChanged()
handle zoomMode change
SoFieldSensor * _zoomSensor2
SoSFInt32 numXSlices1
number of slices that are rendered in X for 1st viewer
SoSFColor baseColor
base color for drawing
SoSFInt32 sliceStep2
step to next rendered slice for 2nd viewer
~SoOrthoView2DBase() override
void positionChanged()
handle changed worldPosition field
void startCineMode()
Find a valid master viewer and enable time cine mode.
SoSFFloat zoomModeParameter
zoom mode parameter, depends on zoomMode what its value means
void plane2ChangedCB(SoField *)
callback which forwards to plane2Changed()
void positionChangedCB(SoField *)
callback which forwards to postionChanged()
SoSFVec2f extraViewUpperRight
normalized 2d coordinates of the space, with 0,0 being lower/left
int sliceInit(const SoView2D *view2D, SoSFMLImage *image)
initialize the slices and worldPosition on image change (called from SoView2D)
SoView2D * _lastConnectedView
remember last view for connectFieldsTo()
SoSFVec2f margin
margin to the border of the internal viewers
SoFieldSensor * _sliceSensor3
static void initClass()
inventor runtime type system
void sliceOriginChanged3CB(SoField *)
callback which updates external field
void stopCineMode()
stop the cine mode
void plane3Changed()
handle plane3 change
void filterMode3ChangedCB(SoField *)
callback which forwards to filterMode3Changed()
void viewingCenterChanged(int which)
handle a changed slice origin of one of the SoView2Ds, or the common field (which = -1)
virtual bool isViewerVisible(int viewerIndex) const
returns true if the viewer with index viewerIndex (in 0..2) is visible in the current layout
SoFieldSensor * _posSensor
Field sensors.
void timeChangedCB(SoField *)
callback which forwards to timeChanged()
SoSFBool drawImageData
Fields.
SoSFFloat alphaFactor
alpha factor for drawing
void sliceZoomChanged2CB(SoField *)
callback which forwards to sliceZoomChanged()
void resetPanning()
resets panning
bool _inhibitViewingCenterSync
to temporarily inhibit syncing of viewing centers:
SoSFFloat sliceZoom
the internal slice zoom
SoFieldSensor * _sliceSensor2
int _cineMaster
master view2d index for cine mode. -1 if not running.
void seriesInstanceUIDChanged()
stop the cine mode
SoSFBool extraViewSpace
flag if extra space is available (depends on layout)
static int sliceInitCB(const SoView2D *view2D, SoSFMLImage *image, void *user)
callback which forwards to sliceInit()
SoSFInt32 maxTimePoint
maximum available timepoint
void updateLayoutCB(SoField *)
callback which forwards to updateLayout()
SoSFInt32 sliceStep3
step to next rendered slice for 3rd viewer
SoSFBool synchronizeFilterMode
Enable/Disable synchronizing of filterMode (used for slice rendering) between all viewers.
void zoomModeChangedCB(SoField *)
callback which forwards to zoomModeChanged()
void plane1ChangedCB(SoField *)
callback which forwards to plane1Changed()
SoSFEnum cineDirection
direction of Cinemode
SoSFVec2f extraViewLowerLeft
normalized 2d coordinates of the space, with 0,0 being lower/left
SoSFString viewerId3
id string for 3rd viewer, should be unique in a network
void filterMode1ChangedCB(SoField *)
callback which forwards to filterMode1Changed()
SoSwitch * _switch1
switch which contain the rendered scene
void zoomModeParameterChangedCB(SoField *)
callback which forwards to zoomModeParameterChanged()
void sliceOriginChanged2CB(SoField *)
callback which updates external field
void zoomModeParameterChanged()
handle zoomModeParameter change
SoSFBool snapToCenter
snap to center of image when image changes
SoSFBool synchronizePanning
Synchronizes panning so that all viewers are consistent with viewingCenter.
void plane2Changed()
handle plane2 change
SoSFBool alternCubeLayout
flag if the upper left quarter should be used by a viewer in the cube modi
void sliceZoomChanged(int which)
handle a changed slice zoom of one of the SoView2Ds
void viewingCenterChanged3CB(SoField *)
callback which forwards to viewingCenterChanged()
SoSFInt32 cineIntervalT
interval of timepoint cine
void seriesInstanceUIDChangedCB(SoField *)
callback that calls seriesInstanceUIDChanged();
The SoSFMLImage field is the interface used by Inventor Nodes to access image data (in the current im...
Definition: SoSFMLImage.h:70
SoView2D is a 2D viewer for image data.
Definition: SoView2D.h:62
#define mlField
A macro name for a void pointer to a field in the ML to make pointer more readable.
Definition: mlAPI.h:54