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 );
370 float SampleDistance;
371 float InteractiveSampleDistance;
374 float ImageSampleDistance;
375 float MinimumImageSampleDistance;
376 float MaximumImageSampleDistance;
377 int AutoAdjustSampleDistances;
378 int LockSampleDistanceToInputSpacing;
381 float OldSampleDistance;
382 float OldImageSampleDistance;
386 void ComputeMatrices(
double volumeOrigin[3],
387 double volumeSpacing[3],
393 int imageFlag,
int rowBoundsFlag,
394 int volumeExtent[6]);
422 float *RenderTimeTable;
426 int RenderTableEntries;
432 int IntermixIntersectingGeometry;
434 float MinimumViewDistance;
440 int SavedColorChannels[4];
441 float SavedScalarOpacityDistance[4];
449 float SavedSampleDistance;
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];
462 unsigned short **GradientNormal;
463 unsigned char **GradientMagnitude;
464 unsigned short *ContiguousGradientNormal;
465 unsigned char *ContiguousGradientMagnitude;
467 int NumberOfGradientSlices;
475 unsigned short DiffuseShadingTable [4][65536*3];
476 unsigned short SpecularShadingTable[4][65536*3];
479 int GradientOpacityRequired;
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];
526 int NumTransformedClippingPlanes;
527 float *TransformedClippingPlanes;
529 double SavedSpacing[3];
533 unsigned short *MinMaxVolume;
534 int MinMaxVolumeSize[4];
539 void UpdateMinMaxVolume(
vtkVolume *vol );
540 void FillInMaxGradientMagnitudes(
int fullDim[3],
543 float FinalColorWindow;
544 float FinalColorLevel;
546 int FlipMIPComparison;
548 void ApplyFinalColorWindowLevel();
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);
603 if ( increment[1]&0x80000000 )
605 position[1] += (increment[1]&0x7fffffff);
611 if ( increment[2]&0x80000000 )
613 position[2] += (increment[2]&0x7fffffff);
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> 699 unsigned short *scalarOpacityTable,
700 unsigned short index[4],
702 unsigned char color[4] )
704 unsigned short alpha;
705 switch ( components )
709 color[0] =
static_cast<unsigned char> 711 color[1] =
static_cast<unsigned char> 713 color[2] =
static_cast<unsigned char> 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]);
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()
int CroppingRegionFlags
Cropping variables, and a method for converting the world coordinate cropping region planes to voxel ...
void ShiftVectorDown(unsigned int in[3], unsigned int out[3])
represents a volume (data & properties) in a rendered scene
Abstract class for a volume mapper.
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.
VTK_THREAD_RETURN_TYPE vtkFPVRCMSwitchOnDataType(void *arg)
A class for performing multithreaded execution.
record modification and/or execution time
maintain a list of planes
unsigned char ** GetGradientMagnitude()
VTK_THREAD_RETURN_TYPE FixedPointVolumeRayCastMapper_CastRays(void *arg)
abstract specification for renderers
void GetUIntTripleFromPointer(unsigned int v[3], unsigned int *ptr)
A helper that generates MIP images for the volume ray cast mapper.
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...
unsigned short * GetScalarOpacityTable(int c)
Builds the space leaping data structure.
Timer support and logging.
window superclass for vtkRenderWindow
int CheckIfCropped(unsigned int pos[3])
unsigned short * GetColorTable(int c)
a simple class to control print indentation
float GetEstimatedRenderTime(vtkRenderer *ren, vtkVolume *vol)
Get an estimate of the rendering time for a given volume / renderer.
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
Compute shading tables for encoded normals.
int CheckMIPMinMaxVolumeFlag(unsigned int pos[3], int c, unsigned short maxIdx, int flip)
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.
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
A helper that generates composite images for the volume ray cast mapper.
#define VTK_THREAD_RETURN_TYPE
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)
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)
float GetEstimatedRenderTime(vtkRenderer *ren)
static vtkAlgorithm * New()
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
unsigned int ToFixedPointPosition(float val)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void GetFloatTripleFromPointer(float v[3], float *ptr)
helper class for a ray cast image