Slicer 5.13
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkSegmentationLabelmapSurfaceMapper Class Reference

Render a labelmap as smooth surfaces, computed on the GPU. More...

#include <Modules/Loadable/Segmentations/MRMLDM/vtkSegmentationLabelmapSurfaceMapper.h>

Inheritance diagram for vtkSegmentationLabelmapSurfaceMapper:
Collaboration diagram for vtkSegmentationLabelmapSurfaceMapper:

Public Types

typedef vtkMRMLRayCastMapper Superclass
 

Public Member Functions

virtual void CapClippedSurfaceOff ()
 
virtual void CapClippedSurfaceOn ()
 
virtual void ClippingOutlineOff ()
 
virtual void ClippingOutlineOn ()
 
double * GetBounds () VTK_SIZEHINT(6) override
 
virtual bool GetCapClippedSurface ()
 
virtual double GetCapOpacity ()
 
virtual const char * GetClassName ()
 
virtual bool GetClippingOutline ()
 
virtual double GetImageSampleDistance ()
 
virtual bool GetKeepWhereAnyClippingPlaneKeeps ()
 
vtkOrientedImageData * GetLabelmap ()
 
virtual vtkIdType GetMaximumNumberOfVoxels ()
 
virtual int GetNumberOfDistanceFieldComputations ()
 Number of times the signed distance field has been computed (for testing).
 
virtual double * GetOutlineColor ()
 
virtual void GetOutlineColor (double &, double &, double &)
 
virtual void GetOutlineColor (double[3])
 
virtual double GetOutlineWidth ()
 
int GetShownLabelAtPosition (const double ijk[3], double maximumDistance=1.5)
 
virtual double GetSmoothingFactor ()
 
bool IntersectWithRay (const double p1[3], const double p2[3], double t1, double t2, vtkMatrix4x4 *toWorld, double &t, double xyz[3], double n[3]) override
 
virtual int IsA (const char *type)
 
virtual void KeepWhereAnyClippingPlaneKeepsOff ()
 
virtual void KeepWhereAnyClippingPlaneKeepsOn ()
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
void ReleaseGraphicsResources (vtkWindow *window) override
 
void RemoveAllLabelColors ()
 Remove all label colors (all labels are hidden).
 
void Render (vtkRenderer *ren, vtkActor *actor) override
 
virtual void SetCapClippedSurface (bool)
 
virtual void SetCapOpacity (double)
 Opacity of the cap surface, relative to the opacity of the segment.
 
virtual void SetClippingOutline (bool)
 Show the outline of the segments on clipping planes: the curve where the planes cut the surface (disabled by default).
 
virtual void SetImageSampleDistance (double)
 
virtual void SetKeepWhereAnyClippingPlaneKeeps (bool)
 
void SetLabelColor (int labelValue, double r, double g, double b, double opacity=1.0)
 
void SetLabelmap (vtkOrientedImageData *labelmap)
 Labelmap to render. Geometry (spacing, directions) is taken into account when computing distances.
 
virtual void SetMaximumNumberOfVoxels (vtkIdType)
 
virtual void SetOutlineColor (double, double, double)
 Color of the clipping outline.
 
virtual void SetOutlineColor (double[3])
 
virtual void SetOutlineWidth (double)
 Width of the clipping outline, in pixels.
 
virtual void SetSmoothingFactor (double)
 
- Public Member Functions inherited from vtkMRMLRayCastMapper
void PrintSelf (ostream &os, vtkIndent indent) override
 
 vtkAbstractTypeMacro (vtkMRMLRayCastMapper, vtkMapper)
 

Static Public Member Functions

static int IsTypeOf (const char *type)
 
static vtkSegmentationLabelmapSurfaceMapper * New ()
 
static vtkSegmentationLabelmapSurfaceMapper * SafeDownCast (vtkObject *o)
 

Protected Member Functions

int FillInputPortInformation (int port, vtkInformation *info) override
 
 vtkSegmentationLabelmapSurfaceMapper ()
 
 ~vtkSegmentationLabelmapSurfaceMapper () override
 
- Protected Member Functions inherited from vtkMRMLRayCastMapper
 vtkMRMLRayCastMapper ()=default
 
 ~vtkMRMLRayCastMapper () override=default
 

Protected Attributes

bool CapClippedSurface { true }
 
double CapOpacity { 1.0 }
 
bool ClippingOutline { false }
 
double ImageSampleDistance { 1.0 }
 
bool KeepWhereAnyClippingPlaneKeeps { false }
 
vtkIdType MaximumNumberOfVoxels { 32 * 1024 * 1024 }
 
int NumberOfDistanceFieldComputations { 0 }
 
double OutlineColor [3] { 0.0, 0.0, 0.0 }
 
double OutlineWidth { 1.0 }
 
double SmoothingFactor { 0.5 }
 

Detailed Description

Render a labelmap as smooth surfaces, computed on the GPU.

The mapper computes a signed distance field of the labelmap on the GPU (jump flooding algorithm, in fragment shader passes that write 3D texture slices, followed by Gaussian smoothing) and ray casts its zero level set. No polygonal mesh is generated, so the surface is updated quickly when the labelmap changes.

Labels that are not added by SetLabelColor are treated as background. Model coordinates of the mapper are the IJK coordinates of the labelmap (the actor's matrix is expected to map them to world coordinates).

Uses only OpenGL features that are available in both OpenGL 3.2 and OpenGL ES 3.0 (WebGL2), with 16-bit floating-point render targets (EXT_color_buffer_float on WebGL2).

Definition at line 44 of file vtkSegmentationLabelmapSurfaceMapper.h.

Member Typedef Documentation

◆ Superclass

Constructor & Destructor Documentation

◆ vtkSegmentationLabelmapSurfaceMapper()

vtkSegmentationLabelmapSurfaceMapper::vtkSegmentationLabelmapSurfaceMapper ( )
protected

◆ ~vtkSegmentationLabelmapSurfaceMapper()

vtkSegmentationLabelmapSurfaceMapper::~vtkSegmentationLabelmapSurfaceMapper ( )
overrideprotected

Member Function Documentation

◆ CapClippedSurfaceOff()

virtual void vtkSegmentationLabelmapSurfaceMapper::CapClippedSurfaceOff ( )
virtual

◆ CapClippedSurfaceOn()

virtual void vtkSegmentationLabelmapSurfaceMapper::CapClippedSurfaceOn ( )
virtual

◆ ClippingOutlineOff()

virtual void vtkSegmentationLabelmapSurfaceMapper::ClippingOutlineOff ( )
virtual

◆ ClippingOutlineOn()

virtual void vtkSegmentationLabelmapSurfaceMapper::ClippingOutlineOn ( )
virtual

◆ FillInputPortInformation()

int vtkSegmentationLabelmapSurfaceMapper::FillInputPortInformation ( int port,
vtkInformation * info )
overrideprotected

◆ GetBounds()

double * vtkSegmentationLabelmapSurfaceMapper::GetBounds ( )
override

◆ GetCapClippedSurface()

virtual bool vtkSegmentationLabelmapSurfaceMapper::GetCapClippedSurface ( )
virtual

◆ GetCapOpacity()

virtual double vtkSegmentationLabelmapSurfaceMapper::GetCapOpacity ( )
virtual

◆ GetClassName()

virtual const char * vtkSegmentationLabelmapSurfaceMapper::GetClassName ( )
virtual

◆ GetClippingOutline()

virtual bool vtkSegmentationLabelmapSurfaceMapper::GetClippingOutline ( )
virtual

◆ GetImageSampleDistance()

virtual double vtkSegmentationLabelmapSurfaceMapper::GetImageSampleDistance ( )
virtual

◆ GetKeepWhereAnyClippingPlaneKeeps()

virtual bool vtkSegmentationLabelmapSurfaceMapper::GetKeepWhereAnyClippingPlaneKeeps ( )
virtual

◆ GetLabelmap()

vtkOrientedImageData * vtkSegmentationLabelmapSurfaceMapper::GetLabelmap ( )

◆ GetMaximumNumberOfVoxels()

virtual vtkIdType vtkSegmentationLabelmapSurfaceMapper::GetMaximumNumberOfVoxels ( )
virtual

◆ GetNumberOfDistanceFieldComputations()

virtual int vtkSegmentationLabelmapSurfaceMapper::GetNumberOfDistanceFieldComputations ( )
virtual

Number of times the signed distance field has been computed (for testing).

◆ GetOutlineColor() [1/3]

virtual double * vtkSegmentationLabelmapSurfaceMapper::GetOutlineColor ( )
virtual

◆ GetOutlineColor() [2/3]

virtual void vtkSegmentationLabelmapSurfaceMapper::GetOutlineColor ( double & ,
double & ,
double &  )
virtual

◆ GetOutlineColor() [3/3]

virtual void vtkSegmentationLabelmapSurfaceMapper::GetOutlineColor ( double [3])
virtual

◆ GetOutlineWidth()

virtual double vtkSegmentationLabelmapSurfaceMapper::GetOutlineWidth ( )
virtual

◆ GetShownLabelAtPosition()

int vtkSegmentationLabelmapSurfaceMapper::GetShownLabelAtPosition ( const double ijk[3],
double maximumDistance = 1.5 )

Get the label of the shown segment that is at the specified position (in IJK coordinates of the labelmap), or the nearest one within the specified distance (in voxels). Returns 0 if there is no shown segment there.

◆ GetSmoothingFactor()

virtual double vtkSegmentationLabelmapSurfaceMapper::GetSmoothingFactor ( )
virtual

◆ IntersectWithRay()

bool vtkSegmentationLabelmapSurfaceMapper::IntersectWithRay ( const double p1[3],
const double p2[3],
double t1,
double t2,
vtkMatrix4x4 * toWorld,
double & t,
double xyz[3],
double n[3] )
overridevirtual

Intersect a ray (in IJK coordinates of the labelmap, between P1 + T1 * (P2 - P1) and P1 + T2 * (P2 - P1)) with the surface of the shown segments (computed from the labelmap on the CPU, the surface follows the boundary of voxels, not smoothed). Returns true if there is an intersection, and its parametric coordinate, position and normal. The ray is clipped as the mapper clips what it renders, in all of its clipping modes (KeepWhereAnyClippingPlaneKeeps): what the clipping planes clip away is not hit, and where they cut a segment the cap is hit if it is shown (CapClippedSurface, with a CapOpacity above 0). toWorld is the matrix of the actor (IJK to world), which the clipping planes are transformed with; if it is nullptr then the clipping planes are ignored. vtkMRMLAccuratePicker picks the surface with this.

Implements vtkMRMLRayCastMapper.

◆ IsA()

virtual int vtkSegmentationLabelmapSurfaceMapper::IsA ( const char * type)
virtual

◆ IsTypeOf()

static int vtkSegmentationLabelmapSurfaceMapper::IsTypeOf ( const char * type)
static

◆ KeepWhereAnyClippingPlaneKeepsOff()

virtual void vtkSegmentationLabelmapSurfaceMapper::KeepWhereAnyClippingPlaneKeepsOff ( )
virtual

◆ KeepWhereAnyClippingPlaneKeepsOn()

virtual void vtkSegmentationLabelmapSurfaceMapper::KeepWhereAnyClippingPlaneKeepsOn ( )
virtual

◆ New()

static vtkSegmentationLabelmapSurfaceMapper * vtkSegmentationLabelmapSurfaceMapper::New ( )
static

◆ PrintSelf()

void vtkSegmentationLabelmapSurfaceMapper::PrintSelf ( ostream & os,
vtkIndent indent )
override

◆ ReleaseGraphicsResources()

void vtkSegmentationLabelmapSurfaceMapper::ReleaseGraphicsResources ( vtkWindow * window)
override

◆ RemoveAllLabelColors()

void vtkSegmentationLabelmapSurfaceMapper::RemoveAllLabelColors ( )

Remove all label colors (all labels are hidden).

◆ Render()

void vtkSegmentationLabelmapSurfaceMapper::Render ( vtkRenderer * ren,
vtkActor * actor )
override

◆ SafeDownCast()

static vtkSegmentationLabelmapSurfaceMapper * vtkSegmentationLabelmapSurfaceMapper::SafeDownCast ( vtkObject * o)
static

◆ SetCapClippedSurface()

virtual void vtkSegmentationLabelmapSurfaceMapper::SetCapClippedSurface ( bool )
virtual

Show the surface where clipping planes cut segments (enabled by default). Clipping planes are set by SetClippingPlanes, in world coordinates; the kept region is where all plane functions are positive (as for other VTK mappers), or where any of them is, see KeepWhereAnyClippingPlaneKeeps.

◆ SetCapOpacity()

virtual void vtkSegmentationLabelmapSurfaceMapper::SetCapOpacity ( double )
virtual

Opacity of the cap surface, relative to the opacity of the segment.

◆ SetClippingOutline()

virtual void vtkSegmentationLabelmapSurfaceMapper::SetClippingOutline ( bool )
virtual

Show the outline of the segments on clipping planes: the curve where the planes cut the surface (disabled by default).

◆ SetImageSampleDistance()

virtual void vtkSegmentationLabelmapSurfaceMapper::SetImageSampleDistance ( double )
virtual

Rays are cast for every n-th pixel across and down (1: every pixel), and the image is scaled up to the viewport, as with ImageSampleDistance of vtkGPUVolumeRayCastMapper. Larger values make rendering faster at the expense of detail, for example while the camera is moving.

◆ SetKeepWhereAnyClippingPlaneKeeps()

virtual void vtkSegmentationLabelmapSurfaceMapper::SetKeepWhereAnyClippingPlaneKeeps ( bool )
virtual

Keep the region where any clipping plane function is positive, instead of where all of them are (disabled by default). This is the ClipIntersection clip type of vtkMRMLClipNode (which clips away the intersection of the clipped spaces).

◆ SetLabelColor()

void vtkSegmentationLabelmapSurfaceMapper::SetLabelColor ( int labelValue,
double r,
double g,
double b,
double opacity = 1.0 )

Show the voxels that have the specified label value with the specified color and opacity. Surfaces of segments that touch each other are only shown where they touch if they are in different mappers.

◆ SetLabelmap()

void vtkSegmentationLabelmapSurfaceMapper::SetLabelmap ( vtkOrientedImageData * labelmap)

Labelmap to render. Geometry (spacing, directions) is taken into account when computing distances.

◆ SetMaximumNumberOfVoxels()

virtual void vtkSegmentationLabelmapSurfaceMapper::SetMaximumNumberOfVoxels ( vtkIdType )
virtual

The labelmap is downsampled if its distance field would have more voxels than this. Larger values preserve more details, but need more GPU memory: about 11 bytes per voxel while the distance field is computed, 3 bytes per voxel after that. Each mapper instance holds its own distance field and color textures, so the memory is multiplied by the number of mappers that show the same labelmap (the segmentations displayable manager uses one mapper for the opaque segments of a segmentation and one for each distinct translucent opacity). A downsampled voxel is shown if any of its labelmap voxels is shown, which is checked in at most 4 voxels along each axis: if the downsampling factor is above 4 along an axis (labelmap larger than about 1300^3 voxels at the default limit), the block is sampled at evenly spaced voxels and small structures between them may be missed.

◆ SetOutlineColor() [1/2]

virtual void vtkSegmentationLabelmapSurfaceMapper::SetOutlineColor ( double ,
double ,
double  )
virtual

Color of the clipping outline.

◆ SetOutlineColor() [2/2]

virtual void vtkSegmentationLabelmapSurfaceMapper::SetOutlineColor ( double [3])
virtual

◆ SetOutlineWidth()

virtual void vtkSegmentationLabelmapSurfaceMapper::SetOutlineWidth ( double )
virtual

Width of the clipping outline, in pixels.

◆ SetSmoothingFactor()

virtual void vtkSegmentationLabelmapSurfaceMapper::SetSmoothingFactor ( double )
virtual

Smoothing of the surface, between 0 (no smoothing, surface follows voxel boundaries) and 1 (strong smoothing). Same meaning as the "Smoothing factor" conversion parameter of closed surface representation. The distance field is smoothed by a Gaussian (standard deviation is 1.7 * SmoothingFactor times the largest voxel size, the same in all directions in physical space), combined with the result of applying it twice ("twicing"), so that curved surfaces do not shrink and thin structures are preserved. Gaps between segments that are narrower than the standard deviation are filled.

Member Data Documentation

◆ CapClippedSurface

bool vtkSegmentationLabelmapSurfaceMapper::CapClippedSurface { true }
protected

Definition at line 147 of file vtkSegmentationLabelmapSurfaceMapper.h.

◆ CapOpacity

double vtkSegmentationLabelmapSurfaceMapper::CapOpacity { 1.0 }
protected

Definition at line 148 of file vtkSegmentationLabelmapSurfaceMapper.h.

◆ ClippingOutline

bool vtkSegmentationLabelmapSurfaceMapper::ClippingOutline { false }
protected

Definition at line 150 of file vtkSegmentationLabelmapSurfaceMapper.h.

◆ ImageSampleDistance

double vtkSegmentationLabelmapSurfaceMapper::ImageSampleDistance { 1.0 }
protected

Definition at line 146 of file vtkSegmentationLabelmapSurfaceMapper.h.

◆ KeepWhereAnyClippingPlaneKeeps

bool vtkSegmentationLabelmapSurfaceMapper::KeepWhereAnyClippingPlaneKeeps { false }
protected

Definition at line 149 of file vtkSegmentationLabelmapSurfaceMapper.h.

◆ MaximumNumberOfVoxels

vtkIdType vtkSegmentationLabelmapSurfaceMapper::MaximumNumberOfVoxels { 32 * 1024 * 1024 }
protected

Definition at line 153 of file vtkSegmentationLabelmapSurfaceMapper.h.

◆ NumberOfDistanceFieldComputations

int vtkSegmentationLabelmapSurfaceMapper::NumberOfDistanceFieldComputations { 0 }
protected

Definition at line 154 of file vtkSegmentationLabelmapSurfaceMapper.h.

◆ OutlineColor

double vtkSegmentationLabelmapSurfaceMapper::OutlineColor[3] { 0.0, 0.0, 0.0 }
protected

Definition at line 151 of file vtkSegmentationLabelmapSurfaceMapper.h.

◆ OutlineWidth

double vtkSegmentationLabelmapSurfaceMapper::OutlineWidth { 1.0 }
protected

Definition at line 152 of file vtkSegmentationLabelmapSurfaceMapper.h.

◆ SmoothingFactor

double vtkSegmentationLabelmapSurfaceMapper::SmoothingFactor { 0.5 }
protected

Definition at line 145 of file vtkSegmentationLabelmapSurfaceMapper.h.


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