56 #ifndef vtkFixedPointVolumeRayCastMapper_h
57 #define vtkFixedPointVolumeRayCastMapper_h
59 #include "vtkRenderingVolumeModule.h"
62 #define VTKKW_FP_SHIFT 15
63 #define VTKKW_FPMM_SHIFT 17
64 #define VTKKW_FP_MASK 0x7fff
65 #define VTKKW_FP_SCALE 32767.0
107 vtkSetMacro(SampleDistance,
float);
108 vtkGetMacro(SampleDistance,
float);
119 vtkSetMacro(InteractiveSampleDistance,
float);
120 vtkGetMacro(InteractiveSampleDistance,
float);
131 vtkSetClampMacro(ImageSampleDistance,
float, 0.1f, 100.0f);
132 vtkGetMacro(ImageSampleDistance,
float);
140 vtkSetClampMacro(MinimumImageSampleDistance,
float, 0.1f, 100.0f);
141 vtkGetMacro(MinimumImageSampleDistance,
float);
149 vtkSetClampMacro(MaximumImageSampleDistance,
float, 0.1f, 100.0f);
150 vtkGetMacro(MaximumImageSampleDistance,
float);
177 vtkSetClampMacro(LockSampleDistanceToInputSpacing,
vtkTypeBool, 0, 1);
197 vtkSetClampMacro(IntermixIntersectingGeometry,
vtkTypeBool, 0, 1);
220 unsigned int ToFixedPointPosition(
float val);
221 void ToFixedPointPosition(
float in[3],
unsigned int out[3]);
222 unsigned int ToFixedPointDirection(
float dir);
223 void ToFixedPointDirection(
float in[3],
unsigned int out[3]);
224 void FixedPointIncrement(
unsigned int position[3],
unsigned int increment[3]);
225 void GetFloatTripleFromPointer(
float v[3],
float* ptr);
226 void GetUIntTripleFromPointer(
unsigned int v[3],
unsigned int* ptr);
227 void ShiftVectorDown(
unsigned int in[3],
unsigned int out[3]);
228 int CheckMinMaxVolumeFlag(
unsigned int pos[3],
int c);
229 int CheckMIPMinMaxVolumeFlag(
unsigned int pos[3],
int c,
unsigned short maxIdx,
int flip);
231 void LookupColorUC(
unsigned short* colorTable,
unsigned short* scalarOpacityTable,
232 unsigned short index,
unsigned char color[4]);
233 void LookupDependentColorUC(
unsigned short* colorTable,
unsigned short* scalarOpacityTable,
234 unsigned short index[4],
int components,
unsigned char color[4]);
235 void LookupAndCombineIndependentColorsUC(
unsigned short* colorTable[4],
236 unsigned short* scalarOpacityTable[4],
unsigned short index[4],
float weights[4],
237 int components,
unsigned char color[4]);
238 int CheckIfCropped(
unsigned int pos[3]);
246 vtkGetVectorMacro(TableShift,
float, 4);
247 vtkGetVectorMacro(TableScale,
float, 4);
248 vtkGetMacro(ShadingRequired,
int);
249 vtkGetMacro(GradientOpacityRequired,
int);
265 int x,
int y,
unsigned int pos[3],
unsigned int dir[3],
unsigned int* numSteps);
289 double viewDirection[3],
double viewUp[3]);
299 return this->RetrieveRenderTime(ren, vol);
317 vtkSetMacro(FinalColorWindow,
float);
318 vtkGetMacro(FinalColorWindow,
float);
319 vtkSetMacro(FinalColorLevel,
float);
320 vtkGetMacro(FinalColorLevel,
float);
326 vtkGetMacro(FlipMIPComparison,
int);
360 void ComputeMatrices(
double volumeOrigin[3],
double volumeSpacing[3],
int volumeExtent[6],
409 int SavedColorChannels[4];
410 float SavedScalarOpacityDistance[4];
420 unsigned short ColorTable[4][32768 * 3];
421 unsigned short ScalarOpacityTable[4][32768];
422 unsigned short GradientOpacityTable[4][256];
427 float GradientMagnitudeScale[4];
428 float GradientMagnitudeShift[4];
443 unsigned short DiffuseShadingTable[4][65536 * 3];
444 unsigned short SpecularShadingTable[4][65536 * 3];
456 float rayStart[3],
float rayEnd[3],
float rayDirection[3],
double bounds[6]);
466 float rayStart[3],
float rayEnd[3],
int numClippingPlanes,
float* clippingPlanes);
468 unsigned int FixedPointCroppingRegionPlanes[6];
469 unsigned int CroppingRegionMask[27];
483 float ViewToVoxelsArray[16];
484 float WorldToVoxelsArray[16];
485 float VoxelsToWorldArray[16];
487 double CroppingBounds[6];
492 double SavedSpacing[3];
496 int MinMaxVolumeSize[4];
537 float in[3],
unsigned int out[3])
539 out[0] = ((in[0] < 0.0) ? (
static_cast<unsigned int>(-in[0] *
VTKKW_FP_SCALE + 0.5))
540 : (0x80000000 +
static_cast<unsigned int>(in[0] *
VTKKW_FP_SCALE + 0.5)));
541 out[1] = ((in[1] < 0.0) ? (
static_cast<unsigned int>(-in[1] *
VTKKW_FP_SCALE + 0.5))
542 : (0x80000000 +
static_cast<unsigned int>(in[1] *
VTKKW_FP_SCALE + 0.5)));
543 out[2] = ((in[2] < 0.0) ? (
static_cast<unsigned int>(-in[2] *
VTKKW_FP_SCALE + 0.5))
544 : (0x80000000 +
static_cast<unsigned int>(in[2] *
VTKKW_FP_SCALE + 0.5)));
548 unsigned int position[3],
unsigned int increment[3])
550 if (increment[0] & 0x80000000)
552 position[0] += (increment[0] & 0x7fffffff);
558 if (increment[1] & 0x80000000)
560 position[1] += (increment[1] & 0x7fffffff);
566 if (increment[2] & 0x80000000)
568 position[2] += (increment[2] & 0x7fffffff);
584 unsigned int v[3],
unsigned int* ptr)
592 unsigned int in[3],
unsigned int out[3])
603 mmpos[1] *
static_cast<vtkIdType>(this->MinMaxVolumeSize[0]) + mmpos[0]) +
606 return ((*(this->
MinMaxVolume + 3 * offset + 2)) & 0x00ff);
610 unsigned int mmpos[3],
int c,
unsigned short maxIdx,
int flip)
614 mmpos[1] *
static_cast<vtkIdType>(this->MinMaxVolumeSize[0]) + mmpos[0]) +
625 return (*(this->
MinMaxVolume + 3 * offset + 1) > maxIdx);
635 unsigned short* scalarOpacityTable,
unsigned short index,
unsigned char color[4])
637 unsigned short alpha = scalarOpacityTable[
index];
638 color[0] =
static_cast<unsigned char>(
640 color[1] =
static_cast<unsigned char>(
642 color[2] =
static_cast<unsigned char>(
648 unsigned short* scalarOpacityTable,
unsigned short index[4],
int components,
649 unsigned char color[4])
651 unsigned short alpha;
656 color[0] =
static_cast<unsigned char>(
658 color[1] =
static_cast<unsigned char>(
660 color[2] =
static_cast<unsigned char>(
675 unsigned short* colorTable[4],
unsigned short* scalarOpacityTable[4],
unsigned short index[4],
676 float weights[4],
int components,
unsigned char color[4])
678 unsigned int tmp[4] = { 0, 0, 0, 0 };
680 for (
int i = 0; i < components; i++)
682 unsigned short alpha =
683 static_cast<unsigned short>(
static_cast<float>(scalarOpacityTable[i][
index[i]]) * weights[i]);
684 tmp[0] +=
static_cast<unsigned char>(
686 tmp[1] +=
static_cast<unsigned char>(
688 tmp[2] +=
static_cast<unsigned char>(
693 color[0] =
static_cast<unsigned char>((tmp[0] > 255) ? (255) : (tmp[0]));
694 color[1] =
static_cast<unsigned char>((tmp[1] > 255) ? (255) : (tmp[1]));
695 color[2] =
static_cast<unsigned char>((tmp[2] > 255) ? (255) : (tmp[2]));
696 color[3] =
static_cast<unsigned char>((tmp[3] > 255) ? (255) : (tmp[3]));
Defines a transfer function for mapping a property to an RGB color value.
abstract superclass for arrays of numeric data
encode a direction into a one or two byte value
Compute shading tables for encoded normals.
Use finite differences to estimate gradient.
helper class for a ray cast image
A helper that generates composite images for the volume ray cast mapper.
A helper that generates composite images for the volume ray cast mapper.
A helper that generates composite images for the volume ray cast mapper.
A helper that generates composite images for the volume ray cast mapper.
A helper that generates MIP images for the volume ray cast mapper.
A fixed point mapper for volumes.
void SetRayCastImage(vtkFixedPointRayCastImage *)
Set / Get the underlying image object.
vtkRayCastImageDisplayHelper * ImageDisplayHelper
vtkMatrix4x4 * ViewToWorldMatrix
int ClipRayAgainstVolume(float rayStart[3], float rayEnd[3], float rayDirection[3], double bounds[6])
vtkMatrix4x4 * ViewToVoxelsMatrix
vtkEncodedGradientShader * GradientShader
vtkFixedPointVolumeRayCastMIPHelper * MIPHelper
vtkFixedPointVolumeRayCastCompositeGOHelper * CompositeGOHelper
float OldImageSampleDistance
int ShouldUseNearestNeighborInterpolation(vtkVolume *vol)
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
vtkMultiThreader * Threader
unsigned short * GetDiffuseShadingTable(int c)
float RetrieveRenderTime(vtkRenderer *ren)
float MaximumImageSampleDistance
float ImageSampleDistance
vtkTransform * VoxelsTransform
unsigned short * ContiguousGradientNormal
float MinimumImageSampleDistance
vtkFixedPointVolumeRayCastMapper()
vtkImageData * SavedMinMaxInput
int ClipRayAgainstClippingPlanes(float rayStart[3], float rayEnd[3], int numClippingPlanes, float *clippingPlanes)
void UpdateCroppingRegions()
void GetFloatTripleFromPointer(float v[3], float *ptr)
unsigned short * MinMaxVolume
unsigned short * GetSpecularShadingTable(int c)
unsigned char ** GradientMagnitude
void CaptureZBuffer(vtkRenderer *ren)
void ApplyFinalColorWindowLevel()
float ComputeRequiredImageSampleDistance(float desiredTime, vtkRenderer *ren)
What is the image sample distance required to achieve the desired time? A version of this method is p...
void ComputeRayInfo(int x, int y, unsigned int pos[3], unsigned int dir[3], unsigned int *numSteps)
vtkFixedPointVolumeRayCastCompositeShadeHelper * CompositeShadeHelper
vtkMatrix4x4 * VoxelsToWorldMatrix
vtkTimeStamp SavedGradientsMTime
vtkRenderWindow * RenderWindow
float MinimumViewDistance
void StoreRenderTime(vtkRenderer *ren, vtkVolume *vol, float t)
vtkFiniteDifferenceGradientEstimator * GradientEstimator
vtkFixedPointVolumeRayCastCompositeGOShadeHelper * CompositeGOShadeHelper
vtkTypeBool IntermixIntersectingGeometry
vtkTypeBool AutoAdjustSampleDistances
vtkImageData * MinMaxVolumeCache
float GetZBufferValue(int x, int y)
void DisplayRenderedImage(vtkRenderer *, vtkVolume *)
unsigned short * GetScalarOpacityTable(int c)
void FillInMaxGradientMagnitudes(int fullDim[3], int smallDim[3])
unsigned int ToFixedPointDirection(float dir)
vtkMatrix4x4 * VolumeMatrix
void InitializeRayInfo(vtkVolume *vol)
void SetNumberOfThreads(int num)
Set/Get the number of threads to use.
vtkImageData * SavedParametersInput
void Render(vtkRenderer *, vtkVolume *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Initialize rendering for this volume.
void ComputeGradients(vtkVolume *vol)
int UpdateShadingTable(vtkRenderer *ren, vtkVolume *vol)
void GetUIntTripleFromPointer(unsigned int v[3], unsigned int *ptr)
float ComputeRequiredImageSampleDistance(float desiredTime, vtkRenderer *ren, vtkVolume *vol)
~vtkFixedPointVolumeRayCastMapper() override
float SavedSampleDistance
float GetEstimatedRenderTime(vtkRenderer *ren, vtkVolume *vol)
Get an estimate of the rendering time for a given volume / renderer.
float RetrieveRenderTime(vtkRenderer *ren, vtkVolume *vol)
int GradientOpacityRequired
int CheckMinMaxVolumeFlag(unsigned int pos[3], int c)
vtkFixedPointVolumeRayCastCompositeHelper * CompositeHelper
vtkTransform * PerspectiveTransform
unsigned int ToFixedPointPosition(float val)
unsigned short * GetColorTable(int c)
int CheckMIPMinMaxVolumeFlag(unsigned int pos[3], int c, unsigned short maxIdx, int flip)
float GetEstimatedRenderTime(vtkRenderer *ren)
unsigned char ** GetGradientMagnitude()
vtkDirectionEncoder * DirectionEncoder
vtkMatrix4x4 * PerspectiveMatrix
unsigned short * GetGradientOpacityTable(int c)
float InteractiveSampleDistance
friend VTK_THREAD_RETURN_TYPE vtkFPVRCMSwitchOnDataType(void *arg)
void PerSubVolumeInitialization(vtkRenderer *, vtkVolume *, int)
vtkImageData * SavedGradientsInput
vtkTimeStamp SavedParametersMTime
unsigned short ** GradientNormal
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void LookupColorUC(unsigned short *colorTable, unsigned short *scalarOpacityTable, unsigned short index, unsigned char color[4])
vtkTransform * VoxelsToViewTransform
int ComputeRowBounds(vtkRenderer *ren, int imageFlag, int rowBoundsFlag, int volumeExtent[6])
void FixedPointIncrement(unsigned int position[3], unsigned int increment[3])
void LookupAndCombineIndependentColorsUC(unsigned short *colorTable[4], unsigned short *scalarOpacityTable[4], unsigned short index[4], float weights[4], int components, unsigned char color[4])
vtkMatrix4x4 * WorldToVoxelsMatrix
vtkVolumeRayCastSpaceLeapingImageFilter * SpaceLeapFilter
void PerVolumeInitialization(vtkRenderer *, vtkVolume *)
static vtkFixedPointVolumeRayCastMapper * New()
void CreateCanonicalView(vtkVolume *volume, vtkImageData *image, int blend_mode, double viewDirection[3], double viewUp[3])
int PerImageInitialization(vtkRenderer *, vtkVolume *, int, double *, double *, int *)
unsigned int FixedPointCroppingRegionPlanes[6]
vtkFixedPointRayCastImage * RayCastImage
float * TransformedClippingPlanes
vtkVolume ** RenderVolumeTable
void UpdateMinMaxVolume(vtkVolume *vol)
friend VTK_THREAD_RETURN_TYPE FixedPointVolumeRayCastMapper_CastRays(void *arg)
vtkDataArray * PreviousScalars
void ComputeMatrices(double volumeOrigin[3], double volumeSpacing[3], int volumeExtent[6], vtkRenderer *ren, vtkVolume *vol)
unsigned short ** GetGradientNormal()
vtkRenderer ** RenderRendererTable
void ShiftVectorDown(unsigned int in[3], unsigned int out[3])
int UpdateColorTable(vtkVolume *vol)
int NumTransformedClippingPlanes
unsigned char * ContiguousGradientMagnitude
int UpdateGradients(vtkVolume *vol)
vtkDataArray * CurrentScalars
vtkTypeBool LockSampleDistanceToInputSpacing
unsigned int CroppingRegionMask[27]
void LookupDependentColorUC(unsigned short *colorTable, unsigned short *scalarOpacityTable, unsigned short index[4], int components, unsigned char color[4])
int CheckIfCropped(unsigned int pos[3])
int NumberOfGradientSlices
vtkMatrix4x4 * VoxelsToViewMatrix
topologically and geometrically regular array of data
a simple class to control print indentation
represent and manipulate 4x4 transformation matrices
A class for performing multithreaded execution.
Defines a 1D piecewise function.
maintain a list of planes
helper class that draws the image to the screen
create a window for renderers to draw into
abstract specification for renderers
record modification and/or execution time
Timer support and logging.
Abstract class for a volume mapper.
Builds the space leaping data structure.
represents a volume (data & properties) in a rendered scene
window superclass for vtkRenderWindow
VTK_THREAD_RETURN_TYPE vtkFPVRCMSwitchOnDataType(void *arg)
VTK_THREAD_RETURN_TYPE FixedPointVolumeRayCastMapper_CastRays(void *arg)
#define VTK_THREAD_RETURN_TYPE