61 #ifndef vtkFixedPointVolumeRayCastMapper_h 62 #define vtkFixedPointVolumeRayCastMapper_h 64 #include "vtkRenderingVolumeModule.h" 67 #define VTKKW_FP_SHIFT 15 68 #define VTKKW_FPMM_SHIFT 17 69 #define VTKKW_FP_MASK 0x7fff 70 #define VTKKW_FP_SCALE 32767.0 113 vtkGetMacro( SampleDistance,
float );
125 vtkGetMacro( InteractiveSampleDistance,
float );
136 vtkSetClampMacro( ImageSampleDistance,
float, 0.1f, 100.0f );
137 vtkGetMacro( ImageSampleDistance,
float );
145 vtkSetClampMacro( MinimumImageSampleDistance,
float, 0.1f, 100.0f );
146 vtkGetMacro( MinimumImageSampleDistance,
float );
154 vtkSetClampMacro( MaximumImageSampleDistance,
float, 0.1f, 100.0f );
155 vtkGetMacro( MaximumImageSampleDistance,
float );
168 vtkSetClampMacro( AutoAdjustSampleDistances,
int, 0, 1 );
169 vtkGetMacro( AutoAdjustSampleDistances,
int );
182 vtkSetClampMacro( LockSampleDistanceToInputSpacing,
int, 0, 1 );
183 vtkGetMacro( LockSampleDistanceToInputSpacing,
int );
193 void SetNumberOfThreads(
int num );
194 int GetNumberOfThreads();
202 vtkSetClampMacro( IntermixIntersectingGeometry,
int, 0, 1 );
203 vtkGetMacro( IntermixIntersectingGeometry,
int );
215 float ComputeRequiredImageSampleDistance(
float desiredTime,
217 float ComputeRequiredImageSampleDistance(
float desiredTime,
228 unsigned int ToFixedPointPosition(
float val );
229 void ToFixedPointPosition(
float in[3],
unsigned int out[3] );
230 unsigned int ToFixedPointDirection(
float dir );
231 void ToFixedPointDirection(
float in[3],
unsigned int out[3] );
232 void FixedPointIncrement(
unsigned int position[3],
unsigned int increment[3] );
233 void GetFloatTripleFromPointer(
float v[3],
float *ptr );
234 void GetUIntTripleFromPointer(
unsigned int v[3],
unsigned int *ptr );
235 void ShiftVectorDown(
unsigned int in[3],
unsigned int out[3] );
236 int CheckMinMaxVolumeFlag(
unsigned int pos[3],
int c );
237 int CheckMIPMinMaxVolumeFlag(
unsigned int pos[3],
int c,
unsigned short maxIdx,
int flip );
239 void LookupColorUC(
unsigned short *colorTable,
240 unsigned short *scalarOpacityTable,
241 unsigned short index,
242 unsigned char color[4] );
243 void LookupDependentColorUC(
unsigned short *colorTable,
244 unsigned short *scalarOpacityTable,
245 unsigned short index[4],
247 unsigned char color[4] );
248 void LookupAndCombineIndependentColorsUC(
249 unsigned short *colorTable[4],
250 unsigned short *scalarOpacityTable[4],
251 unsigned short index[4],
254 unsigned char color[4] );
255 int CheckIfCropped(
unsigned int pos[3] );
263 vtkGetVectorMacro( TableShift,
float, 4 );
264 vtkGetVectorMacro( TableScale,
float, 4 );
265 vtkGetMacro( ShadingRequired,
int );
266 vtkGetMacro( GradientOpacityRequired,
int );
282 void ComputeRayInfo(
int x,
int y,
285 unsigned int *numSteps );
287 void InitializeRayInfo(
vtkVolume *vol );
289 int ShouldUseNearestNeighborInterpolation(
vtkVolume *vol );
302 double *,
double *,
int * );
305 void RenderSubVolume();
309 void CreateCanonicalView(
vtkVolume *volume,
312 double viewDirection[3],
323 {
return this->RetrieveRenderTime( ren, vol ); }
325 {
return this->RetrieveRenderTime( ren ); }
343 vtkGetMacro( FinalColorWindow,
float );
345 vtkGetMacro( FinalColorLevel,
float );
352 vtkGetMacro( FlipMIPComparison,
int );
386 void ComputeMatrices(
double volumeOrigin[3],
387 double volumeSpacing[3],
393 int imageFlag,
int rowBoundsFlag,
394 int volumeExtent[6]);
440 int SavedColorChannels[4];
441 float SavedScalarOpacityDistance[4];
452 unsigned short ColorTable[4][32768*3];
453 unsigned short ScalarOpacityTable[4][32768];
454 unsigned short GradientOpacityTable[4][256];
459 float GradientMagnitudeScale[4];
460 float GradientMagnitudeShift[4];
475 unsigned short DiffuseShadingTable [4][65536*3];
476 unsigned short SpecularShadingTable[4][65536*3];
487 int ClipRayAgainstVolume(
float rayStart[3],
489 float rayDirection[3],
496 void UpdateCroppingRegions();
500 int ClipRayAgainstClippingPlanes(
float rayStart[3],
502 int numClippingPlanes,
503 float *clippingPlanes );
505 unsigned int FixedPointCroppingRegionPlanes[6];
506 unsigned int CroppingRegionMask[27];
511 float GetZBufferValue(
int x,
int y );
520 float ViewToVoxelsArray[16];
521 float WorldToVoxelsArray[16];
522 float VoxelsToWorldArray[16];
524 double CroppingBounds[6];
529 double SavedSpacing[3];
534 int MinMaxVolumeSize[4];
539 void UpdateMinMaxVolume(
vtkVolume *vol );
540 void FillInMaxGradientMagnitudes(
int fullDim[3],
548 void ApplyFinalColorWindowLevel();
574 (0x80000000+static_cast<unsigned int>(dir*
VTKKW_FP_SCALE + 0.5)));
579 out[0] = ((in[0]<0.0)?
583 out[1] = ((in[1]<0.0)?
587 out[2] = ((in[2]<0.0)?
595 if ( increment[0]&0x80000000 )
597 position[0] += (increment[0]&0x7fffffff);
601 position[0] -= increment[0];
603 if ( increment[1]&0x80000000 )
605 position[1] += (increment[1]&0x7fffffff);
609 position[1] -= increment[1];
611 if ( increment[2]&0x80000000 )
613 position[2] += (increment[2]&0x7fffffff);
617 position[2] -= increment[2];
637 unsigned int out[3] )
647 static_cast<vtkIdType>(this->MinMaxVolumeSize[3]) *
648 ( mmpos[2]*static_cast<vtkIdType>(
649 this->MinMaxVolumeSize[0]*this->MinMaxVolumeSize[1]) +
650 mmpos[1]*
static_cast<vtkIdType>(this->MinMaxVolumeSize[0]) +
653 return ((*(this->MinMaxVolume + 3*offset + 2))&0x00ff);
657 unsigned short maxIdx,
int flip )
660 static_cast<vtkIdType>(this->MinMaxVolumeSize[3]) *
661 ( mmpos[2]*static_cast<vtkIdType>(
662 this->MinMaxVolumeSize[0]*this->MinMaxVolumeSize[1]) +
663 mmpos[1]*
static_cast<vtkIdType>(this->MinMaxVolumeSize[0]) +
666 if ( (*(this->MinMaxVolume + 3*offset + 2)&0x00ff) )
670 return ( *(this->MinMaxVolume + 3*offset) < maxIdx );
674 return ( *(this->MinMaxVolume + 3*offset + 1) > maxIdx );
684 unsigned short *scalarOpacityTable,
685 unsigned short index,
686 unsigned char color[4] )
688 unsigned short alpha = scalarOpacityTable[
index];
689 color[0] =
static_cast<unsigned char> 691 color[1] =
static_cast<unsigned char> 693 color[2] =
static_cast<unsigned char> 695 color[3] =
static_cast<unsigned char>(alpha>>(
VTKKW_FP_SHIFT - 8));
699 unsigned short *scalarOpacityTable,
700 unsigned short index[4],
702 unsigned char color[4] )
704 unsigned short alpha;
705 switch ( components )
708 alpha = scalarOpacityTable[index[1]];
709 color[0] =
static_cast<unsigned char> 710 ((colorTable[3*index[0] ]*alpha + 0x7fff)>>(2*
VTKKW_FP_SHIFT - 8));
711 color[1] =
static_cast<unsigned char> 712 ((colorTable[3*index[0]+1]*alpha + 0x7fff)>>(2*
VTKKW_FP_SHIFT - 8));
713 color[2] =
static_cast<unsigned char> 714 ((colorTable[3*index[0]+2]*alpha + 0x7fff)>>(2*
VTKKW_FP_SHIFT - 8));
715 color[3] =
static_cast<unsigned char>(alpha>>(
VTKKW_FP_SHIFT - 8));
718 alpha = scalarOpacityTable[index[3]];
719 color[0] =
static_cast<unsigned char>((index[0]*alpha + 0x7fff)>>
VTKKW_FP_SHIFT );
720 color[1] =
static_cast<unsigned char>((index[1]*alpha + 0x7fff)>>
VTKKW_FP_SHIFT );
721 color[2] =
static_cast<unsigned char>((index[2]*alpha + 0x7fff)>>
VTKKW_FP_SHIFT );
722 color[3] =
static_cast<unsigned char>(alpha>>(
VTKKW_FP_SHIFT - 8));
729 unsigned short *scalarOpacityTable[4],
730 unsigned short index[4],
733 unsigned char color[4] )
735 unsigned int tmp[4] = {0,0,0,0};
737 for (
int i = 0; i < components; i++ )
739 unsigned short alpha =
static_cast<unsigned short>(
static_cast<float>(scalarOpacityTable[i][index[i]])*weights[i]);
740 tmp[0] +=
static_cast<unsigned char>(((colorTable[i][3*index[i] ])*alpha + 0x7fff)>>(2*
VTKKW_FP_SHIFT - 8));
741 tmp[1] +=
static_cast<unsigned char>(((colorTable[i][3*index[i]+1])*alpha + 0x7fff)>>(2*
VTKKW_FP_SHIFT - 8));
742 tmp[2] +=
static_cast<unsigned char>(((colorTable[i][3*index[i]+2])*alpha + 0x7fff)>>(2*
VTKKW_FP_SHIFT - 8));
743 tmp[3] +=
static_cast<unsigned char>(alpha>>(
VTKKW_FP_SHIFT - 8));
746 color[0] =
static_cast<unsigned char>((tmp[0]>255)?(255):(tmp[0]));
747 color[1] =
static_cast<unsigned char>((tmp[1]>255)?(255):(tmp[1]));
748 color[2] =
static_cast<unsigned char>((tmp[2]>255)?(255):(tmp[2]));
749 color[3] =
static_cast<unsigned char>((tmp[3]>255)?(255):(tmp[3]));
757 if ( pos[2] < this->FixedPointCroppingRegionPlanes[4] )
761 else if ( pos[2] > this->FixedPointCroppingRegionPlanes[5] )
770 if ( pos[1] >= this->FixedPointCroppingRegionPlanes[2] )
772 if ( pos[1] > this->FixedPointCroppingRegionPlanes[3] )
782 if ( pos[0] >= this->FixedPointCroppingRegionPlanes[0] )
784 if ( pos[0] > this->FixedPointCroppingRegionPlanes[1] )
795 &this->CroppingRegionMask[idx]);
unsigned short * GetDiffuseShadingTable(int c)
unsigned short ** GetGradientNormal()
vtkTransform * VoxelsTransform
vtkDataArray * CurrentScalars
int CroppingRegionFlags
Cropping variables, and a method for converting the world coordinate cropping region planes to voxel ...
float MinimumImageSampleDistance
void ShiftVectorDown(unsigned int in[3], unsigned int out[3])
vtkFixedPointVolumeRayCastMIPHelper * MIPHelper
vtkTimeStamp SavedGradientsMTime
represents a volume (data & properties) in a rendered scene
vtkFixedPointVolumeRayCastCompositeShadeHelper * CompositeShadeHelper
vtkVolumeRayCastSpaceLeapingImageFilter * SpaceLeapFilter
unsigned char ** GradientMagnitude
Abstract class for a volume mapper.
vtkMatrix4x4 * VoxelsToWorldMatrix
encode a direction into a one or two byte value
represent and manipulate 4x4 transformation matrices
A helper that generates composite images for the volume ray cast mapper.
void FixedPointIncrement(unsigned int position[3], unsigned int increment[3])
Use finite differences to estimate gradient.
Defines a 1D piecewise function.
vtkVolume ** RenderVolumeTable
VTK_THREAD_RETURN_TYPE vtkFPVRCMSwitchOnDataType(void *arg)
A class for performing multithreaded execution.
record modification and/or execution time
maintain a list of planes
vtkMatrix4x4 * PerspectiveMatrix
unsigned char ** GetGradientMagnitude()
VTK_THREAD_RETURN_TYPE FixedPointVolumeRayCastMapper_CastRays(void *arg)
abstract specification for renderers
void GetUIntTripleFromPointer(unsigned int v[3], unsigned int *ptr)
unsigned short * MinMaxVolume
int IntermixIntersectingGeometry
unsigned short * ContiguousGradientNormal
vtkMatrix4x4 * ViewToVoxelsMatrix
unsigned short ** GradientNormal
A helper that generates MIP images for the volume ray cast mapper.
vtkDirectionEncoder * DirectionEncoder
vtkImageData * SavedGradientsInput
helper class that draws the image to the screen
void Render(vtkRenderer *ren, vtkVolume *vol) override=0
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
float MinimumViewDistance
float InteractiveSampleDistance
float ImageSampleDistance
vtkEncodedGradientShader * GradientShader
unsigned short * GetScalarOpacityTable(int c)
vtkMatrix4x4 * ViewToWorldMatrix
Builds the space leaping data structure.
Timer support and logging.
window superclass for vtkRenderWindow
int AutoAdjustSampleDistances
int CheckIfCropped(unsigned int pos[3])
vtkFixedPointVolumeRayCastCompositeGOHelper * CompositeGOHelper
vtkTransform * VoxelsToViewTransform
vtkFixedPointRayCastImage * RayCastImage
unsigned short * GetColorTable(int c)
vtkMatrix4x4 * VolumeMatrix
vtkDataArray * PreviousScalars
a simple class to control print indentation
int LockSampleDistanceToInputSpacing
vtkImageData * SavedMinMaxInput
float GetEstimatedRenderTime(vtkRenderer *ren, vtkVolume *vol)
Get an estimate of the rendering time for a given volume / renderer.
vtkRenderer ** RenderRendererTable
topologically and geometrically regular array of data
void LookupDependentColorUC(unsigned short *colorTable, unsigned short *scalarOpacityTable, unsigned short index[4], int components, unsigned char color[4])
abstract superclass for arrays of numeric data
float SavedSampleDistance
vtkMatrix4x4 * WorldToVoxelsMatrix
Compute shading tables for encoded normals.
int GradientOpacityRequired
vtkMultiThreader * Threader
int CheckMIPMinMaxVolumeFlag(unsigned int pos[3], int c, unsigned short maxIdx, int flip)
float * TransformedClippingPlanes
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
A helper that generates composite images for the volume ray cast mapper.
vtkImageData * SavedParametersInput
vtkTransform * PerspectiveTransform
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
unsigned int ToFixedPointDirection(float dir)
A helper that generates composite images for the volume ray cast mapper.
A fixed point mapper for volumes.
Defines a transfer function for mapping a property to an RGB color value.
create a window for renderers to draw into
vtkFixedPointVolumeRayCastCompositeHelper * CompositeHelper
A helper that generates composite images for the volume ray cast mapper.
vtkRenderWindow * RenderWindow
#define VTK_THREAD_RETURN_TYPE
unsigned char * ContiguousGradientMagnitude
float MaximumImageSampleDistance
void LookupAndCombineIndependentColorsUC(unsigned short *colorTable[4], unsigned short *scalarOpacityTable[4], unsigned short index[4], float weights[4], int components, unsigned char color[4])
int CheckMinMaxVolumeFlag(unsigned int pos[3], int c)
vtkTimeStamp SavedParametersMTime
void LookupColorUC(unsigned short *colorTable, unsigned short *scalarOpacityTable, unsigned short index, unsigned char color[4])
unsigned short * GetSpecularShadingTable(int c)
unsigned short * GetGradientOpacityTable(int c)
vtkFixedPointVolumeRayCastCompositeGOShadeHelper * CompositeGOShadeHelper
float GetEstimatedRenderTime(vtkRenderer *ren)
int NumberOfGradientSlices
static vtkAlgorithm * New()
vtkRayCastImageDisplayHelper * ImageDisplayHelper
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
int NumTransformedClippingPlanes
vtkFiniteDifferenceGradientEstimator * GradientEstimator
unsigned int ToFixedPointPosition(float val)
vtkImageData * MinMaxVolumeCache
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkMatrix4x4 * VoxelsToViewMatrix
float OldImageSampleDistance
void GetFloatTripleFromPointer(float v[3], float *ptr)
helper class for a ray cast image