31 template <
typename T>
class LUTData;
36#define VIEW2D_MAX_OVERLAY_TEXTURES 32
167 int blendMode,
float* blendColor);
224 float &
rx,
float &
ry);
228 float &
rx,
float &
ry);
240 float &
rx,
float &
ry);
244 float &
rx,
float &
ry);
273 void* getImageSlice(
int slice);
293 float _blendColor[4];
300 float _fixedInnerZoom;
301 bool _fixedInnerZoomOn;
319 float _vxFlt,_vyFlt,_vzFlt;
320 double _vxDbl,_vyDbl,_vzDbl;
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)
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.
float getAspectRatio()
get the aspect ratio
bool select(const SbVec2f &d, SbVec3f &voxel)
same as above
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 mapWorldToDevice(const SbVec3f &worldCoord, float &rx, float &ry)
same as above
void setInputImage(SoSFMLImage *img)
set the input image.
void drawTexture(View2DTexture *texture, int blendMode)
draw a View2DTexture (used for Slice drawing and for overlays also)
void getDrawPosition(float &x, float &y)
get the slice position for drawing
int getUserIndex()
get the user index
void invalidateView()
Sets a flag that the current state of the instance does not correspond to the data on the display.
float millimeterToPixel(float lengthMillimeter)
calculates the pixel offset (in device coordinates) that corresponds to a certain distance (in mm,...
void mapVoxelToDevice(float voxelX, float voxelY, float voxelZ, float &rx, float &ry)
maps the local voxel coordinate to a device pixel coordinate which may be used in OpenGL (for drawing...
bool containsVoxel(const SbVec3f &voxelPos)
returns if the slice contains the given voxel pos
int getSliceZ()
get the slice z position.
void getImageDeviceRect(float &dx1, float &dy1, float &dx2, float &dy2)
Returns the device rect for the base image.
void setAspectRatio(float ratio)
set the aspect ratio
void getVoxelSize(double &vx, double &vy, double &vz)
return voxel size in doubles
void setDraw3D(bool flag, float devicePixelSize=1)
enable drawing in 3d
void destroy()
destroy the slice textures
void mapVoxelToDevice(const SbVec3f &voxelCoord, float &rx, float &ry)
same as above
void setSliceAlignment(View2DAlignXMode x, View2DAlignYMode y)
set the alignment of the slice
bool select(float x, float y, float &voxelX, float &voxelY, float &voxelZ)
Determine whether the slice can be selected, returned position is in voxel coordinates (typically thi...
void drawBackground(bool clipBackgroundToImage=false)
draw background of the slice
void mapWorldToDevice(const SbVec3f &worldCoord, SbVec2f &r)
same as above
void setDrawPosition(float x, float y)
set the slice position for drawing
void mapVoxelToDevice(const SbVec3f &voxelCoord, SbVec2f &r)
same as above
bool isValidVoxel(const SbVec3f &voxel)
same as above
void getDrawSize(float &sx, float &sy)
get the slice size for drawing
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 getSliceOrigin(float &x, float &y)
get the inner slice origin
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
View2DSliceCachingMode getCachingMode()
get data caching mode.
bool select(float x, float y, SbVec3f &voxel)
same as above
void setSliceOrigin(float x, float y)
set the inner slice origin
float getSliceZoom()
get the inner slice zoom
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 getVisibleDeviceRect(float &dx1, float &dy1, float &dx2, float &dy2)
returns the visible device rect of the slice (the region the sliceOrigin and sliceZoom shows of the s...
void setSliceZ(int z)
set the slice z position.
void setFixedInnerZoom(bool flag, float fixedZoom)
set the fixed innerzoom
void setDrawsData(bool flag)
enable/disable data loading
float getInnerZoom()
get the inner zoom
void drawTexture(View2DTexture *texture, int blendMode, float *blendColor, View2DTextureFilter filter)
draw a View2DTexture (used for Slice drawing and for overlays also)
bool isValidVoxel(float voxelX, float voxelY, float voxelZ)
Returns if the given voxel coordinate is inside the image (z is currently ignored)
View2DShader * getShader()
get the main shader (might be NULL);
bool is3D()
check if current rendering is in 3d
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 ...
void getVoxelSize(float &vx, float &vy, float &vz)
return voxel size
void setTimePoint(int timepoint)
set the time point
~View2DSlice()
destructor.
void setCachingMode(View2DSliceCachingMode mode)
set data caching mode.
void invalidate()
Invalidate the current slice data.
int getTimePoint()
get the time point
void updateLayout()
update internal layout
SbMatrix getWorldToDeviceMatrix()
Returns the world to device matrix.
View2DTextureFilter getFilter()
get the filter
void mapWorldToDevice(float worldX, float worldY, float worldZ, float &rx, float &ry)
maps the world coordinate to a device pixel coordinate which may be used in OpenGL (for drawing on th...
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)
A class to render images as OpenGL Textures.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.