Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

graphics/vtkVolume.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkVolume.h,v $
00005   Language:  C++
00006 
00007 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038 
00039 =========================================================================*/
00060 #ifndef __vtkVolume_h
00061 #define __vtkVolume_h
00062 
00063 #include "vtkProp3D.h"
00064 #include "vtkTransform.h"
00065 #include "vtkVolumeProperty.h"
00066 #include "vtkVolumeMapper.h"
00067 #include "vtkVolumeRayCastStructures.h"
00068 
00069 class vtkRenderer;
00070 class vtkPropCollection;
00071 class vtkVolumeCollection;
00072 class vtkWindow;
00073 
00074 class VTK_EXPORT vtkVolume : public vtkProp3D
00075 {
00076 public:
00077   vtkTypeMacro(vtkVolume,vtkProp3D);
00078   void PrintSelf(ostream& os, vtkIndent indent);
00079 
00083   static vtkVolume *New();
00084 
00086   void SetMapper(vtkVolumeMapper *mapper);
00087   vtkGetObjectMacro(Mapper, vtkVolumeMapper);
00088 
00090   void SetProperty(vtkVolumeProperty *property);
00091   vtkVolumeProperty *GetProperty();
00092 
00096   void GetVolumes(vtkPropCollection *vc);
00097 
00099   void Update();
00100 
00103   float *GetBounds();
00104   void GetBounds(float bounds[6]) { this->vtkProp3D::GetBounds( bounds ); };
00105   float GetMinXBound();
00106   float GetMaxXBound();
00107   float GetMinYBound();
00108   float GetMaxYBound();
00109   float GetMinZBound();
00110   float GetMaxZBound();
00111 
00113   unsigned long int GetMTime();
00114 
00119   unsigned long GetRedrawMTime();
00120 
00122   void ShallowCopy(vtkProp *prop);
00123 
00124 //BTX
00130   int RenderTranslucentGeometry(vtkViewport *viewport);
00131 
00137   int RenderIntoImage(vtkViewport *viewport);
00138 
00143   float *GetRGBAImage();
00144   float *GetZImage();
00145 
00148   int RequiresRayCasting();
00149 
00152   int RequiresRenderingIntoImage();
00153 
00159   virtual int InitializeRayCasting( vtkViewport *viewport);
00160 
00165   virtual void InitializeTextureMapping( vtkViewport *viewport, 
00166       float sampleDistance );
00167 
00172   virtual int CastViewRay( VTKRayCastRayInfo *rayInfo );
00173  
00178   void ReleaseGraphicsResources(vtkWindow *);
00179 
00182   float *GetCorrectedScalarOpacityArray () { return this->CorrectedScalarOpacityArray; };
00183 
00186   float *GetScalarOpacityArray () { return this->ScalarOpacityArray; };
00187 
00190   float *GetGradientOpacityArray () { return this->GradientOpacityArray; };
00191 
00194   float *GetGrayArray () { return this->GrayArray; };
00195 
00198   float *GetRGBArray () { return this->RGBArray; };
00199 
00202   float  GetGradientOpacityConstant () { return this->GradientOpacityConstant; };
00203 
00206   float  GetArraySize () { return this->ArraySize; };
00207 
00210   void UpdateTransferFunctions( vtkRenderer *ren );
00211 
00214   void UpdateScalarOpacityforSampleSize( vtkRenderer *ren, float sample_distance );
00215 
00219   void AddEstimatedRenderTime( float t, vtkViewport *vp );
00220   float GetEstimatedRenderTime( vtkViewport *vp );
00221   float GetEstimatedRenderTime() {return vtkProp3D::GetEstimatedRenderTime();}
00222   
00223 //ETX
00224 
00225 protected:
00226   vtkVolume();
00227   ~vtkVolume();
00228   vtkVolume(const vtkVolume&) {};
00229   void operator=(const vtkVolume&) {};
00230 
00231   vtkVolumeMapper              *Mapper;
00232   vtkVolumeProperty            *Property;
00233 
00234   // The rgb transfer function array - for unsigned char data this
00235   // is 256 elements, for short or unsigned short it is 65536 elements
00236   // This is a sample at each scalar value of the rgb transfer
00237   // function.  A time stamp is kept to know when it needs rebuilding
00238   float                        *RGBArray;
00239   vtkTimeStamp                 RGBArrayMTime;
00240 
00241   // The gray transfer function array - for unsigned char data this
00242   // is 256 elements, for short or unsigned short it is 65536 elements
00243   // This is a sample at each scalar value of the gray transfer
00244   // function.  A time stamp is kept to know when it needs rebuilding
00245   float                        *GrayArray;
00246   vtkTimeStamp                 GrayArrayMTime;
00247 
00248   // The scalar opacity transfer function array - for unsigned char data this
00249   // is 256 elements, for short or unsigned short it is 65536 elements
00250   // This is a sample at each scalar value of the opacity transfer
00251   // function.  A time stamp is kept to know when it needs rebuilding
00252   float                        *ScalarOpacityArray;
00253   vtkTimeStamp                 ScalarOpacityArrayMTime;
00254 
00255   // The corrected scalar opacity transfer function array - this is identical
00256   // to the opacity transfer function array when the step size is 1.
00257   // In other cases, it is corrected to reflect the new material thickness
00258   // modeled by a step size different than 1.
00259   float                        *CorrectedScalarOpacityArray;
00260 
00261   // CorrectedStepSize is the step size currently modeled by
00262   // CorrectedArray.  It is used to determine when the 
00263   // CorrectedArray needs to be updated to match SampleDistance
00264   // in the volume mapper.
00265   float                        CorrectedStepSize;
00266 
00267   // CorrectedSOArrayMTime - compared with OpacityArrayMTime for update
00268   vtkTimeStamp                 CorrectedScalarOpacityArrayMTime;
00269 
00270   // Number of elements in the rgb, gray, and opacity transfer function arrays
00271   int                          ArraySize;
00272 
00273   // The magnitude of gradient opacity transfer function array
00274   float                        GradientOpacityArray[256];
00275   float                        GradientOpacityConstant;
00276   vtkTimeStamp                 GradientOpacityArrayMTime;
00277 
00278   // Function to compute screen coverage of this volume
00279   float ComputeScreenCoverage( vtkViewport *vp );
00280   
00281   VTKRayCastVolumeInfo *VolumeInfo;
00282 
00283 };
00284 
00285 #endif
00286 

Generated on Wed Nov 21 12:27:04 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001