153 bool drawSlices(
int originX,
int originY,
int width,
int height,
bool updateLayoutOnly,
154 SoNodeList* extensions =
nullptr,
int sharedCacheContext=-1,
bool is3D =
false,
bool reverse =
false);
159 float &rx,
float &ry);
164 float &rx,
float &ry);
168 float &voxelX,
float &voxelY,
float &voxelZ);
172 double &voxelX,
double &voxelY,
double &voxelZ);
176 float &worldX,
float &worldY,
float &worldZ);
180 double &worldX,
double &worldY,
double &worldZ);
220 SbVec3f& worldHit, SbVec3f& voxelHit,
int* sliceID =
nullptr);
227 float &rx,
float &ry);
235 float &rx,
float &ry);
307 SbVec3f& worldCoord);
318 int* sliceID =
nullptr);
339 int* sliceID =
nullptr);
353 void drawSlice(
int slice,
int count,
int originX,
int originY,
int width,
int height,
354 int sharedContextId,
bool updateLayoutOnly,
bool is3D, SoNodeList* extensions);
390 float _blendColor[4];
392 bool _clipBackgroundToImage;
396 float _devicePixelMM;
397 SbVec3f _sliceNormal;
404 float _fixedInnerZoom;
405 bool _fixedInnerZoomOn;
408 int _grabSliceCounter;
409 int _grabbedLayoutIndex;
424 int _currentCacheContext;
View2DAlignYMode
slice align mode y
View2DTextureFilter
Filter mode.
@ FILTER_LINEAR
Bilinear filtering (after classification/LUT)
View2DAlignXMode
slice align mode x
View2DSliceCachingMode
Caching mode.
#define SOVIEW2D_API
File to resolve system dependencies in View2D library.
#define VIEW2D_MAX_OVERLAY_TEXTURES
number of overlay textures that can be cached
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.
View2DEvent stores all information on an event on a SoView2D.
A small wrapper class for the LUT data.
base class for hardware shaders that can be used on a View2DTexture
a list that holds all View2DSlice objects (lazily created) of a SoView2D
void mapWorldToVoxel(double worldX, double worldY, double worldZ, double &voxelX, double &voxelY, double &voxelZ)
maps the world coordinate to local voxel coordinates (double version)
void mapWorldToVoxel(const SbVec3d &worldCoord, SbVec3d &voxelCoord)
maps the world coordinate to local voxel coordinates (double version)
void setSlab(int slab)
set number of slab slices (1 means no slab, one slice)
View2DSliceCachingMode getCachingMode()
get data caching mode.
int getTimePoint()
Get the time point.
int getSlab()
get number of slab slices
SbVec3f getSliceNormal()
get normal of slices in world coordinates (all slices have the same normal) The slice normal is ortho...
View2DSlice * getSlice(int z) const
get slice with slice pos z
void setSliceAlignment(View2DAlignXMode x, View2DAlignYMode y)
set slice alignment
void getDrawOffset(float &x, float &y)
Get slice list draw offset.
void setUserIndex(int userIndex)
Set the user index.
int getStartSlice() const
Returns z index of the current start slice or -1 if not set.
void grabSlice()
Switch on or off slice grabbing, i.e.
bool is3D()
is current rendering in 3D?
void initGL()
initialize internals that require a valid GL state
View2DTextureFilter getFilter()
get filter
void mapVoxelToWorld(const SbVec3f &voxelCoord, SbVec3f &worldCoord)
maps the voxel coordinate to world coordinates (float version)
bool mapDeviceToNormalizedCoordinateSystem(int x, int y, SbVec2f &normalizedCoordinate) const
Maps the given device coordinates to normalized View2D coordinates (as used by sliceOrigin and zoomCe...
void getImageSize(int &x, int &y, int &z)
returns the image size in pixels
void getWindowSize(int &x, int &y)
get the window size that is currently rendered on
int getCurrentCacheContext()
get current cache context (-1 if none, can only be called while drawing)
void setClipBackgroundToImage(bool value)
set if background should be clipped to image rect
bool castRayOnSlides(const SbVec3f &p1, const SbVec3f &p2, const SbVec3f &viewpoint, SbVec3f &worldHit, SbVec3f &voxelHit, int *sliceID=nullptr)
Do a 3d collision with the slices, returns first hit of given line with the first slice plane from gi...
void setSliceZoom(float zoom)
Set the inner slice zoom.
void mapVoxelToWorld(float voxelX, float voxelY, float voxelZ, float &worldX, float &worldY, float &worldZ)
maps the voxel coordinate to world coordinates
View2DLut * getLut()
get lut
void getSliceSpacing(float &dx, float &dy)
Get the spacing between slices.
void setSliceRange(int start, int num, int step=1)
set the slice range.
void setCachingMode(View2DSliceCachingMode mode)
set data caching mode.
bool isSliceHit(int x, int y)
Returns if a slice's visible rect is hit at the given device coordinate, if a device rect of a slice ...
void setBlendMode(int blendMode=0, float *_blendColor=nullptr)
set blendmode
void setFilter(View2DTextureFilter filter=FILTER_LINEAR)
set filter
void setAspectRatio(float ratio)
set the aspect ratio
void cleanup()
Remove all current slice objects.
SbVec3f getWorldAxis(int a)
returns the indicated axis (0/1/2) of the slices in world space
void getSliceSize(float &sizeX, float &sizeY)
Get the size of the slice to be drawn.
void getSliceRange(int &start, int &num, int &step)
get the slice range.
float getAspectRatio()
get the aspect ratio
void set3DPixelSize(float devicePixelMM)
set the device coordinate scale when slices are rendered in 3d
void getCurrentInnerZoom(float &x, float &y)
get the inner x/y zoom
bool mapEventToWorld(View2DEvent *ec, float &worldX, float &worldY, float &worldZ)
maps the given device event to world coords and returns if a slice was hit
SoSFMLImage * getInputImage()
get the input image.
bool shouldRenderReverse(const SbVec3f &viewdir)
returns if the 3d rendering should be done in reverse order dependent on view direction (in world coo...
float * getBlendColor()
get the color for blending (4 floats)
bool mapVoxelToDevice(const SbVec3f &voxelCoord, SbVec2f &r)
same as above
bool mapVoxelToDevice(const SbVec3f &voxelCoord, float &rx, float &ry)
Determine a device pixel coordinate from the voxel coordinate in any slice.
void setSliceSpacing(float dx, float dy)
Set the spacing between slices.
bool mapDeviceToVoxel(int x, int y, SbVec3f &voxelCoord, int *sliceID=nullptr)
Maps device coordinates to local voxel coordinates, returns TRUE if successful, otherwise return FALS...
void setUseShaders(bool flag)
sets if the tries to use shaders for hardware lut
void mapWorldToVoxel(const SbVec3f &worldCoord, SbVec3f &voxelCoord)
maps the world coordinate to local voxel coordinates (float version)
SoView2D * getOwner()
Get the owning SoView2D.
bool mapEventToVoxel(View2DEvent *ec, float &vx, float &vy, float &vz)
maps the given device event to voxel coords and returns if a slice was hit
bool mapDeviceToWorld(int x, int y, SbVec3f &worldCoord)
Maps device coordinates to world coordinates, returns TRUE if successful, otherwise return FALSE.
void setInputImage(SoSFMLImage *img)
set the input image.
bool mapWorldToDevice(float worldX, float worldY, float worldZ, float &rx, float &ry)
Determine a device pixel coordinate from the world coordinate in any slice.
int getSliceAtDevicePosition(int x, int y) const
Returns z index of slice whose visible rect is hit, return -1 if no slice is hit.
View2DSliceList()
create empty list
bool mapEventToVoxel(View2DEvent *ec, SbVec3f &voxel)
maps the given device event to voxel coords and returns if a slice was hit
bool mapVoxelToDevice(float voxelX, float voxelY, float voxelZ, float &rx, float &ry)
Determine a device pixel coordinate from the voxel coordinate in any slice.
bool mapDeviceToWorld(int x, int y, float &worldX, float &worldY, float &worldZ)
Maps device coordinates to world coordinates, returns TRUE if successful, otherwise return FALSE.
void setSliceSize(float sizeX, float sizeY)
Set the size of the slice to be drawn.
bool mapWorldToDevice(const SbVec3f &worldCoord, SbVec2f &r)
same as above
View2DShader * createShader()
returns a new shader, owned by the caller.
void setDrawOffset(float x, float y)
Set slice list draw offset.
void mapVoxelToWorld(const SbVec3d &voxelCoord, SbVec3d &worldCoord)
maps the voxel coordinate to world coordinates (double version)
void setNumXSlices(int num)
set number of slices in a row.
int getNumXSlices()
get number of slices in a row.
void getSliceOrigin(float &x, float &y)
Get the inner slice origin.
bool mapWorldToDevice(const SbVec3f &worldCoord, float &rx, float &ry)
Determine a device pixel coordinate from the world coordinate in any slice.
void setSliceOrigin(float x, float y)
Set the inner slice origin.
void setBackgroundColor(float *color)
set the background color (rgba)
int getUserIndex()
Get the user index.
bool mapEventToWorld(View2DEvent *ec, SbVec3f &world)
maps the given device event to world coords and returns if a slice was hit
bool isVoxelInsideImage(float voxelX, float voxelY, float voxelZ)
Returns if the given voxel is inside the image extends.
SbVec3d getWorldAxisDouble(int a)
returns the indicated axis (0/1/2) of the slices in world space
float getSliceZoom()
Get the inner slice zoom.
~View2DSliceList()
destructor
bool drawSlices(int originX, int originY, int width, int height, bool updateLayoutOnly, SoNodeList *extensions=nullptr, int sharedCacheContext=-1, bool is3D=false, bool reverse=false)
Draw the slices (originX, originY, width and height are the current viewport position/size) Returns F...
void setOwner(SoView2D *view)
Set the owning SoView2D.
void setFixedInnerZoom(bool flag, float fixedZoom)
set the fixed innerzoom
void updateSliceList(int sharedContextId=-1, bool layoutOnly=false)
Make the slice list up to date to the current settings.
void mapWorldToVoxel(float worldX, float worldY, float worldZ, float &voxelX, float &voxelY, float &voxelZ)
maps the world coordinate to local voxel coordinates
void setTimePoint(int timepoint)
Set the time point.
int getBlendMode()
get blendmode
void setDrawsData(bool flag)
enable/disable data loading
bool mapDeviceToVoxel(int x, int y, float &voxelX, float &voxelY, float &voxelZ, int *sliceID=nullptr)
Maps device coordinates to local voxel coordinates, returns TRUE if successful, otherwise return FALS...
void mapVoxelToWorld(double voxelX, double voxelY, double voxelZ, double &worldX, double &worldY, double &worldZ)
maps the voxel coordinate to world coordinates (double version)
SbVec3f getSliceTranslation(int z)
get translation vector of the slice in world coordinates (to voxel 0,0,z+0.5)
void setLut(View2DLut *lut)
set lut
a single slice that is stored in a View2DSliceList, typically created by a View2DSliceList