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

Static Public Member Functions

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

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 ( )
default

constructor

◆ ~View2DSlice()

View2DSlice::~View2DSlice ( )

destructor.

Member Function Documentation

◆ containsVoxel()

bool View2DSlice::containsVoxel ( const SbVec3f & voxelPos) const

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 ( ) const
inline

get the aspect ratio

Definition at line 87 of file View2DSlice.h.

◆ getCachingMode()

View2DSliceCachingMode View2DSlice::getCachingMode ( ) const

get data caching mode.

◆ getDrawPosition()

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

get the slice position for drawing

◆ getDrawSize()

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

get the slice size for drawing

◆ getFilter()

View2DTextureFilter View2DSlice::getFilter ( ) const

get the filter

◆ getImageDeviceRect()

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

Returns the device rect for the base image.

◆ getInnerZoom()

float View2DSlice::getInnerZoom ( ) const

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 ( ) const
inline

get the main shader (might be NULL);

Definition at line 67 of file View2DSlice.h.

◆ getSliceOrigin()

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

get the inner slice origin

◆ getSliceZ()

int View2DSlice::getSliceZ ( ) const

get the slice z position.

◆ getSliceZoom()

float View2DSlice::getSliceZoom ( ) const

get the inner slice zoom

◆ getTimePoint()

int View2DSlice::getTimePoint ( ) const

get the time point

◆ getUserIndex()

int View2DSlice::getUserIndex ( ) const

get the user index

◆ getVisibleDeviceRect()

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

◆ getVoxelSize() [1/2]

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

return voxel size in doubles

◆ getVoxelSize() [2/2]

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

return voxel size

◆ getWorldToDeviceMatrix()

SbMatrix View2DSlice::getWorldToDeviceMatrix ( ) const

Returns the world to device matrix.

◆ invalidate()

void View2DSlice::invalidate ( )

Invalidate the current slice data.

◆ is3D()

bool View2DSlice::is3D ( ) const
inline

check if current rendering is in 3d

Definition at line 264 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) const

same as above

◆ isValidVoxel() [2/2]

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

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 ) const

same as above

◆ mapVoxelToDevice() [2/3]

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

same as above

◆ mapVoxelToDevice() [3/3]

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

◆ mapWorldToDevice() [1/3]

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

same as above

◆ mapWorldToDevice() [2/3]

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

same as above

◆ mapWorldToDevice() [3/3]

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

◆ millimeterToPixel()

float View2DSlice::millimeterToPixel ( float lengthMillimeter) const

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 ) const

same as above

◆ select() [2/3]

bool View2DSlice::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 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 ) const

same as above

◆ setAspectRatio()

void View2DSlice::setAspectRatio ( float ratio)
inline

set the aspect ratio

Definition at line 81 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 inner zoom

◆ 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

◆ setUserIndex()

void View2DSlice::setUserIndex ( int useIndex)

set the user index

◆ updateLayout()

void View2DSlice::updateLayout ( )

update internal layout


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