69 #ifndef vtkFixedPointVolumeRayCastMapper_h
70 #define vtkFixedPointVolumeRayCastMapper_h
75 #define VTKKW_FP_SHIFT 15
76 #define VTKKW_FPMM_SHIFT 17
77 #define VTKKW_FP_MASK 0x7fff
78 #define VTKKW_FP_SCALE 32767.0
120 vtkSetMacro( SampleDistance,
float );
121 vtkGetMacro( SampleDistance,
float );
131 vtkSetMacro( InteractiveSampleDistance,
float );
132 vtkGetMacro( InteractiveSampleDistance,
float );
141 vtkSetClampMacro( ImageSampleDistance,
float, 0.1f, 100.0f );
142 vtkGetMacro( ImageSampleDistance,
float );
148 vtkSetClampMacro( MinimumImageSampleDistance,
float, 0.1f, 100.0f );
149 vtkGetMacro( MinimumImageSampleDistance,
float );
155 vtkSetClampMacro( MaximumImageSampleDistance,
float, 0.1f, 100.0f );
156 vtkGetMacro( MaximumImageSampleDistance,
float );
167 vtkSetClampMacro( AutoAdjustSampleDistances,
int, 0, 1 );
168 vtkGetMacro( AutoAdjustSampleDistances,
int );
169 vtkBooleanMacro( AutoAdjustSampleDistances,
int );
180 vtkSetClampMacro( LockSampleDistanceToInputSpacing,
int, 0, 1 );
181 vtkGetMacro( LockSampleDistanceToInputSpacing,
int );
182 vtkBooleanMacro( LockSampleDistanceToInputSpacing,
int );
189 void SetNumberOfThreads(
int num );
190 int GetNumberOfThreads();
196 vtkSetClampMacro( IntermixIntersectingGeometry,
int, 0, 1 );
197 vtkGetMacro( IntermixIntersectingGeometry,
int );
198 vtkBooleanMacro( IntermixIntersectingGeometry,
int );
208 float ComputeRequiredImageSampleDistance(
float desiredTime,
210 float ComputeRequiredImageSampleDistance(
float desiredTime,
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,
232 unsigned short *scalarOpacityTable,
233 unsigned short index,
234 unsigned char color[4] );
235 void LookupDependentColorUC(
unsigned short *colorTable,
236 unsigned short *scalarOpacityTable,
237 unsigned short index[4],
239 unsigned char color[4] );
240 void LookupAndCombineIndependentColorsUC(
241 unsigned short *colorTable[4],
242 unsigned short *scalarOpacityTable[4],
243 unsigned short index[4],
246 unsigned char color[4] );
247 int CheckIfCropped(
unsigned int pos[3] );
257 vtkGetVectorMacro( TableShift,
float, 4 );
258 vtkGetVectorMacro( TableScale,
float, 4 );
259 vtkGetMacro( ShadingRequired,
int );
260 vtkGetMacro( GradientOpacityRequired,
int );
276 void ComputeRayInfo(
int x,
int y,
279 unsigned int *numSteps );
281 void InitializeRayInfo(
vtkVolume *vol );
283 int ShouldUseNearestNeighborInterpolation(
vtkVolume *vol );
294 double *,
double *,
int * );
297 void RenderSubVolume();
301 void CreateCanonicalView(
vtkVolume *volume,
304 double viewDirection[3],
314 {
return this->RetrieveRenderTime( ren, vol ); }
316 {
return this->RetrieveRenderTime( ren ); }
327 vtkSetMacro( FinalColorWindow,
float );
328 vtkGetMacro( FinalColorWindow,
float );
329 vtkSetMacro( FinalColorLevel,
float );
330 vtkGetMacro( FinalColorLevel,
float );
337 vtkGetMacro( FlipMIPComparison,
int );
369 void ComputeMatrices(
double volumeOrigin[3],
370 double volumeSpacing[3],
376 int imageFlag,
int rowBoundsFlag,
377 int volumeExtent[6]);
423 int SavedColorChannels[4];
424 float SavedScalarOpacityDistance[4];
435 unsigned short ColorTable[4][32768*3];
436 unsigned short ScalarOpacityTable[4][32768];
437 unsigned short GradientOpacityTable[4][256];
442 float GradientMagnitudeScale[4];
443 float GradientMagnitudeShift[4];
458 unsigned short DiffuseShadingTable [4][65536*3];
459 unsigned short SpecularShadingTable[4][65536*3];
470 int ClipRayAgainstVolume(
float rayStart[3],
472 float rayDirection[3],
479 void UpdateCroppingRegions();
483 int ClipRayAgainstClippingPlanes(
float rayStart[3],
485 int numClippingPlanes,
486 float *clippingPlanes );
488 unsigned int FixedPointCroppingRegionPlanes[6];
489 unsigned int CroppingRegionMask[27];
494 float GetZBufferValue(
int x,
int y );
503 float ViewToVoxelsArray[16];
504 float WorldToVoxelsArray[16];
505 float VoxelsToWorldArray[16];
507 double CroppingBounds[6];
512 double SavedSpacing[3];
517 int MinMaxVolumeSize[4];
522 void UpdateMinMaxVolume(
vtkVolume *vol );
523 void FillInMaxGradientMagnitudes(
int fullDim[3],
531 void ApplyFinalColorWindowLevel();
557 (0x80000000+static_cast<unsigned int>(dir*
VTKKW_FP_SCALE + 0.5)));
562 out[0] = ((in[0]<0.0)?
566 out[1] = ((in[1]<0.0)?
570 out[2] = ((in[2]<0.0)?
578 if ( increment[0]&0x80000000 )
580 position[0] += (increment[0]&0x7fffffff);
584 position[0] -= increment[0];
586 if ( increment[1]&0x80000000 )
588 position[1] += (increment[1]&0x7fffffff);
592 position[1] -= increment[1];
594 if ( increment[2]&0x80000000 )
596 position[2] += (increment[2]&0x7fffffff);
600 position[2] -= increment[2];
620 unsigned int out[3] )
631 ( mmpos[2]*static_cast<vtkIdType>(
633 mmpos[1]*
static_cast<vtkIdType>(this->MinMaxVolumeSize[0]) +
640 unsigned short maxIdx,
int flip )
644 ( mmpos[2]*static_cast<vtkIdType>(
646 mmpos[1]*
static_cast<vtkIdType>(this->MinMaxVolumeSize[0]) +
657 return ( *(this->
MinMaxVolume + 3*offset + 1) > maxIdx );
667 unsigned short *scalarOpacityTable,
668 unsigned short index,
669 unsigned char color[4] )
671 unsigned short alpha = scalarOpacityTable[
index];
672 color[0] =
static_cast<unsigned char>
674 color[1] =
static_cast<unsigned char>
676 color[2] =
static_cast<unsigned char>
678 color[3] =
static_cast<unsigned char>(alpha>>(
VTKKW_FP_SHIFT - 8));
682 unsigned short *scalarOpacityTable,
683 unsigned short index[4],
685 unsigned char color[4] )
687 unsigned short alpha;
688 switch ( components )
691 alpha = scalarOpacityTable[index[1]];
692 color[0] =
static_cast<unsigned char>
693 ((colorTable[3*index[0] ]*alpha + 0x7fff)>>(2*
VTKKW_FP_SHIFT - 8));
694 color[1] =
static_cast<unsigned char>
695 ((colorTable[3*index[0]+1]*alpha + 0x7fff)>>(2*
VTKKW_FP_SHIFT - 8));
696 color[2] =
static_cast<unsigned char>
697 ((colorTable[3*index[0]+2]*alpha + 0x7fff)>>(2*
VTKKW_FP_SHIFT - 8));
698 color[3] =
static_cast<unsigned char>(alpha>>(
VTKKW_FP_SHIFT - 8));
701 alpha = scalarOpacityTable[index[3]];
702 color[0] =
static_cast<unsigned char>((index[0]*alpha + 0x7fff)>>
VTKKW_FP_SHIFT );
703 color[1] =
static_cast<unsigned char>((index[1]*alpha + 0x7fff)>>
VTKKW_FP_SHIFT );
704 color[2] =
static_cast<unsigned char>((index[2]*alpha + 0x7fff)>>
VTKKW_FP_SHIFT );
705 color[3] =
static_cast<unsigned char>(alpha>>(
VTKKW_FP_SHIFT - 8));
712 unsigned short *scalarOpacityTable[4],
713 unsigned short index[4],
716 unsigned char color[4] )
718 unsigned int tmp[4] = {0,0,0,0};
720 for (
int i = 0; i < components; i++ )
722 unsigned short alpha =
static_cast<unsigned short>(
static_cast<float>(scalarOpacityTable[i][index[i]])*weights[i]);
723 tmp[0] +=
static_cast<unsigned char>(((colorTable[i][3*index[i] ])*alpha + 0x7fff)>>(2*
VTKKW_FP_SHIFT - 8));
724 tmp[1] +=
static_cast<unsigned char>(((colorTable[i][3*index[i]+1])*alpha + 0x7fff)>>(2*
VTKKW_FP_SHIFT - 8));
725 tmp[2] +=
static_cast<unsigned char>(((colorTable[i][3*index[i]+2])*alpha + 0x7fff)>>(2*
VTKKW_FP_SHIFT - 8));
726 tmp[3] +=
static_cast<unsigned char>(alpha>>(
VTKKW_FP_SHIFT - 8));
729 color[0] =
static_cast<unsigned char>((tmp[0]>255)?(255):(tmp[0]));
730 color[1] =
static_cast<unsigned char>((tmp[1]>255)?(255):(tmp[1]));
731 color[2] =
static_cast<unsigned char>((tmp[2]>255)?(255):(tmp[2]));
732 color[3] =
static_cast<unsigned char>((tmp[3]>255)?(255):(tmp[3]));
unsigned short * GetDiffuseShadingTable(int c)
unsigned short ** GetGradientNormal()
vtkTransform * VoxelsTransform
vtkDataArray * CurrentScalars
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.
unsigned int CroppingRegionMask[27]
void FixedPointIncrement(unsigned int position[3], unsigned int increment[3])
Use finite differences to estimate gradient.
Defines a 1D piecewise function.
void PrintSelf(ostream &os, vtkIndent indent)
vtkVolume ** RenderVolumeTable
#define VTKRENDERINGVOLUME_EXPORT
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
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)
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
virtual void Render(vtkRenderer *ren, vtkVolume *vol)=0
int CheckMIPMinMaxVolumeFlag(unsigned int pos[3], int c, unsigned short maxIdx, int flip)
float * TransformedClippingPlanes
vtkWeakPointer< vtkRenderWindow > RenderWindow
A helper that generates composite images for the volume ray cast mapper.
vtkImageData * SavedParametersInput
vtkTransform * PerspectiveTransform
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 int FixedPointCroppingRegionPlanes[6]
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)
virtual void ReleaseGraphicsResources(vtkWindow *)
unsigned short * GetGradientOpacityTable(int c)
vtkFixedPointVolumeRayCastCompositeGOShadeHelper * CompositeGOShadeHelper
float GetEstimatedRenderTime(vtkRenderer *ren)
int NumberOfGradientSlices
static vtkAlgorithm * New()
vtkRayCastImageDisplayHelper * ImageDisplayHelper
int NumTransformedClippingPlanes
vtkFiniteDifferenceGradientEstimator * GradientEstimator
unsigned int ToFixedPointPosition(float val)
vtkImageData * MinMaxVolumeCache
vtkMatrix4x4 * VoxelsToViewMatrix
float OldImageSampleDistance
void GetFloatTripleFromPointer(float v[3], float *ptr)
helper class for a ray cast image