50#ifndef vtkFixedPointVolumeRayCastMapper_h 
   51#define vtkFixedPointVolumeRayCastMapper_h 
   53#include "vtkRenderingVolumeModule.h"  
   54#include "vtkThreads.h"                
   57#define VTKKW_FP_SHIFT 15 
   58#define VTKKW_FPMM_SHIFT 17 
   59#define VTKKW_FP_MASK 0x7fff 
   60#define VTKKW_FP_SCALE 32767.0 
   62VTK_ABI_NAMESPACE_BEGIN
 
  103  vtkSetMacro(SampleDistance, 
float);
 
  104  vtkGetMacro(SampleDistance, 
float);
 
  115  vtkSetMacro(InteractiveSampleDistance, 
float);
 
  116  vtkGetMacro(InteractiveSampleDistance, 
float);
 
  127  vtkSetClampMacro(ImageSampleDistance, 
float, 0.1f, 100.0f);
 
  128  vtkGetMacro(ImageSampleDistance, 
float);
 
  136  vtkSetClampMacro(MinimumImageSampleDistance, 
float, 0.1f, 100.0f);
 
  137  vtkGetMacro(MinimumImageSampleDistance, 
float);
 
  145  vtkSetClampMacro(MaximumImageSampleDistance, 
float, 0.1f, 100.0f);
 
  146  vtkGetMacro(MaximumImageSampleDistance, 
float);
 
  173  vtkSetClampMacro(LockSampleDistanceToInputSpacing, 
vtkTypeBool, 0, 1);
 
  193  vtkSetClampMacro(IntermixIntersectingGeometry, 
vtkTypeBool, 0, 1);
 
  216  unsigned int ToFixedPointPosition(
float val);
 
  217  void ToFixedPointPosition(
float in[3], 
unsigned int out[3]);
 
  218  unsigned int ToFixedPointDirection(
float dir);
 
  219  void ToFixedPointDirection(
float in[3], 
unsigned int out[3]);
 
  220  void FixedPointIncrement(
unsigned int position[3], 
unsigned int increment[3]);
 
  221  void GetFloatTripleFromPointer(
float v[3], 
float* ptr);
 
  222  void GetUIntTripleFromPointer(
unsigned int v[3], 
unsigned int* ptr);
 
  223  void ShiftVectorDown(
unsigned int in[3], 
unsigned int out[3]);
 
  224  int CheckMinMaxVolumeFlag(
unsigned int pos[3], 
int c);
 
  225  int CheckMIPMinMaxVolumeFlag(
unsigned int pos[3], 
int c, 
unsigned short maxIdx, 
int flip);
 
  227  void LookupColorUC(
unsigned short* colorTable, 
unsigned short* scalarOpacityTable,
 
  228    unsigned short index, 
unsigned char color[4]);
 
  229  void LookupDependentColorUC(
unsigned short* colorTable, 
unsigned short* scalarOpacityTable,
 
  230    unsigned short index[4], 
int components, 
unsigned char color[4]);
 
  231  void LookupAndCombineIndependentColorsUC(
unsigned short* colorTable[4],
 
  232    unsigned short* scalarOpacityTable[4], 
unsigned short index[4], 
float weights[4],
 
  233    int components, 
unsigned char color[4]);
 
  234  int CheckIfCropped(
unsigned int pos[3]);
 
  242  vtkGetVectorMacro(TableShift, 
float, 4);
 
  243  vtkGetVectorMacro(TableScale, 
float, 4);
 
  244  vtkGetMacro(ShadingRequired, 
int);
 
  245  vtkGetMacro(GradientOpacityRequired, 
int);
 
  261    int x, 
int y, 
unsigned int pos[3], 
unsigned int dir[3], 
unsigned int* numSteps);
 
  285    double viewDirection[3], 
double viewUp[3]);
 
  295    return this->RetrieveRenderTime(ren, vol);
 
  313  vtkSetMacro(FinalColorWindow, 
float);
 
  314  vtkGetMacro(FinalColorWindow, 
float);
 
  315  vtkSetMacro(FinalColorLevel, 
float);
 
  316  vtkGetMacro(FinalColorLevel, 
float);
 
  322  vtkGetMacro(FlipMIPComparison, 
int);
 
  356  void ComputeMatrices(
double inputOrigin[3], 
double inputSpacing[3], 
int inputExtent[6],
 
  405  int SavedColorChannels[4];
 
  406  float SavedScalarOpacityDistance[4];
 
  416  unsigned short ColorTable[4][32768 * 3];
 
  417  unsigned short ScalarOpacityTable[4][32768];
 
  418  unsigned short GradientOpacityTable[4][256];
 
  423  float GradientMagnitudeScale[4];
 
  424  float GradientMagnitudeShift[4];
 
  439  unsigned short DiffuseShadingTable[4][65536 * 3];
 
  440  unsigned short SpecularShadingTable[4][65536 * 3];
 
  452    double rayStart[3], 
double rayEnd[3], 
float rayDirection[3], 
double bounds[6]);
 
  462    double rayStart[3], 
double rayEnd[3], 
int numClippingPlanes, 
float* clippingPlanes);
 
  464  unsigned int FixedPointCroppingRegionPlanes[6];
 
  465  unsigned int CroppingRegionMask[27];
 
  479  float ViewToVoxelsArray[16];
 
  480  float WorldToVoxelsArray[16];
 
  481  float VoxelsToWorldArray[16];
 
  483  double CroppingBounds[6];
 
  488  double SavedSpacing[3];
 
  492  int MinMaxVolumeSize[4];
 
  528  return ((dir < 0.0) ? (
static_cast<unsigned int>(-dir * 
VTKKW_FP_SCALE + 0.5))
 
  529                      : (0x80000000 + 
static_cast<unsigned int>(dir * 
VTKKW_FP_SCALE + 0.5)));
 
  533  float in[3], 
unsigned int out[3])
 
  535  out[0] = ((in[0] < 0.0) ? (
static_cast<unsigned int>(-in[0] * 
VTKKW_FP_SCALE + 0.5))
 
  536                          : (0x80000000 + 
static_cast<unsigned int>(in[0] * 
VTKKW_FP_SCALE + 0.5)));
 
  537  out[1] = ((in[1] < 0.0) ? (
static_cast<unsigned int>(-in[1] * 
VTKKW_FP_SCALE + 0.5))
 
  538                          : (0x80000000 + 
static_cast<unsigned int>(in[1] * 
VTKKW_FP_SCALE + 0.5)));
 
  539  out[2] = ((in[2] < 0.0) ? (
static_cast<unsigned int>(-in[2] * 
VTKKW_FP_SCALE + 0.5))
 
  540                          : (0x80000000 + 
static_cast<unsigned int>(in[2] * 
VTKKW_FP_SCALE + 0.5)));
 
  544  unsigned int position[3], 
unsigned int increment[3])
 
  546  if (increment[0] & 0x80000000)
 
  548    position[0] += (increment[0] & 0x7fffffff);
 
  552    position[0] -= increment[0];
 
  554  if (increment[1] & 0x80000000)
 
  556    position[1] += (increment[1] & 0x7fffffff);
 
  560    position[1] -= increment[1];
 
  562  if (increment[2] & 0x80000000)
 
  564    position[2] += (increment[2] & 0x7fffffff);
 
  568    position[2] -= increment[2];
 
  580  unsigned int v[3], 
unsigned int* ptr)
 
  588  unsigned int in[3], 
unsigned int out[3])
 
  599        mmpos[1] * 
static_cast<vtkIdType>(this->MinMaxVolumeSize[0]) + mmpos[0]) +
 
  602  return ((*(this->
MinMaxVolume + 3 * offset + 2)) & 0x00ff);
 
  606  unsigned int mmpos[3], 
int c, 
unsigned short maxIdx, 
int flip)
 
  610        mmpos[1] * 
static_cast<vtkIdType>(this->MinMaxVolumeSize[0]) + mmpos[0]) +
 
  621      return (*(this->
MinMaxVolume + 3 * offset + 1) > maxIdx);
 
  631  unsigned short* scalarOpacityTable, 
unsigned short index, 
unsigned char color[4])
 
  633  unsigned short alpha = scalarOpacityTable[index];
 
  634  color[0] = 
static_cast<unsigned char>(
 
  635    (colorTable[3 * index] * alpha + 0x7fff) >> (2 * 
VTKKW_FP_SHIFT - 8));
 
  636  color[1] = 
static_cast<unsigned char>(
 
  637    (colorTable[3 * index + 1] * alpha + 0x7fff) >> (2 * 
VTKKW_FP_SHIFT - 8));
 
  638  color[2] = 
static_cast<unsigned char>(
 
  639    (colorTable[3 * index + 2] * alpha + 0x7fff) >> (2 * 
VTKKW_FP_SHIFT - 8));
 
  640  color[3] = 
static_cast<unsigned char>(alpha >> (
VTKKW_FP_SHIFT - 8));
 
  644  unsigned short* scalarOpacityTable, 
unsigned short index[4], 
int components,
 
  645  unsigned char color[4])
 
  647  unsigned short alpha;
 
  651      alpha = scalarOpacityTable[index[1]];
 
  652      color[0] = 
static_cast<unsigned char>(
 
  653        (colorTable[3 * index[0]] * alpha + 0x7fff) >> (2 * 
VTKKW_FP_SHIFT - 8));
 
  654      color[1] = 
static_cast<unsigned char>(
 
  655        (colorTable[3 * index[0] + 1] * alpha + 0x7fff) >> (2 * 
VTKKW_FP_SHIFT - 8));
 
  656      color[2] = 
static_cast<unsigned char>(
 
  657        (colorTable[3 * index[0] + 2] * alpha + 0x7fff) >> (2 * 
VTKKW_FP_SHIFT - 8));
 
  658      color[3] = 
static_cast<unsigned char>(alpha >> (
VTKKW_FP_SHIFT - 8));
 
  661      alpha = scalarOpacityTable[index[3]];
 
  662      color[0] = 
static_cast<unsigned char>((index[0] * alpha + 0x7fff) >> 
VTKKW_FP_SHIFT);
 
  663      color[1] = 
static_cast<unsigned char>((index[1] * alpha + 0x7fff) >> 
VTKKW_FP_SHIFT);
 
  664      color[2] = 
static_cast<unsigned char>((index[2] * alpha + 0x7fff) >> 
VTKKW_FP_SHIFT);
 
  665      color[3] = 
static_cast<unsigned char>(alpha >> (
VTKKW_FP_SHIFT - 8));
 
  671  unsigned short* colorTable[4], 
unsigned short* scalarOpacityTable[4], 
unsigned short index[4],
 
  672  float weights[4], 
int components, 
unsigned char color[4])
 
  674  unsigned int tmp[4] = { 0, 0, 0, 0 };
 
  676  for (
int i = 0; i < components; i++)
 
  678    unsigned short alpha =
 
  679      static_cast<unsigned short>(
static_cast<float>(scalarOpacityTable[i][index[i]]) * weights[i]);
 
  680    tmp[0] += 
static_cast<unsigned char>(
 
  681      ((colorTable[i][3 * index[i]]) * alpha + 0x7fff) >> (2 * 
VTKKW_FP_SHIFT - 8));
 
  682    tmp[1] += 
static_cast<unsigned char>(
 
  683      ((colorTable[i][3 * index[i] + 1]) * alpha + 0x7fff) >> (2 * 
VTKKW_FP_SHIFT - 8));
 
  684    tmp[2] += 
static_cast<unsigned char>(
 
  685      ((colorTable[i][3 * index[i] + 2]) * alpha + 0x7fff) >> (2 * 
VTKKW_FP_SHIFT - 8));
 
  686    tmp[3] += 
static_cast<unsigned char>(alpha >> (
VTKKW_FP_SHIFT - 8));
 
  689  color[0] = 
static_cast<unsigned char>((tmp[0] > 255) ? (255) : (tmp[0]));
 
  690  color[1] = 
static_cast<unsigned char>((tmp[1] > 255) ? (255) : (tmp[1]));
 
  691  color[2] = 
static_cast<unsigned char>((tmp[2] > 255) ? (255) : (tmp[2]));
 
  692  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
 
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
 
float RetrieveRenderTime(vtkRenderer *ren)
 
float MaximumImageSampleDistance
 
unsigned short * GetColorTable(int c)
 
unsigned short * GetSpecularShadingTable(int c)
 
float ImageSampleDistance
 
vtkTransform * VoxelsTransform
 
unsigned short * ContiguousGradientNormal
 
float MinimumImageSampleDistance
 
vtkFixedPointVolumeRayCastMapper()
 
vtkImageData * SavedMinMaxInput
 
void UpdateCroppingRegions()
 
void GetFloatTripleFromPointer(float v[3], float *ptr)
 
unsigned short * MinMaxVolume
 
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
 
unsigned short * GetScalarOpacityTable(int c)
 
vtkMatrix4x4 * VoxelsToWorldMatrix
 
vtkTimeStamp SavedGradientsMTime
 
unsigned short * GetGradientOpacityTable(int c)
 
vtkRenderWindow * RenderWindow
 
float MinimumViewDistance
 
void StoreRenderTime(vtkRenderer *ren, vtkVolume *vol, float t)
 
vtkFiniteDifferenceGradientEstimator * GradientEstimator
 
vtkFixedPointVolumeRayCastCompositeGOShadeHelper * CompositeGOShadeHelper
 
vtkTypeBool IntermixIntersectingGeometry
 
int ComputeRowBounds(vtkRenderer *ren, int imageFlag, int rowBoundsFlag, int inputExtent[6])
 
vtkTypeBool AutoAdjustSampleDistances
 
vtkImageData * MinMaxVolumeCache
 
float GetZBufferValue(int x, int y)
 
void DisplayRenderedImage(vtkRenderer *, vtkVolume *)
 
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)
What is the image sample distance required to achieve the desired time? A version of this method is p...
 
~vtkFixedPointVolumeRayCastMapper() override
 
float SavedSampleDistance
 
static vtkFixedPointVolumeRayCastMapper * New()
 
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)
 
int CheckMIPMinMaxVolumeFlag(unsigned int pos[3], int c, unsigned short maxIdx, int flip)
 
float GetEstimatedRenderTime(vtkRenderer *ren)
 
unsigned short * GetDiffuseShadingTable(int c)
 
vtkDirectionEncoder * DirectionEncoder
 
vtkMatrix4x4 * PerspectiveMatrix
 
unsigned char ** GetGradientMagnitude()
 
float InteractiveSampleDistance
 
friend VTK_THREAD_RETURN_TYPE vtkFPVRCMSwitchOnDataType(void *arg)
 
void PerSubVolumeInitialization(vtkRenderer *, vtkVolume *, int)
 
vtkImageData * SavedGradientsInput
 
vtkTimeStamp SavedParametersMTime
 
unsigned short ** GradientNormal
 
void ComputeMatrices(double inputOrigin[3], double inputSpacing[3], int inputExtent[6], vtkRenderer *ren, vtkVolume *vol)
 
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
 
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 *)
 
int ClipRayAgainstVolume(double rayStart[3], double rayEnd[3], float rayDirection[3], double bounds[6])
 
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
 
vtkRenderer ** RenderRendererTable
 
void ShiftVectorDown(unsigned int in[3], unsigned int out[3])
 
int UpdateColorTable(vtkVolume *vol)
 
int NumTransformedClippingPlanes
 
unsigned char * ContiguousGradientMagnitude
 
int ClipRayAgainstClippingPlanes(double rayStart[3], double rayEnd[3], int numClippingPlanes, float *clippingPlanes)
 
int GetNumberOfThreads()
Set/Get the number of threads to use.
 
int UpdateGradients(vtkVolume *vol)
 
vtkDataArray * CurrentScalars
 
vtkTypeBool LockSampleDistanceToInputSpacing
 
unsigned int CroppingRegionMask[27]
 
unsigned short ** GetGradientNormal()
 
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.
 
int CroppingRegionFlags
Cropping variables, and a method for converting the world coordinate cropping region planes to voxel ...
 
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)