VTK
vtkUnstructuredGridPreIntegration.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkUnstructuredGridPreIntegration.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
16 /*
17  * Copyright 2004 Sandia Corporation.
18  * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
19  * license for use of this work by or on behalf of the
20  * U.S. Government. Redistribution and use in source and binary forms, with
21  * or without modification, are permitted provided that this Notice and any
22  * statement of authorship are reproduced on all copies.
23  */
24 
46 #ifndef vtkUnstructuredGridPreIntegration_h
47 #define vtkUnstructuredGridPreIntegration_h
48 
49 #include "vtkRenderingVolumeModule.h" // For export macro
51 
52 class vtkVolumeProperty;
53 
55 {
56 public:
60  virtual void PrintSelf(ostream &os, vtkIndent indent);
61 
62  virtual void Initialize(vtkVolume *volume, vtkDataArray *scalars);
63 
64  virtual void Integrate(vtkDoubleArray *intersectionLengths,
65  vtkDataArray *nearIntersections,
66  vtkDataArray *farIntersections,
67  float color[4]);
68 
70 
72  vtkGetObjectMacro(Integrator, vtkUnstructuredGridVolumeRayIntegrator);
73  virtual void SetIntegrator(vtkUnstructuredGridVolumeRayIntegrator *);
75 
77 
78  vtkSetMacro(IntegrationTableScalarResolution, int);
79  vtkGetMacro(IntegrationTableScalarResolution, int);
80  vtkSetMacro(IntegrationTableLengthResolution, int);
81  vtkGetMacro(IntegrationTableLengthResolution, int);
83 
85 
86  virtual double GetIntegrationTableScalarShift(int component = 0);
87  virtual double GetIntegrationTableScalarScale(int component = 0);
88  virtual double GetIntegrationTableLengthScale();
90 
92 
96  vtkGetMacro(IncrementalPreIntegration, int);
97  vtkSetMacro(IncrementalPreIntegration, int);
98  vtkBooleanMacro(IncrementalPreIntegration, int);
100 
110  virtual float *GetPreIntegrationTable(int component = 0);
111 
113 
115  float *GetTableEntry(double scalar_front, double scalar_back, double lenth,
116  int component = 0);
118 
120 
123  float *GetIndexedTableEntry(int scalar_front_index, int scalar_back_index,
124  int length_index, int component = 0);
126 
127 protected:
130 
132 
135  double MaxLength;
136 
143 
146 
148 
149  virtual void BuildPreIntegrationTables(vtkDataArray *scalars);
150 
151 private:
153  void operator=(const vtkUnstructuredGridPreIntegration&); // Not implemented
154 };
155 
157  int scalar_front_index,
158  int scalar_back_index,
159  int length_index,
160  int component)
161 {
162  // Snap entries to bounds. I don't really want to spend cycles doing
163  // this, but I've had the ray caster give me values that are noticeably
164  // out of bounds.
165  if (scalar_front_index < 0) scalar_front_index = 0;
166  if (scalar_front_index >= this->IntegrationTableScalarResolution)
167  scalar_front_index = this->IntegrationTableScalarResolution - 1;
168  if (scalar_back_index < 0) scalar_back_index = 0;
169  if (scalar_back_index >= this->IntegrationTableScalarResolution)
170  scalar_back_index = this->IntegrationTableScalarResolution - 1;
171  if (length_index < 0) length_index = 0;
172  if (length_index >= this->IntegrationTableLengthResolution)
173  length_index = this->IntegrationTableLengthResolution - 1;
174 
175  return ( this->IntegrationTable[component]
176  + 4*( ( ( length_index*this->IntegrationTableScalarResolution
177  + scalar_back_index)
179  + scalar_front_index));
180 }
181 
183  double scalar_front, double scalar_back, double length, int component)
184 {
185  int sfi = static_cast<int>( scalar_front
187  + this->IntegrationTableScalarShift[component] + 0.5);
188  int sbi = static_cast<int>( scalar_back*this->IntegrationTableScalarScale[component]
189  + this->IntegrationTableScalarShift[component] + 0.5);
190  int li = static_cast<int>(length*this->IntegrationTableLengthScale + 0.5);
191  return this->GetIndexedTableEntry(sfi, sbi, li, component);
192 }
193 
194 #endif //vtkUnstructuredGridPreIntegration_h
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:49
float * GetIndexedTableEntry(int scalar_front_index, int scalar_back_index, int length_index, int component=0)
virtual void Initialize(vtkVolume *volume, vtkDataArray *scalars)=0
#define VTKRENDERINGVOLUME_EXPORT
vtkUnstructuredGridVolumeRayIntegrator * Integrator
record modification and/or execution time
Definition: vtkTimeStamp.h:34
dynamic, self-adjusting array of double
a superclass for volume ray integration functions
float * GetTableEntry(double scalar_front, double scalar_back, double lenth, int component=0)
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
performs ray integration with pre-integration tables.
represents the common properties for rendering a volume.
virtual void PrintSelf(ostream &os, vtkIndent indent)
static vtkObject * New()
virtual void Integrate(vtkDoubleArray *intersectionLengths, vtkDataArray *nearIntersections, vtkDataArray *farIntersections, float color[4])=0