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 181 vtkGetMacro( LockSampleDistanceToInputSpacing,
int );
189 void SetNumberOfThreads(
int num );
190 int GetNumberOfThreads();
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] );
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 ); }
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];
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] )
630 static_cast<vtkIdType>(this->MinMaxVolumeSize[3]) *
631 ( mmpos[2]*static_cast<vtkIdType>(
632 this->MinMaxVolumeSize[0]*this->MinMaxVolumeSize[1]) +
633 mmpos[1]*
static_cast<vtkIdType>(this->MinMaxVolumeSize[0]) +
636 return ((*(this->MinMaxVolume + 3*offset + 2))&0x00ff);
640 unsigned short maxIdx,
int flip )
643 static_cast<vtkIdType>(this->MinMaxVolumeSize[3]) *
644 ( mmpos[2]*static_cast<vtkIdType>(
645 this->MinMaxVolumeSize[0]*this->MinMaxVolumeSize[1]) +
646 mmpos[1]*
static_cast<vtkIdType>(this->MinMaxVolumeSize[0]) +
649 if ( (*(this->MinMaxVolume + 3*offset + 2)&0x00ff) )
653 return ( *(this->MinMaxVolume + 3*offset) < maxIdx );
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};
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]));
740 if ( pos[2] < this->FixedPointCroppingRegionPlanes[4] )
744 else if ( pos[2] > this->FixedPointCroppingRegionPlanes[5] )
753 if ( pos[1] >= this->FixedPointCroppingRegionPlanes[2] )
755 if ( pos[1] > this->FixedPointCroppingRegionPlanes[3] )
765 if ( pos[0] >= this->FixedPointCroppingRegionPlanes[0] )
767 if ( pos[0] > this->FixedPointCroppingRegionPlanes[1] )
778 &this->CroppingRegionMask[idx]);
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.
GLenum GLsizei GLenum GLenum const GLvoid * image
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)
#define vtkGetMacro(name, type)
A class for performing multithreaded execution.
record modification and/or execution time
maintain a list of planes
vtkMatrix4x4 * PerspectiveMatrix
unsigned char ** GetGradientMagnitude()
GLenum GLenum GLuint components
VTK_THREAD_RETURN_TYPE FixedPointVolumeRayCastMapper_CastRays(void *arg)
abstract specification for renderers
void GetUIntTripleFromPointer(unsigned int v[3], unsigned int *ptr)
#define vtkSetClampMacro(name, type, min, max)
unsigned short * MinMaxVolume
int IntermixIntersectingGeometry
unsigned short * ContiguousGradientNormal
vtkMatrix4x4 * ViewToVoxelsMatrix
unsigned short ** GradientNormal
GLint GLint GLint GLint GLint GLint y
A helper that generates MIP images for the volume ray cast mapper.
#define vtkTypeMacro(thisClass, superclass)
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
GLint GLint GLint GLint GLint x
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
VTKRENDERINGOPENGL_EXPORT PFNGLCOLORTABLEPROC ColorTable
float SavedSampleDistance
vtkMatrix4x4 * WorldToVoxelsMatrix
Compute shading tables for encoded normals.
int GradientOpacityRequired
vtkMultiThreader * Threader
virtual void Render(vtkRenderer *ren, vtkVolume *vol)=0
#define vtkGetObjectMacro(name, type)
int CheckMIPMinMaxVolumeFlag(unsigned int pos[3], int c, unsigned short maxIdx, int flip)
float * TransformedClippingPlanes
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 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
#define vtkBooleanMacro(name, type)
GLclampf GLclampf GLclampf alpha
int NumTransformedClippingPlanes
vtkFiniteDifferenceGradientEstimator * GradientEstimator
unsigned int ToFixedPointPosition(float val)
vtkImageData * MinMaxVolumeCache
#define vtkGetVectorMacro(name, type, count)
vtkMatrix4x4 * VoxelsToViewMatrix
float OldImageSampleDistance
void GetFloatTripleFromPointer(float v[3], float *ptr)
#define vtkSetMacro(name, type)
helper class for a ray cast image