31template <
typename T>
class LUTData;
36#define VIEW2D_MAX_OVERLAY_TEXTURES 32
291 float _blendColor[4]{1, 1, 1, 1};
292 float _bgColor[4]{0, 0, 0, 1};
295 float _sliceOriginX{};
296 float _sliceOriginY{};
298 float _fixedInnerZoom{1};
299 bool _fixedInnerZoomOn{};
317 float _vxFlt{}, _vyFlt{}, _vzFlt{};
318 double _vxDbl{}, _vyDbl{}, _vzDbl{};
322 float _aspectRatio{1};
325 bool _drawData{
true};
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
@ NO_SLICE_ID
define a number as meaning "no slice selected"
The SoSFMLImage field is the interface used by Inventor Nodes to access image data (in the current im...
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
a single slice that is stored in a View2DSliceList, typically created by a View2DSliceList
static void enableBlending(int blendMode)
enable the given blend mode in GL state.
void setDrawSize(float sx, float sy)
set the slice size for drawing
int getLutSize()
get size of lut
void drawTexture(View2DTexture *texture, float vp1[3], float vp2[3], float vp3[3], int blendMode, float *blendColor, View2DTextureFilter filter)
draw a View2DTexture in specified device coordinates (may be 3D coordinates also)
float getInnerZoom() const
get the inner zoom
void drawTexture(View2DTexture *texture, int blendMode, float *blendColor)
draw a View2DTexture (used for Slice drawing and for overlays also)
void setLut(View2DLut *lut)
set the lut
SoSFMLImage * getInputImage()
get the input image.
int getUserIndex() const
get the user index
void drawTexture(View2DTexture *texture, float vp1[3], float vp2[3], float vp3[3], int blendMode, float *blendColor)
draw a View2DTexture in specified device coordinates (may be 3D coordinates also)
void setBackgroundColor(float *color)
set the background color (rgba)
void mapVoxelToDevice(float voxelX, float voxelY, float voxelZ, float &rx, float &ry) const
maps the local voxel coordinate to a device pixel coordinate which may be used in OpenGL (for drawing...
void setInputImage(SoSFMLImage *img)
set the input image.
bool select(float x, float y, float &voxelX, float &voxelY, float &voxelZ) const
Determine whether the slice can be selected, returned position is in voxel coordinates (typically thi...
View2DSlice()=default
constructor
void drawTexture(View2DTexture *texture, int blendMode)
draw a View2DTexture (used for Slice drawing and for overlays also)
void mapVoxelToDevice(const SbVec3f &voxelCoord, SbVec2f &r) const
same as above
View2DShader * getShader() const
get the main shader (might be NULL);
void getDrawPosition(float &x, float &y) const
get the slice position for drawing
void setAspectRatio(float ratio)
set the aspect ratio
void getImageDeviceRect(float &dx1, float &dy1, float &dx2, float &dy2) const
Returns the device rect for the base image.
void getSliceOrigin(float &x, float &y) const
get the inner slice origin
void setDraw3D(bool flag, float devicePixelSize=1)
enable drawing in 3d
bool select(float x, float y, SbVec3f &voxel) const
same as above
void destroy()
destroy the slice textures
bool select(const SbVec2f &d, SbVec3f &voxel) const
same as above
void setSliceAlignment(View2DAlignXMode x, View2DAlignYMode y)
set the alignment of the slice
void drawBackground(bool clipBackgroundToImage=false)
draw background of the slice
void setDrawPosition(float x, float y)
set the slice position for drawing
bool mapWorldToDevice(const SbVec3f &worldCoord, SbVec2f &r) const
same as above
void setFilter(View2DTextureFilter filter=FILTER_LINEAR)
set the filter
void mapDeviceToNormalizedCoordinateSystem(int x, int y, SbVec2f &normalizedCoordinate) const
Maps the given device coordinates to normalized View2D coordinates (as used by sliceOrigin and zoomCe...
void getVoxelSize(float &vx, float &vy, float &vz) const
return voxel size
bool mapWorldToDevice(float worldX, float worldY, float worldZ, float &rx, float &ry) const
maps the world coordinate to a device pixel coordinate which may be used in OpenGL (for drawing on th...
void getVisibleDeviceRect(float &dx1, float &dy1, float &dx2, float &dy2) const
returns the visible device rect of the slice (the region the sliceOrigin and sliceZoom shows of the s...
bool containsVoxel(const SbVec3f &voxelPos) const
returns if the slice contains the given voxel pos
void drawSliceIn3D(View2DSliceList *dsl, bool extensionsOnly, SoNodeList *extensions, bool reverseDrawingOrder)
void setShaders(View2DShader *shader, View2DShader **overlayShaders)
sets the shader that should be used for rendering
void setSliceZoom(float zoom)
set the inner slice zoom
int getTimePoint() const
get the time point
void setSliceOrigin(float x, float y)
set the inner slice origin
void drawSlice(View2DSliceList *dsl, int originX, int originY, int width, int height, SoNodeList *extensions, bool extensionsOnly, bool isSlabRendering)
draw the slice (originX, originY, width and height are the current viewport position/size)
void getDrawSize(float &sx, float &sy) const
get the slice size for drawing
void setSliceZ(int z)
set the slice z position.
SbMatrix getWorldToDeviceMatrix() const
Returns the world to device matrix.
void setFixedInnerZoom(bool flag, float fixedZoom)
set the fixed inner zoom
float millimeterToPixel(float lengthMillimeter) const
calculates the pixel offset (in device coordinates) that corresponds to a certain distance (in mm,...
void getVoxelSize(double &vx, double &vy, double &vz) const
return voxel size in doubles
bool mapWorldToDevice(const SbVec3f &worldCoord, float &rx, float &ry) const
same as above
void setDrawsData(bool flag)
enable/disable data loading
bool isValidVoxel(const SbVec3f &voxel) const
same as above
void drawTexture(View2DTexture *texture, int blendMode, float *blendColor, View2DTextureFilter filter)
draw a View2DTexture (used for Slice drawing and for overlays also)
void mapVoxelToDevice(const SbVec3f &voxelCoord, float &rx, float &ry) const
same as above
View2DTextureFilter getFilter() const
get the filter
int getSliceZ() const
get the slice z position.
void setBlendMode(int blendMode, float *blendColor=nullptr)
set blend mode
bool isSliceHit(float x, float y) const
Returns if slice is hit at the given device coordinate if the visible device rect of a slice was hit ...
float getSliceZoom() const
get the inner slice zoom
void setTimePoint(int timepoint)
set the time point
~View2DSlice()
destructor.
void setCachingMode(View2DSliceCachingMode mode)
set data caching mode.
View2DSliceCachingMode getCachingMode() const
get data caching mode.
void invalidate()
Invalidate the current slice data.
void updateLayout()
update internal layout
float getAspectRatio() const
get the aspect ratio
bool isValidVoxel(float voxelX, float voxelY, float voxelZ) const
Returns if the given voxel coordinate is inside the image (z is currently ignored)
void setUserIndex(int useIndex)
set the user index
View2DTexture * getOverlayTexture(void *user=nullptr, int id=0)
get the overlay texture (is only created on first call and cached afterwards)
bool is3D() const
check if current rendering is in 3d
A class to render images as OpenGL Textures.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.