MeVisLab Toolbox Reference
View2DSlice Class Reference

a single slice that is stored in a View2DSliceList, typically created by a View2DSliceList More...

#include <View2DSlice.h>

Public Member Functions

 View2DSlice ()
 constructor More...
 
 ~View2DSlice ()
 destructor. More...
 
void destroy ()
 destroy the slice textures More...
 
void setInputImage (SoSFMLImage *img)
 set the input image. More...
 
SoSFMLImagegetInputImage ()
 get the input image. More...
 
void setShaders (View2DShader *shader, View2DShader **overlayShaders)
 sets the shader that should be used for rendering More...
 
View2DShadergetShader ()
 get the main shader (might be NULL); More...
 
void setSliceZ (int z)
 set the slice z position. More...
 
int getSliceZ ()
 get the slice z position. More...
 
void setDrawsData (bool flag)
 enable/disable data loading More...
 
void setAspectRatio (float ratio)
 set the aspect ratio More...
 
float getAspectRatio ()
 get the aspect ratio More...
 
void setFilter (View2DTextureFilter filter=FILTER_LINEAR)
 set the filter More...
 
View2DTextureFilter getFilter ()
 get the filter More...
 
void setSliceAlignment (View2DAlignXMode x, View2DAlignYMode y)
 set the alignment of the slice More...
 
void setFixedInnerZoom (bool flag, float fixedZoom)
 set the fixed innerzoom More...
 
void setDrawSize (float sx, float sy)
 set the slice size for drawing More...
 
void getDrawSize (float &sx, float &sy)
 get the slice size for drawing More...
 
void setDrawPosition (float x, float y)
 set the slice position for drawing More...
 
void getDrawPosition (float &x, float &y)
 get the slice position for drawing More...
 
void setSliceOrigin (float x, float y)
 set the inner slice origin More...
 
void getSliceOrigin (float &x, float &y)
 get the inner slice origin More...
 
void setSliceZoom (float zoom)
 set the inner slice zoom More...
 
float getSliceZoom ()
 get the inner slice zoom More...
 
void setCachingMode (View2DSliceCachingMode mode)
 set data caching mode. More...
 
View2DSliceCachingMode getCachingMode ()
 get data caching mode. More...
 
void getVoxelSize (float &vx, float &vy, float &vz)
 return voxel size More...
 
void getVoxelSize (double &vx, double &vy, double &vz)
 return voxel size in doubles More...
 
void updateLayout ()
 update internal layout More...
 
void setLut (View2DLut *lut)
 set the lut More...
 
void setBlendMode (int blendMode, float *blendColor=nullptr)
 set blend mode More...
 
void setBackgroundColor (float *color)
 set the background color (rgba) More...
 
void setTimePoint (int timepoint)
 set the time point More...
 
int getTimePoint ()
 get the time point More...
 
void drawBackground (bool clipBackgroundToImage=false)
 draw background of the slice More...
 
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) More...
 
void drawSliceIn3D (View2DSliceList *dsl, bool extensionsOnly, SoNodeList *extensions, bool reverseDrawingOrder)
 
void drawTexture (View2DTexture *texture, int blendMode)
 draw a View2DTexture (used for Slice drawing and for overlays also) More...
 
void drawTexture (View2DTexture *texture, int blendMode, float *blendColor)
 draw a View2DTexture (used for Slice drawing and for overlays also) More...
 
void drawTexture (View2DTexture *texture, int blendMode, float *blendColor, View2DTextureFilter filter)
 draw a View2DTexture (used for Slice drawing and for overlays also) More...
 
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) More...
 
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) More...
 
void getImageDeviceRect (float &dx1, float &dy1, float &dx2, float &dy2)
 Returns the device rect for the base image. More...
 
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 this method is only used by View2DSliceList, please use mapDeviceToVoxel or mapDeviceToWorld instead!) (this returns true if the coordinate is in the visible device rect of the slice, even if it is outside the image) More...
 
bool select (float x, float y, SbVec3f &voxel)
 same as above More...
 
bool select (const SbVec2f &d, SbVec3f &voxel)
 same as above More...
 
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 returns TRUE,. More...
 
void mapDeviceToNormalizedCoordinateSystem (int x, int y, SbVec2f &normalizedCoordinate) const
 Maps the given device coordinates to normalized View2D coordinates (as used by sliceOrigin and zoomCenter). More...
 
bool isValidVoxel (float voxelX, float voxelY, float voxelZ)
 Returns if the given voxel coordinate is inside the image (z is currently ignored) More...
 
bool isValidVoxel (const SbVec3f &voxel)
 same as above More...
 
void invalidate ()
 Invalidate the current slice data. More...
 
void invalidateView ()
 Sets a flag that the current state of the instance does not correspond to the data on the display. More...
 
float millimeterToPixel (float lengthMillimeter)
 calculates the pixel offset (in device coordinates) that corresponds to a certain distance (in mm, in world coordinates). More...
 
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 on the slice), Voxel z is currently ignored! More...
 
void mapVoxelToDevice (const SbVec3f &voxelCoord, float &rx, float &ry)
 same as above More...
 
void mapVoxelToDevice (const SbVec3f &voxelCoord, SbVec2f &r)
 same as above More...
 
SbMatrix getWorldToDeviceMatrix ()
 Returns the world to device matrix. More...
 
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 the slice) More...
 
void mapWorldToDevice (const SbVec3f &worldCoord, float &rx, float &ry)
 same as above More...
 
void mapWorldToDevice (const SbVec3f &worldCoord, SbVec2f &r)
 same as above More...
 
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 slice) More...
 
View2DTexturegetOverlayTexture (void *user=nullptr, int id=0)
 get the overlay texture (is only created on first call and cached afterwards) More...
 
int getLutSize ()
 get size of lut More...
 
float getInnerZoom ()
 get the inner zoom More...
 
void setDraw3D (bool flag, float devicePixelSize=1)
 enable drawing in 3d More...
 
bool is3D ()
 check if current rendering is in 3d More...
 
bool containsVoxel (const SbVec3f &voxelPos)
 returns if the slice contains the given voxel pos More...
 

Static Public Member Functions

static void enableBlending (int blendMode)
 enable the given blend mode in GL state. More...
 

Detailed Description

a single slice that is stored in a View2DSliceList, typically created by a View2DSliceList

Definition at line 47 of file View2DSlice.h.

Constructor & Destructor Documentation

◆ View2DSlice()

View2DSlice::View2DSlice ( )

constructor

◆ ~View2DSlice()

View2DSlice::~View2DSlice ( )

destructor.

Member Function Documentation

◆ containsVoxel()

bool View2DSlice::containsVoxel ( const SbVec3f &  voxelPos)

returns if the slice contains the given voxel pos

◆ destroy()

void View2DSlice::destroy ( )

destroy the slice textures

◆ drawBackground()

void View2DSlice::drawBackground ( bool  clipBackgroundToImage = false)

draw background of the slice

◆ drawSlice()

void View2DSlice::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)

◆ drawSliceIn3D()

void View2DSlice::drawSliceIn3D ( View2DSliceList dsl,
bool  extensionsOnly,
SoNodeList *  extensions,
bool  reverseDrawingOrder 
)

◆ drawTexture() [1/5]

void View2DSlice::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)

◆ drawTexture() [2/5]

void View2DSlice::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)

◆ drawTexture() [3/5]

void View2DSlice::drawTexture ( View2DTexture texture,
int  blendMode 
)

draw a View2DTexture (used for Slice drawing and for overlays also)

◆ drawTexture() [4/5]

void View2DSlice::drawTexture ( View2DTexture texture,
int  blendMode,
float *  blendColor 
)

draw a View2DTexture (used for Slice drawing and for overlays also)

◆ drawTexture() [5/5]

void View2DSlice::drawTexture ( View2DTexture texture,
int  blendMode,
float *  blendColor,
View2DTextureFilter  filter 
)

draw a View2DTexture (used for Slice drawing and for overlays also)

◆ enableBlending()

static void View2DSlice::enableBlending ( int  blendMode)
static

enable the given blend mode in GL state.

◆ getAspectRatio()

float View2DSlice::getAspectRatio ( )
inline

get the aspect ratio

Definition at line 81 of file View2DSlice.h.

◆ getCachingMode()

View2DSliceCachingMode View2DSlice::getCachingMode ( )

get data caching mode.

◆ getDrawPosition()

void View2DSlice::getDrawPosition ( float &  x,
float &  y 
)

get the slice position for drawing

◆ getDrawSize()

void View2DSlice::getDrawSize ( float &  sx,
float &  sy 
)

get the slice size for drawing

◆ getFilter()

View2DTextureFilter View2DSlice::getFilter ( )

get the filter

◆ getImageDeviceRect()

void View2DSlice::getImageDeviceRect ( float &  dx1,
float &  dy1,
float &  dx2,
float &  dy2 
)

Returns the device rect for the base image.

◆ getInnerZoom()

float View2DSlice::getInnerZoom ( )

get the inner zoom

◆ getInputImage()

SoSFMLImage* View2DSlice::getInputImage ( )

get the input image.

◆ getLutSize()

int View2DSlice::getLutSize ( )

get size of lut

◆ getOverlayTexture()

View2DTexture* View2DSlice::getOverlayTexture ( void *  user = nullptr,
int  id = 0 
)

get the overlay texture (is only created on first call and cached afterwards)

◆ getShader()

View2DShader* View2DSlice::getShader ( )
inline

get the main shader (might be NULL);

Definition at line 67 of file View2DSlice.h.

◆ getSliceOrigin()

void View2DSlice::getSliceOrigin ( float &  x,
float &  y 
)

get the inner slice origin

◆ getSliceZ()

int View2DSlice::getSliceZ ( )

get the slice z position.

◆ getSliceZoom()

float View2DSlice::getSliceZoom ( )

get the inner slice zoom

◆ getTimePoint()

int View2DSlice::getTimePoint ( )

get the time point

◆ getVisibleDeviceRect()

void View2DSlice::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 slice)

◆ getVoxelSize() [1/2]

void View2DSlice::getVoxelSize ( double &  vx,
double &  vy,
double &  vz 
)

return voxel size in doubles

◆ getVoxelSize() [2/2]

void View2DSlice::getVoxelSize ( float &  vx,
float &  vy,
float &  vz 
)

return voxel size

◆ getWorldToDeviceMatrix()

SbMatrix View2DSlice::getWorldToDeviceMatrix ( )

Returns the world to device matrix.

◆ invalidate()

void View2DSlice::invalidate ( )

Invalidate the current slice data.

◆ invalidateView()

void View2DSlice::invalidateView ( )

Sets a flag that the current state of the instance does not correspond to the data on the display.

◆ is3D()

bool View2DSlice::is3D ( )
inline

check if current rendering is in 3d

Definition at line 260 of file View2DSlice.h.

◆ isSliceHit()

bool View2DSlice::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 returns TRUE,.

◆ isValidVoxel() [1/2]

bool View2DSlice::isValidVoxel ( const SbVec3f &  voxel)

same as above

◆ isValidVoxel() [2/2]

bool View2DSlice::isValidVoxel ( float  voxelX,
float  voxelY,
float  voxelZ 
)

Returns if the given voxel coordinate is inside the image (z is currently ignored)

◆ mapDeviceToNormalizedCoordinateSystem()

void View2DSlice::mapDeviceToNormalizedCoordinateSystem ( int  x,
int  y,
SbVec2f &  normalizedCoordinate 
) const

Maps the given device coordinates to normalized View2D coordinates (as used by sliceOrigin and zoomCenter).

(typically this method is only used by View2DSliceList, please use the corresponding method of View2DSliceList instead)

◆ mapVoxelToDevice() [1/3]

void View2DSlice::mapVoxelToDevice ( const SbVec3f &  voxelCoord,
float &  rx,
float &  ry 
)

same as above

◆ mapVoxelToDevice() [2/3]

void View2DSlice::mapVoxelToDevice ( const SbVec3f &  voxelCoord,
SbVec2f &  r 
)

same as above

◆ mapVoxelToDevice() [3/3]

void View2DSlice::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 on the slice), Voxel z is currently ignored!

◆ mapWorldToDevice() [1/3]

void View2DSlice::mapWorldToDevice ( const SbVec3f &  worldCoord,
float &  rx,
float &  ry 
)

same as above

◆ mapWorldToDevice() [2/3]

void View2DSlice::mapWorldToDevice ( const SbVec3f &  worldCoord,
SbVec2f &  r 
)

same as above

◆ mapWorldToDevice() [3/3]

void View2DSlice::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 the slice)

◆ millimeterToPixel()

float View2DSlice::millimeterToPixel ( float  lengthMillimeter)

calculates the pixel offset (in device coordinates) that corresponds to a certain distance (in mm, in world coordinates).

◆ select() [1/3]

bool View2DSlice::select ( const SbVec2f &  d,
SbVec3f &  voxel 
)

same as above

◆ select() [2/3]

bool View2DSlice::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 this method is only used by View2DSliceList, please use mapDeviceToVoxel or mapDeviceToWorld instead!) (this returns true if the coordinate is in the visible device rect of the slice, even if it is outside the image)

◆ select() [3/3]

bool View2DSlice::select ( float  x,
float  y,
SbVec3f &  voxel 
)

same as above

◆ setAspectRatio()

void View2DSlice::setAspectRatio ( float  ratio)
inline

set the aspect ratio

Definition at line 78 of file View2DSlice.h.

◆ setBackgroundColor()

void View2DSlice::setBackgroundColor ( float *  color)

set the background color (rgba)

◆ setBlendMode()

void View2DSlice::setBlendMode ( int  blendMode,
float *  blendColor = nullptr 
)

set blend mode

◆ setCachingMode()

void View2DSlice::setCachingMode ( View2DSliceCachingMode  mode)

set data caching mode.

◆ setDraw3D()

void View2DSlice::setDraw3D ( bool  flag,
float  devicePixelSize = 1 
)

enable drawing in 3d

◆ setDrawPosition()

void View2DSlice::setDrawPosition ( float  x,
float  y 
)

set the slice position for drawing

◆ setDrawsData()

void View2DSlice::setDrawsData ( bool  flag)

enable/disable data loading

◆ setDrawSize()

void View2DSlice::setDrawSize ( float  sx,
float  sy 
)

set the slice size for drawing

◆ setFilter()

void View2DSlice::setFilter ( View2DTextureFilter  filter = FILTER_LINEAR)

set the filter

◆ setFixedInnerZoom()

void View2DSlice::setFixedInnerZoom ( bool  flag,
float  fixedZoom 
)

set the fixed innerzoom

◆ setInputImage()

void View2DSlice::setInputImage ( SoSFMLImage img)

set the input image.

◆ setLut()

void View2DSlice::setLut ( View2DLut lut)

set the lut

◆ setShaders()

void View2DSlice::setShaders ( View2DShader shader,
View2DShader **  overlayShaders 
)

sets the shader that should be used for rendering

◆ setSliceAlignment()

void View2DSlice::setSliceAlignment ( View2DAlignXMode  x,
View2DAlignYMode  y 
)

set the alignment of the slice

◆ setSliceOrigin()

void View2DSlice::setSliceOrigin ( float  x,
float  y 
)

set the inner slice origin

◆ setSliceZ()

void View2DSlice::setSliceZ ( int  z)

set the slice z position.

◆ setSliceZoom()

void View2DSlice::setSliceZoom ( float  zoom)

set the inner slice zoom

◆ setTimePoint()

void View2DSlice::setTimePoint ( int  timepoint)

set the time point

◆ updateLayout()

void View2DSlice::updateLayout ( )

update internal layout


The documentation for this class was generated from the following file: