70 void setBlendMode(
int blendMode = 0,
float* _blendColor =
nullptr);
304 return _currentCacheContext;
363 INVALID_LAYOUT_INDEX =
static_cast<int>(0x80000000)
390 int _lastWindowX{-1};
391 int _lastWindowY{-1};
394 float _sliceOriginX{};
395 float _sliceOriginY{};
400 float _blendColor[4]{1, 1, 1, 1};
401 float _bgColor[4]{0, 0, 0, 1};
402 bool _clipBackgroundToImage{};
404 bool _drawData{
true};
406 float _devicePixelMM{1};
414 float _fixedInnerZoom{1};
415 bool _fixedInnerZoomOn{};
416 float _aspectRatio{1};
418 int _grabSliceCounter{};
419 int _grabbedLayoutIndex{INVALID_LAYOUT_INDEX};
434 int _currentCacheContext{-1};
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
View2DSlice * getSlice(int z) const
get slice with slice pos z
View2DLut * getLut() const
get lut
void setSlab(int slab)
set number of slab slices (1 means no slab, one slice)
int getSlab() const
get number of slab slices
static View2DShader * createShader()
returns a new shader, owned by the caller.
void getSliceSpacing(float &dx, float &dy) const
Get the spacing between slices.
View2DSliceList()=default
create empty list
bool mapEventToWorld(View2DEvent *ec, float &worldX, float &worldY, float &worldZ) const
maps the given device event to world coords and returns if a slice was hit
void setSliceAlignment(View2DAlignXMode x, View2DAlignYMode y)
set slice alignment
int getNumXSlices() const
get number of slices in a row.
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.
void initGL()
initialize internals that require a valid GL state
bool mapDeviceToNormalizedCoordinateSystem(int x, int y, SbVec2f &normalizedCoordinate) const
Maps the given device coordinates to normalized View2D coordinates (as used by sliceOrigin and zoomCe...
float getSliceZoom() const
Get the inner slice zoom.
void getImageSize(int &x, int &y, int &z) const
returns the image size in pixels
bool mapWorldToDevice(const SbVec3f &worldCoord, float &rx, float &ry) const
Determine a device pixel coordinate from the world coordinate in any slice.
View2DTextureFilter getFilter() const
get filter
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...
bool mapEventToWorld(View2DEvent *ec, SbVec3f &world) const
maps the given device event to world coords and returns if a slice was hit
void setSliceZoom(float zoom)
Set the inner slice zoom.
bool mapVoxelToWorld(float voxelX, float voxelY, float voxelZ, float &worldX, float &worldY, float &worldZ) const
maps the voxel coordinate to world coordinates
void setSliceRange(int start, int num, int step=1)
set the slice range.
void setCachingMode(View2DSliceCachingMode mode)
set data caching mode.
bool mapVoxelToDevice(const SbVec3f &voxelCoord, SbVec2f &r) const
same as above
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.
View2DSliceCachingMode getCachingMode() const
get data caching mode.
SbVec3f getWorldAxis(int a)
returns the indicated axis (0/1/2) of the slices in world space
bool isSliceHit(int x, int y) const
Returns if a slice's visible rect is hit at the given device coordinate, if a device rect of a slice ...
void set3DPixelSize(float devicePixelMM)
set the device coordinate scale when slices are rendered in 3d
SoSFMLImage * getInputImage()
get the input image.
int getUserIndex() const
Get the user index.
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
bool is3D() const
is current rendering in 3D?
int getCurrentCacheContext() const
get current cache context (-1 if none, can only be called while drawing)
bool mapVoxelToWorld(const SbVec3d &voxelCoord, SbVec3d &worldCoord) const
maps the voxel coordinate to world coordinates (double version)
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.
int getBlendMode() const
get blendmode
bool mapWorldToVoxel(double worldX, double worldY, double worldZ, double &voxelX, double &voxelY, double &voxelZ) const
maps the world coordinate to local voxel coordinates (double version)
int getSliceAtDevicePosition(int x, int y) const
Returns z index of slice whose visible rect is hit, return -1 if no slice is hit.
int getTimePoint() const
Get the time point.
bool mapVoxelToWorld(double voxelX, double voxelY, double voxelZ, double &worldX, double &worldY, double &worldZ) const
maps the voxel coordinate to world coordinates (double version)
SbVec3f getSliceNormal() const
get normal of slices in world coordinates (all slices have the same normal) The slice normal is ortho...
SoView2D * getOwner() const
Get the owning SoView2D.
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.
static 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
void getWindowSize(int &x, int &y) const
get the window size that is currently rendered on
void setDrawOffset(float x, float y)
Set slice list draw offset.
SbVec3f getSliceTranslation(int z) const
get translation vector of the slice in world coordinates (to voxel 0,0,z+0.5)
bool mapWorldToVoxel(float worldX, float worldY, float worldZ, float &voxelX, float &voxelY, float &voxelZ) const
maps the world coordinate to local voxel coordinates
void setNumXSlices(int num)
set number of slices in a row.
bool isVoxelInsideImage(float voxelX, float voxelY, float voxelZ) const
Returns if the given voxel is inside the image extends.
bool mapWorldToDevice(float worldX, float worldY, float worldZ, float &rx, float &ry) const
Determine a device pixel coordinate from the world coordinate in any slice.
bool mapWorldToVoxel(const SbVec3f &worldCoord, SbVec3f &voxelCoord) const
maps the world coordinate to local voxel coordinates (float version)
void setSliceOrigin(float x, float y)
Set the inner slice origin.
void getSliceSize(float &sizeX, float &sizeY) const
Get the size of the slice to be drawn.
void setBackgroundColor(float *color)
set the background color (rgba)
bool mapWorldToDevice(const SbVec3f &worldCoord, SbVec2f &r) const
same as above
float * getBlendColor()
get the color for blending (4 floats)
void getCurrentInnerZoom(float &x, float &y) const
get the inner x/y zoom
bool mapVoxelToDevice(float voxelX, float voxelY, float voxelZ, float &rx, float &ry) const
Determine a device pixel coordinate from the voxel coordinate in any slice.
SbVec3d getWorldAxisDouble(int a)
returns the indicated axis (0/1/2) of the slices in world space
bool mapVoxelToWorld(const SbVec3f &voxelCoord, SbVec3f &worldCoord) const
maps the voxel coordinate to world coordinates (float version)
~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
static bool mapEventToVoxel(View2DEvent *ec, SbVec3f &voxel)
maps the given device event to voxel coords and returns if a slice was hit
bool mapWorldToVoxel(const SbVec3d &worldCoord, SbVec3d &voxelCoord) const
maps the world coordinate to local voxel coordinates (double version)
void updateSliceList(int sharedContextId=-1, bool layoutOnly=false)
Make the slice list up to date to the current settings.
bool shouldRenderReverse(const SbVec3f &viewdir) const
returns if the 3d rendering should be done in reverse order dependent on view direction (in world coo...
float getAspectRatio() const
get the aspect ratio
void getSliceRange(int &start, int &num, int &step) const
get the slice range.
void setTimePoint(int timepoint)
Set the time point.
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 setLut(View2DLut *lut)
set lut
void getDrawOffset(float &x, float &y) const
Get slice list draw offset.
bool mapVoxelToDevice(const SbVec3f &voxelCoord, float &rx, float &ry) const
Determine a device pixel coordinate from the voxel coordinate in any slice.
void getSliceOrigin(float &x, float &y) const
Get the inner slice origin.
a single slice that is stored in a View2DSliceList, typically created by a View2DSliceList
Target mlrange_cast(Source arg)
Generic version of checked ML casts.