22#include <Inventor/fields/SoFields.h>
23#include <Inventor/nodes/SoSubNode.h>
24#include <Inventor/nodes/SoShape.h>
25#include <Inventor/sensors/SoTimerSensor.h>
26#include <Inventor/sensors/SoAlarmSensor.h>
27#include <Inventor/sensors/SoFieldSensor.h>
28#include <Inventor/sensors/SoNodeSensor.h>
29#include <Inventor/nodes/SoSubNode.h>
30#include <Inventor/elements/SoCacheElement.h>
44 template <
typename T>
class LUTData;
365 { _sliceInitFunc =
fn; _sliceInitUser =
user; }
View2DLutPrecision
allows to set the precision of the LUT
#define SOVIEW2D_API
File to resolve system dependencies in View2D library.
int(* SliceInitFunc)(const SoView2D *view2D, SoSFMLImage *image, void *user)
Callback function type for external specification of initial slice position.
SoInteractionHandler is a mix-in class for instances of SoNode to handle the interactions it provides...
SoInteractionOwner is a mix-in class for instances of SoNode that should have interaction objects.
SoInteractionProvider is an abstract interface class that provides interactions to the SoInteractionC...
The SoSFMLImage field is the interface used by Inventor Nodes to access image data (in the current im...
SoView2D is a 2D viewer for image data.
View2DLut * _lutData
the currently allocated lut data
SoSFTrigger renderingDone
output field is triggered from the inside when all rendering is done.
void updateViewingCenterAndPlane()
update viewing center from sliceOrigin and sliceNumber
SoSFVec2f sliceOrigin
the internal origin of the slice in voxels (for shifting inside of the view)
SbBool isMouseButtonPressed(int i)
returns if given mousebutton (0-2) is currently pressed this is handles by the View2D,...
SoAction * _action
pointer to current action
SliceInitFunc getSliceInitFunc(void)
Get slice position initialization callback.
SoSFEnum blendMode
blend mode for rendering
void stopCineMode()
stop the cine mode
SoSFBool clipBackgroundToImage
clip background to image rect
SoSFBool deletingEnabled
enable/disable delete-events for SoView2D-Extensions
SoSFFloat minSliceZoomKeyboard
minimum slice zoom for keyboard modifications (always clamped by MIN_MIN_SLICE_ZOOM and 1....
ml::LUTFunction * getLutFromScene(SoAction *action)
get the lut from the scene (default ramp if no lut is set)
View2DSliceList * getSliceList()
returns the slicelist that is used to manage the slices
SoSFVec2f upperRight
restrict the rendering to a subpart of the viewer, in normalized coordinated
void minSliceZoomKeyboardCB(SoField *)
callback for minimum slice zoom modification that performs clamping to value range
SoSFBool passHandledFlagToInventor
Set this true if following inventor nodes should not react to events that have been handled by a SoVi...
SoFieldSensor * _viewingCenterSensor
sensor for start slice
SoSFFloat cineSpeed
speed of cine mode (in seconds), minimum cine speed is fixed to one repaint per image
SbVec2f getSliceSize()
get slice size x/y in millimeters (used by SoOrthoView2D)
SoSFBool handle3DEvents
handle events when rendering in 3D
SoSFEnum lutPrecision
defines the precision of the LUT
SoSFEnum cineMode
mode of the Cinemode (Z,T,ZT)
SoSFString viewerId
id string, needs to be unique in a network if used
SoSFBool cineModeActive
read-only flag indicating whether cine mode is active or not
SoSFInt32 numSlices
number of slices that are rendered
SoSFInt32 cineCenterT
center of timepoint cine
SoSFInt32 sliceStep
step to next rendered slice
bool _mouseOverViewer
remember if the mouse cursor is over the viewer area
SoSFTrigger startCine
Cinemode fields.
void updateLayoutAndDraw(int originX, int originY, int width, int height, bool updateLayoutOnly, SoNodeList *primitives=nullptr, int sharedCacheContext=-1, bool is3D=false, bool reverse=false)
update layout and draw in 2D or 3D
SoSFInt32 userIndex
the user index the viewers is currently showing
void viewingCenterChanged()
sets slice origins of all viewers according to current viewing center if synchronizePanning is on
void editObjectsAction()
switch extensions to edit mode
void generatePrimitives(SoAction *action) override
used for 3D picking
SoSFBool handle2DEvents
handle events when rendering in 2D
static View2DFont * globalFont()
get the global font used for annotations etc.
bool checkValid()
checks if image, start slice, timepoint, and user index are valid
int getMaxStartSlice()
returns the highest sensible value for startSlice
SoSFInt32 cineCenterZ
center of z cine
ml::LUTFunction * getDefaultLut()
get the default lut object (just a relative ramp from 0 to 1)
SoSFInt32 timePoint
the timepoint the viewers is currently showing
SoSFPlane plane
plane representing the slice in world coordinates
SoSFFloat sliceZoom
the internal zoom of the slice (for zooming inside if the view)
void updateViewingCenterAndPlaneCB(SoField *)
callback which forwards to updateViewingCenterAndPlane()
SoSFString frameOfReferenceUID
the DICOM frameOfReferenceUID of the image currently displayed.
void handleEvent(SoHandleEventAction *action) override
handle the mouse and keyboard events and send them to extensions
int getCurrentCenterSlice()
returns the central of all currently visible slices (e.g. startSlice, if numSlices is 1)
SoSFFloat zoomModeParameter
zoom mode parameter, depends on zoomMode what its value means
void sliceUnzoomAction(void)
Reset slice zoom and translation.
bool _dragging
remember if we are during a drag operation
SoSFBool enableZBuffer
use Z buffer in 3D rendering
SoSFVec2f lowerLeft
restrict the rendering to a subpart of the viewer, in normalized coordinated
SoSFBool applyLut
select if the View2d should apply the scene LUT to the slice data (default is true)
void updateSliceListOnImageChange()
update the slice list if the image has changed
void updateKeyboardActionEnabledStateCB(SoField *)
update enabled state of the keyboard actions
SoSFBool standardKeysNumbers
enable number keys 0-9, depends on standardKeys being enabled
SoSFVec2f spacing
spacing between slices
SoSFEnum cineRepeat
flag to indicated if loop or ping-pong is used
void handleScheduledActions(const SoNodeList *primitives)
handle the actions given by deleteSelectedObject and editObjects
SoSFBool enableZWrite
write Z buffer in 3D rendering
SoFieldSensor * _startSliceSensor
sensor for start slice
SoSFBool enableViewingCenter
If enabled, the viewing center is activated for reading and writing.
SoSFInt32 cineIntervalT
interval of timepoint cine
void startCineModeCB(SoField *)
callback that calls startCineMode();
void adjustSliceOriginToCenter(float newSliceZoom)
sets the new sliceZoom value and adjusts the sliceOrigin to zoom to the center of the ROI
bool _editObjectsScheduled
flag if edit mode on extensions should be activated
void objRef() override
Overriding SoInteractionProvider methods:
void * _sliceInitUser
user data for _sliceInitFunc
double _currentLUTImageMax
SoSFInt32 maxUserIndex
the maximum user index, read from the image, used to restrict userIndex
void imageChangedCB(SoField *)
callback that calls imageChanged();
void getLutFromScene(SoAction *action, View2DLut *data)
render the lut into the given lut data object
void updateSliceRepresentingPlane(const SbVec3f &worldCenter)
SoSFInt32 slab
the slab that is rendered (1=only one slice)
static std::string getDICOMTagValue(SoSFMLImage *image, const std::string &dicomTagName)
Returns the value of a DICOM tag with the given name as a string, or an empty string if the tag was n...
std::string getID() const override
Returns the id string for identifying the provider (and its actions)
SoFieldSensor * _sliceOriginSensor
sensor for slice origin
void stopCineModeCB(SoField *)
callback that calls stopCineMode();
View2DSliceList * _sliceList
the internal slice list which stores and handles rendered slices
SoSFFloat devicePixelSize
size of a pixel in mm when rendering in 3D
SoInteractionHandler * _interactionHandler
Delegate that handles events for the new interaction scheme.
void deleteSelectedObjectCB(SoField *)
callback that calls deleteSelectedObjectAction();
SoSFEnum sliceAlignY
align the image inside of the slice if there is space left, default is VIEW2D_ALIGN_CENTER
void deleteSelectedObjectAction()
delete the selected object
bool _deleteSelectedObjectScheduled
flag if delete of object on extension should be activated
void translateInnerSlice(float x, float y)
translates the inner slice x/y pixel on the screen
SoSFInt32 maxSlice
the maximum slice number, read from the image, used to restrict startSlice
SoSFString instanceName
Fields.
void editObjectsCB(SoField *)
callback that calls deleteSelectedObjectAction();
bool isDeviceCoordInViewerArea(float dx, float dy, const SbVec2s &viewportSize) const
Returns if the event of the given action is located over the viewer area for a given viewportSize The...
SoSFInt32 numXSlices
number of slices that are rendered in X
SoAction * getAction()
get pointer to current action.
SoSFBool reverseExtensionDrawingOrder
Reverse drawing order of extensions.
SoSFString seriesInstanceUID
the DICOM seriesInstanceUID of the image currently displayed
SoSFBool cineFullRangeZ
flag if the full z range or the z interval is used
void sliceUnzoomCB(SoField *)
callback that calls sliceUnzoomAction();
SoSFString interactionProviderID
This field overrides the instanceName as providerID if specified.
SoSFBool invertKeyPanningDirections
invert panning by keyboard
unsigned int _imageSerialNumber
last serial number of image
int setStartSlice(int slice, bool keepInView=false, bool noCB=false)
set start slice, but obey possible restrictions (returns effective value) if keepInView is set,...
void updateKeyboardActionEnabledState()
void sliceZoomChangedCB(SoField *)
callback which forwards to sliceToomChanged
SoSFBool drawImageData
if set to false, only the extensions of the SoView2D are drawn, not the images
MLDataType _currentLUTImageDataType
current LUT settings
SoSFVec3f viewingCenter
world position of the current center of the viewer
SliceInitFunc _sliceInitFunc
external slice initialization callback
static View2DFont * globalFont(int)
DEPRECATED: cache context id is no longer needed.
void keepSlicesInViewCB(SoField *)
if keepSlicesInView is activated, set startSlice to a permitted value
SoSFBool useManagedInteraction
prefer to use managed interaction instead of classical event handling if a SoView2DExtension provides...
SoSFFloat overrideAspectRatioValue
user defined aspect ratio, is only used if overrideAspectRatio is set to true
void enableViewingCenterChangedCB(SoField *)
enable / disable viewing center usage.
SoSFBool cineFullRangeT
flag if the full time range or the time interval is used
SoSFBool overrideAspectRatio
set if the aspect ratio should be overwritten by user aspect ratio
SoSFVec2f margin
margin to the border of the viewer
SoSFColor baseColor
base color in which the slices are drawn
SoSFMLImage image
input ML image
SoSFTrigger edit
set the extensions into edit mode
SoFieldSensor * _sliceZoomSynchronizedSensor
void forceImageUpdateChangedCB(SoField *field=nullptr)
void computeBBox(SoAction *action, SbBox3f &box, SbVec3f ¢er) override
when rendering in 3D, calculate the bounding box of the drawn slice(s)
SoSFEnum zoomMode
zoom mode that defines mapping to the viewer area
void getStatusString(SbString &string)
access status string
SoSFInt32 cineIntervalZ
interval of z cine
SoSFFloat backgroundAlphaFactor
background alpha factor (0=background invisible)
SoSFEnum cineDirection
direction of Cinemode
void viewingCenterChangedCB(SoField *)
callback which forwards to viewingCenterChanged()
void setSliceInitFunc(SliceInitFunc fn, void *user)
Set slice position initialization callback The callback function set by this method is called when th...
SoSFBool standardKeys
enable the keypad and 0-9 keys
bool handleKeyboardEvent(int nKey, bool shift, bool alt, bool ctrl)
handle standard key, returns true if handles
void sliceZoomSynchronizedChanged()
updates the sliceZoom and corrects the slice origin, so that the viewing center of the slice remains ...
SoSFString status
status of current extension
SoSFBool wrapAroundTimePointScrolling
wrap-around timepoint scrolling
SoSFBool keepSlicesInView
if this is set, the slices are prevented from leaving the visible area.
bool updateLutData(ml::LUTFunction *lut, View2DLut *data, SoSFMLImage *img, View2DLutPrecision precision)
renders the lut data from the lut function according to the image data (lut may be NULL,...
void cineParametersChangedCB(SoField *)
callback that calls updateCineParameters()
SoInteractionProvider * _interactionProvider
Delegate that provides the interaction objects from the SoView2DExtensions.
SoSFEnum filterMode
filter mode for rendering
SbVec2f getSingleSliceSize(int windowX, int windowY)
get the size of a single slice in the window area (this can be used to align annotation font size acr...
SoSFBool cineAlwaysReset
Always reset to start slice/time point and forward direction on start press (start with current posit...
SoSFFloat alphaFactor
alpha factor for rendering
SoSFInt32 maxTimePoint
the maximum timepoint, read from the image, used to restrict timePoint
void updateHighColorDepthFlag()
Checks if the current GL context has a bigger bit depth than 8 per channel and if so upgrades the fla...
void imageChanged()
React on image changed.
static void initClass()
inventor runtime type system
SoSFFloat sliceZoomSynchronized
same as sliceZoom, except that changes to this member update the slice origin so that the viewing cen...
void rayPick(SoRayPickAction *action) override
implements 3D picking
double _currentLUTImageMin
void updateLayout(int viewportX, int viewportY, int viewportWidth, int viewportHeight, bool is3D=false)
Update layout for given viewport size.
SoSFTrigger deleteSelected
Interaction fields for extensions.
int _currentLUTImageNumChannels
bool _allowHighColorDepthUpgrade
SoSFTrigger unzoom
sets sliceOrigin to (0,0) and sliceZoom to 1.0
void layoutSlices(int wx, int wy)
layout slices inside of the window area
SoSFEnum sliceAlignX
align the image inside of the slice if there is space left, default is VIEW2D_ALIGN_CENTER
SoSFBool useShaders
if enabled, the SoView2D tries to emulate a hardware lut by using hardware shaders,...
SoSFBool snapToCenter
if set, the viewer snaps to center of image on each input image change
bool getEventLocation(SoHandleEventAction *action, bool &hit, float &dx, float &dy, SbVec3f &voxelHit, int &sliceID)
get event location of the event contained in action, returns if the image is hit, the device location...
SoSFBool standardKeysNeedValidPosition
set if the keys work anywhere or only if pressed with mouse inside of a slice (needed for SoOrthoView...
SoSFBool invertKeySlicingDirection
invert slicing by keyboard
SoSFTrigger stopCine
stop the cine mode
SoSFTrigger forceImageUpdate
Forces an immediate update of all fields that depend on the input image.
void GLRender(SoGLRenderAction *action) override
reimplemented Inventor method which renders the slices
void startCineMode()
start the cine mode
~SoView2D() override
destructor
SoSFColor backgroundColor
fill slice background with given color
SoSFBool unzoomOnImageChange
If enabled, the module unzooms automatically on an input image change.
void sliceZoomSynchronizedChangedCB(SoField *)
callback which forwards to sliceZoomSynchronizedChanged
void sliceZoomChanged()
updates the member sliceZoomSynchronized
static SoInteractionProvider * getInteractionProvider(SoNode *node)
static method to register with SoInteractionProvider for this class
SoSFVec2f zoomCenter
center of zoom/scale operation in normalized coordinates
void updateCineParameters()
updates the cine parameters to the current field values
SoSFEnum cacheMode
caching of slices
static ml::LUTFunction * _localLut
an internal lut which is used if there is no lut in the scene
SbString getViewerId() const
returns the viewer id of this viewer
SoSFInt32 startSlice
current start slice
static View2DFont & globalFontRef()
Always return an existing font singleton as from globalFont(); used for annotations etc.
Abstract GL font drawing using FTGL.
View2DInteractionHandler is derived from SoInteractionHandler mainly to provide additional SoView2D i...
The View2DInteractionProvider extracts the interactions from the SoView2DExtensions.
A small wrapper class for the LUT data.
a list that holds all View2DSlice objects (lazily created) of a SoView2D
Common base class for lookup tables.
MLint32 MLDataType
MLDataType.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.