MeVisLab Toolbox Reference
|
a list that holds all View2DSlice
objects (lazily created) of a SoView2D
More...
#include <View2DSliceList.h>
Public Member Functions | |
View2DSliceList () | |
create empty list | |
~View2DSliceList () | |
destructor | |
void | setInputImage (SoSFMLImage *img) |
set the input image. | |
SoSFMLImage * | getInputImage () |
get the input image. | |
void | setSliceRange (int start, int num, int step=1) |
set the slice range. | |
void | getSliceRange (int &start, int &num, int &step) |
get the slice range. | |
void | setFilter (View2DTextureFilter filter=FILTER_LINEAR) |
set filter | |
View2DTextureFilter | getFilter () |
get filter | |
void | setSliceAlignment (View2DAlignXMode x, View2DAlignYMode y) |
set slice alignment | |
void | setAspectRatio (float ratio) |
set the aspect ratio | |
float | getAspectRatio () |
get the aspect ratio | |
void | setFixedInnerZoom (bool flag, float fixedZoom) |
set the fixed innerzoom | |
void | setBlendMode (int blendMode=0, float *_blendColor=nullptr) |
set blendmode | |
int | getBlendMode () |
get blendmode | |
float * | getBlendColor () |
get the color for blending (4 floats) | |
void | setDrawsData (bool flag) |
enable/disable data loading | |
void | setUseShaders (bool flag) |
sets if the tries to use shaders for hardware lut | |
void | initGL () |
initialize internals that require a valid GL state | |
View2DShader * | createShader () |
returns a new shader, owned by the caller. | |
void | setLut (View2DLut *lut) |
set lut | |
View2DLut * | getLut () |
get lut | |
void | setSliceSize (float sizeX, float sizeY) |
Set the size of the slice to be drawn. | |
void | getSliceSize (float &sizeX, float &sizeY) |
Get the size of the slice to be drawn. | |
void | setSliceSpacing (float dx, float dy) |
Set the spacing between slices. | |
void | getSliceSpacing (float &dx, float &dy) |
Get the spacing between slices. | |
void | setSliceOrigin (float x, float y) |
Set the inner slice origin. | |
void | getSliceOrigin (float &x, float &y) |
Get the inner slice origin. | |
void | setDrawOffset (float x, float y) |
Set slice list draw offset. | |
void | getDrawOffset (float &x, float &y) |
Get slice list draw offset. | |
void | setTimePoint (int timepoint) |
Set the time point. | |
int | getTimePoint () |
Get the time point. | |
void | setUserIndex (int userIndex) |
Set the user index. | |
int | getUserIndex () |
Get the user index. | |
void | setSliceZoom (float zoom) |
Set the inner slice zoom. | |
float | getSliceZoom () |
Get the inner slice zoom. | |
void | setOwner (SoView2D *view) |
Set the owning SoView2D. | |
SoView2D * | getOwner () |
Get the owning SoView2D. | |
void | setNumXSlices (int num) |
set number of slices in a row. | |
int | getNumXSlices () |
get number of slices in a row. | |
void | setSlab (int slab) |
set number of slab slices (1 means no slab, one slice) | |
int | getSlab () |
get number of slab slices | |
void | setCachingMode (View2DSliceCachingMode mode) |
set data caching mode. | |
View2DSliceCachingMode | getCachingMode () |
get data caching mode. | |
void | setBackgroundColor (float *color) |
set the background color (rgba) | |
void | setClipBackgroundToImage (bool value) |
set if background should be clipped to image rect | |
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 FALSE on any error. | |
bool | mapVoxelToDevice (float voxelX, float voxelY, float voxelZ, float &rx, float &ry) |
Determine a device pixel coordinate from the voxel coordinate in any slice. | |
bool | mapWorldToDevice (float worldX, float worldY, float worldZ, float &rx, float &ry) |
Determine a device pixel coordinate from the world coordinate in any slice. | |
void | mapWorldToVoxel (float worldX, float worldY, float worldZ, float &voxelX, float &voxelY, float &voxelZ) |
maps the world coordinate to local voxel coordinates | |
void | mapWorldToVoxel (double worldX, double worldY, double worldZ, double &voxelX, double &voxelY, double &voxelZ) |
maps the world coordinate to local voxel coordinates (double version) | |
void | mapVoxelToWorld (float voxelX, float voxelY, float voxelZ, float &worldX, float &worldY, float &worldZ) |
maps the voxel coordinate to world coordinates | |
void | mapVoxelToWorld (double voxelX, double voxelY, double voxelZ, double &worldX, double &worldY, double &worldZ) |
maps the voxel coordinate to world coordinates (double version) | |
bool | isSliceHit (int x, int y) |
Returns if a slice's visible rect is hit at the given device coordinate, if a device rect of a slice was hit returns TRUE,. | |
int | getSliceAtDevicePosition (int x, int y) const |
Returns z index of slice whose visible rect is hit, return -1 if no slice is hit. | |
bool | isVoxelInsideImage (float voxelX, float voxelY, float voxelZ) |
Returns if the given voxel is inside the image extends. | |
bool | is3D () |
is current rendering in 3D? | |
void | set3DPixelSize (float devicePixelMM) |
set the device coordinate scale when slices are rendered in 3d | |
SbVec3f | getSliceTranslation (int z) |
get translation vector of the slice in world coordinates (to voxel 0,0,z+0.5) | |
SbVec3f | getSliceNormal () |
get normal of slices in world coordinates (all slices have the same normal) The slice normal is orthogonal to the slice's x/y axes and can be seen as the normal of the plane that the slice lies in. | |
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 given viewpoint. | |
bool | mapVoxelToDevice (const SbVec3f &voxelCoord, float &rx, float &ry) |
Determine a device pixel coordinate from the voxel coordinate in any slice. | |
bool | mapVoxelToDevice (const SbVec3f &voxelCoord, SbVec2f &r) |
same as above | |
bool | mapWorldToDevice (const SbVec3f &worldCoord, float &rx, float &ry) |
Determine a device pixel coordinate from the world coordinate in any slice. | |
bool | mapWorldToDevice (const SbVec3f &worldCoord, SbVec2f &r) |
same as above | |
void | mapWorldToVoxel (const SbVec3f &worldCoord, SbVec3f &voxelCoord) |
maps the world coordinate to local voxel coordinates (float version) | |
void | mapWorldToVoxel (const SbVec3d &worldCoord, SbVec3d &voxelCoord) |
maps the world coordinate to local voxel coordinates (double version) | |
void | mapVoxelToWorld (const SbVec3f &voxelCoord, SbVec3f &worldCoord) |
maps the voxel coordinate to world coordinates (float version) | |
void | mapVoxelToWorld (const SbVec3d &voxelCoord, SbVec3d &worldCoord) |
maps the voxel coordinate to world coordinates (double version) | |
bool | mapEventToWorld (View2DEvent *ec, float &worldX, float &worldY, float &worldZ) |
maps the given device event to world coords and returns if a slice was hit | |
bool | mapEventToWorld (View2DEvent *ec, SbVec3f &world) |
maps the given device event to world coords and returns if a slice was hit | |
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 | |
bool | mapEventToVoxel (View2DEvent *ec, SbVec3f &voxel) |
maps the given device event to voxel coords and returns if a slice was hit | |
bool | mapDeviceToNormalizedCoordinateSystem (int x, int y, SbVec2f &normalizedCoordinate) const |
Maps the given device coordinates to normalized View2D coordinates (as used by sliceOrigin and zoomCenter) and returns if a slice was hit. | |
SbVec3f | getWorldAxis (int a) |
returns the indicated axis (0/1/2) of the slices in world space | |
SbVec3d | getWorldAxisDouble (int a) |
returns the indicated axis (0/1/2) of the slices in world space | |
void | getImageSize (int &x, int &y, int &z) |
returns the image size in pixels | |
void | updateSliceList (int sharedContextId=-1, bool layoutOnly=false) |
Make the slice list up to date to the current settings. | |
View2DSlice * | getSlice (int z) const |
get slice with slice pos z | |
void | getCurrentInnerZoom (float &x, float &y) |
get the inner x/y zoom | |
int | getCurrentCacheContext () |
get current cache context (-1 if none, can only be called while drawing) | |
void | getWindowSize (int &x, int &y) |
get the window size that is currently rendered on | |
void | cleanup () |
Remove all current slice objects. | |
bool | shouldRenderReverse (const SbVec3f &viewdir) |
returns if the 3d rendering should be done in reverse order dependent on view direction (in world coordinates) | |
bool | mapDeviceToWorld (int x, int y, SbVec3f &worldCoord) |
Maps device coordinates to world coordinates, returns TRUE if successful, otherwise return FALSE. | |
bool | mapDeviceToVoxel (int x, int y, SbVec3f &voxelCoord, int *sliceID=nullptr) |
Maps device coordinates to local voxel coordinates, returns TRUE if successful, otherwise return FALSE. | |
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. | |
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 FALSE. | |
void | grabSlice () |
Switch on or off slice grabbing, i.e. | |
void | ungrabSlice () |
a list that holds all View2DSlice
objects (lazily created) of a SoView2D
Definition at line 28 of file View2DSliceList.h.
View2DSliceList::View2DSliceList | ( | ) |
create empty list
View2DSliceList::~View2DSliceList | ( | ) |
destructor
bool View2DSliceList::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 given viewpoint.
If a pointer to a "sliceID" parameter is given, the check is only done on the slice indicated. If this slice is NO_SLICE_ID, the check is done as if the pointer were NULL, but the value is afterwards changed to the resulting slice.
void View2DSliceList::cleanup | ( | ) |
Remove all current slice objects.
View2DShader * View2DSliceList::createShader | ( | ) |
returns a new shader, owned by the caller.
(it will return NULL if no shaders are allowed on the platform)
bool View2DSliceList::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 FALSE on any error.
|
inline |
get the aspect ratio
Definition at line 58 of file View2DSliceList.h.
float * View2DSliceList::getBlendColor | ( | ) |
get the color for blending (4 floats)
int View2DSliceList::getBlendMode | ( | ) |
get blendmode
View2DSliceCachingMode View2DSliceList::getCachingMode | ( | ) |
get data caching mode.
|
inline |
get current cache context (-1 if none, can only be called while drawing)
Definition at line 289 of file View2DSliceList.h.
View2DTextureFilter View2DSliceList::getFilter | ( | ) |
get filter
SoSFMLImage * View2DSliceList::getInputImage | ( | ) |
get the input image.
View2DLut * View2DSliceList::getLut | ( | ) |
get lut
int View2DSliceList::getNumXSlices | ( | ) |
get number of slices in a row.
|
inline |
Get the owning SoView2D.
Definition at line 127 of file View2DSliceList.h.
Referenced by CSODrawView2DInfos::getViewerId().
int View2DSliceList::getSlab | ( | ) |
get number of slab slices
View2DSlice * View2DSliceList::getSlice | ( | int | z | ) | const |
get slice with slice pos z
Returns z index of slice whose visible rect is hit, return -1 if no slice is hit.
SbVec3f View2DSliceList::getSliceNormal | ( | ) |
get normal of slices in world coordinates (all slices have the same normal) The slice normal is orthogonal to the slice's x/y axes and can be seen as the normal of the plane that the slice lies in.
In case of a sheared/gantry-tilted world matrix, the slice normal is not the same as the normalized world z direction vector, since the slice normal should be orthogonal on the slice's plane, which the world z vector is not in the sheared case.
Get the size of the slice to be drawn.
get translation vector of the slice in world coordinates (to voxel 0,0,z+0.5)
float View2DSliceList::getSliceZoom | ( | ) |
Get the inner slice zoom.
int View2DSliceList::getTimePoint | ( | ) |
Get the time point.
int View2DSliceList::getUserIndex | ( | ) |
Get the user index.
get the window size that is currently rendered on
Definition at line 292 of file View2DSliceList.h.
returns the indicated axis (0/1/2) of the slices in world space
returns the indicated axis (0/1/2) of the slices in world space
void View2DSliceList::grabSlice | ( | ) |
Switch on or off slice grabbing, i.e.
if mapping from device to voxel coordinates should always refer to the same (initial) slice, even if this slice isn't hit anymore. This is used for mouse dragging, so when dragging starts call grabSlice() and when dragging ends call ungrabSlice(). Note: This will not actually store the slice but the index in the slice layout, so changing the start slice (slicing) will still change the grabbed slice.
void View2DSliceList::initGL | ( | ) |
initialize internals that require a valid GL state
|
inline |
is current rendering in 3D?
Definition at line 193 of file View2DSliceList.h.
Returns if a slice's visible rect is hit at the given device coordinate, if a device rect of a slice was hit returns TRUE,.
Returns if the given voxel is inside the image extends.
bool View2DSliceList::mapDeviceToNormalizedCoordinateSystem | ( | int | x, |
int | y, | ||
SbVec2f & | normalizedCoordinate ) const |
Maps the given device coordinates to normalized View2D coordinates (as used by sliceOrigin and zoomCenter) and returns if a slice was hit.
bool View2DSliceList::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 FALSE.
DEPRECATED, you should use mapEventToVoxel, so that your extension also works in 3D. If a pointer to a "sliceID" parameter is given, the check is only done on the slice indicated. If this slice is NO_SLICE_ID, the check is done as if the pointer were NULL, but the value is afterwards changed to the resulting slice.
bool View2DSliceList::mapDeviceToVoxel | ( | int | x, |
int | y, | ||
SbVec3f & | voxelCoord, | ||
int * | sliceID = nullptr ) |
Maps device coordinates to local voxel coordinates, returns TRUE if successful, otherwise return FALSE.
DEPRECATED, you should use mapEventToVoxel, so that your extension also works in 3D If a pointer to a "sliceID" parameter is given, the check is only done on the slice indicated. If this slice is NO_SLICE_ID, the check is done as if the pointer were NULL, but the value is afterwards changed to the resulting slice.
bool View2DSliceList::mapDeviceToWorld | ( | int | x, |
int | y, | ||
float & | worldX, | ||
float & | worldY, | ||
float & | worldZ ) |
Maps device coordinates to world coordinates, returns TRUE if successful, otherwise return FALSE.
DEPRECATED, you should use mapEventToWorld, so that your extension also works in 3D.
Maps device coordinates to world coordinates, returns TRUE if successful, otherwise return FALSE.
DEPRECATED, you should use mapEventToWorld, so that your extension also works in 3D.
bool View2DSliceList::mapEventToVoxel | ( | View2DEvent * | ec, |
float & | vx, | ||
float & | vy, | ||
float & | vz ) |
maps the given device event to voxel coords and returns if a slice was hit
bool View2DSliceList::mapEventToVoxel | ( | View2DEvent * | ec, |
SbVec3f & | voxel ) |
maps the given device event to voxel coords and returns if a slice was hit
bool View2DSliceList::mapEventToWorld | ( | View2DEvent * | ec, |
float & | worldX, | ||
float & | worldY, | ||
float & | worldZ ) |
maps the given device event to world coords and returns if a slice was hit
bool View2DSliceList::mapEventToWorld | ( | View2DEvent * | ec, |
SbVec3f & | world ) |
maps the given device event to world coords and returns if a slice was hit
Determine a device pixel coordinate from the voxel coordinate in any slice.
bool View2DSliceList::mapVoxelToDevice | ( | float | voxelX, |
float | voxelY, | ||
float | voxelZ, | ||
float & | rx, | ||
float & | ry ) |
Determine a device pixel coordinate from the voxel coordinate in any slice.
maps the voxel coordinate to world coordinates (double version)
maps the voxel coordinate to world coordinates (float version)
void View2DSliceList::mapVoxelToWorld | ( | double | voxelX, |
double | voxelY, | ||
double | voxelZ, | ||
double & | worldX, | ||
double & | worldY, | ||
double & | worldZ ) |
maps the voxel coordinate to world coordinates (double version)
void View2DSliceList::mapVoxelToWorld | ( | float | voxelX, |
float | voxelY, | ||
float | voxelZ, | ||
float & | worldX, | ||
float & | worldY, | ||
float & | worldZ ) |
maps the voxel coordinate to world coordinates
Determine a device pixel coordinate from the world coordinate in any slice.
bool View2DSliceList::mapWorldToDevice | ( | float | worldX, |
float | worldY, | ||
float | worldZ, | ||
float & | rx, | ||
float & | ry ) |
Determine a device pixel coordinate from the world coordinate in any slice.
maps the world coordinate to local voxel coordinates (double version)
maps the world coordinate to local voxel coordinates (float version)
void View2DSliceList::mapWorldToVoxel | ( | double | worldX, |
double | worldY, | ||
double | worldZ, | ||
double & | voxelX, | ||
double & | voxelY, | ||
double & | voxelZ ) |
maps the world coordinate to local voxel coordinates (double version)
void View2DSliceList::mapWorldToVoxel | ( | float | worldX, |
float | worldY, | ||
float | worldZ, | ||
float & | voxelX, | ||
float & | voxelY, | ||
float & | voxelZ ) |
maps the world coordinate to local voxel coordinates
set the device coordinate scale when slices are rendered in 3d
Definition at line 196 of file View2DSliceList.h.
References mlrange_cast().
set the aspect ratio
Definition at line 55 of file View2DSliceList.h.
set blendmode
void View2DSliceList::setCachingMode | ( | View2DSliceCachingMode | mode | ) |
set data caching mode.
set if background should be clipped to image rect
void View2DSliceList::setFilter | ( | View2DTextureFilter | filter = FILTER_LINEAR | ) |
set filter
void View2DSliceList::setInputImage | ( | SoSFMLImage * | img | ) |
set the input image.
Set the owning SoView2D.
Definition at line 125 of file View2DSliceList.h.
References mlrange_cast().
void View2DSliceList::setSliceAlignment | ( | View2DAlignXMode | x, |
View2DAlignYMode | y ) |
set slice alignment
Set the size of the slice to be drawn.
sets if the tries to use shaders for hardware lut
Definition at line 75 of file View2DSliceList.h.
References mlrange_cast().
returns if the 3d rendering should be done in reverse order dependent on view direction (in world coordinates)
void View2DSliceList::ungrabSlice | ( | ) |
Make the slice list up to date to the current settings.
Create missing entries and remove redundant ones.