MeVisLab Toolbox Reference
View2DPosition.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 
16 
17 #pragma once
18 
19 #include <Inventor/SbLinear.h>
20 
21 #include "SoView2DSystem.h"
22 #include "SoSFMLImage.h"
23 
24 class SoView2D;
25 class View2DSliceList;
26 
30 {
31 public:
33  View2DPosition(SoView2D* viewer = nullptr);
35 
38  SbVec2f getDevicePosition() const { return _relPos; }
39 
41  SbVec3f getVoxelPosition() const { return _voxelPos; }
42 
44  SbVec2f getViewportOrigin() const { return _vpOrigin; }
46  SbVec2f getViewportSize() const { return _vpSize; }
47 
50 
52  SoView2D* getViewer() const { return _viewer; }
53 
56 
58  void mapVoxelToWorld (const SbVec3f &src, SbVec3f &dst) const { getImage().mapVoxelToWorld (src, dst); }
59 
61  void mapWorldToVoxel (const SbVec3f &src, SbVec3f &dst) const { getImage().mapWorldToVoxel (src, dst); }
62 
64  bool isInsideImage() const;
65 
67  bool isInsideViewport() const;
68 
69  SbVec3f getWorldPosition() const;
70 
71 protected:
72  // change methods are implemented in MutableView2DPosition in SoView2D.cpp
73  SbVec2f _relPos;
74  SbVec3f _voxelPos;
75  SbVec2f _vpOrigin;
76  SbVec2f _vpSize;
77 private:
78  SoView2D* _viewer;
79 };
#define SOVIEW2D_API
File to resolve system dependencies in View2D library.
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
This class stores all position information needed by SoView2DExtensions to handle the pointer positio...
void mapVoxelToWorld(const SbVec3f &src, SbVec3f &dst) const
map from Voxel to World coordinate (convenience method)
SbVec3f getWorldPosition() const
View2DSliceList * getSliceList() const
pointer to slice list
bool isInsideViewport() const
Return whether the voxel position is inside the visible viewport.
SbVec3f getVoxelPosition() const
Return voxel position of pointer.
SbVec2f getDevicePosition() const
Return View2D device position of pointer (Note that this is corrected to the current GL viewport and ...
SoView2D * getViewer() const
Return pointer to SoView2D.
SoSFMLImage & getImage() const
Return reference to image field of SoView2D.
bool isInsideImage() const
Return whether the voxel position is inside the image extents.
void mapWorldToVoxel(const SbVec3f &src, SbVec3f &dst) const
map from World to Voxel coordinate (convenience method)
SbVec2f getViewportOrigin() const
Return view port origin of current slice in voxel coordinates.
SbVec2f getViewportSize() const
Return view port size of current slice in voxel coordinates.
View2DPosition(SoView2D *viewer=nullptr)
Constructor and destructor.
a list that holds all View2DSlice objects (lazily created) of a SoView2D