Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkVolume.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkVolume.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00047 #ifndef __vtkVolume_h
00048 #define __vtkVolume_h
00049 
00050 #include "vtkProp3D.h"
00051 
00052 class vtkRenderer;
00053 class vtkPropCollection;
00054 class vtkVolumeCollection;
00055 class vtkWindow;
00056 class vtkVolumeProperty;
00057 class vtkAbstractVolumeMapper;
00058 
00059 class VTK_RENDERING_EXPORT vtkVolume : public vtkProp3D
00060 {
00061 public:
00062   vtkTypeRevisionMacro(vtkVolume,vtkProp3D);
00063   void PrintSelf(ostream& os, vtkIndent indent);
00064 
00068   static vtkVolume *New();
00069 
00071 
00072   void SetMapper(vtkAbstractVolumeMapper *mapper);
00073   vtkGetObjectMacro(Mapper, vtkAbstractVolumeMapper);
00075 
00077 
00078   void SetProperty(vtkVolumeProperty *property);
00079   vtkVolumeProperty *GetProperty();
00081 
00085   void GetVolumes(vtkPropCollection *vc);
00086 
00088   void Update();
00089 
00091 
00093   double *GetBounds();
00094   void GetBounds(double bounds[6]) { this->vtkProp3D::GetBounds( bounds ); };
00095   double GetMinXBound();
00096   double GetMaxXBound();
00097   double GetMinYBound();
00098   double GetMaxYBound();
00099   double GetMinZBound();
00100   double GetMaxZBound();
00102 
00104   unsigned long int GetMTime();
00105 
00110   unsigned long GetRedrawMTime();
00111 
00113   void ShallowCopy(vtkProp *prop);
00114 
00115 //BTX
00121   int RenderTranslucentGeometry(vtkViewport *viewport);
00122 
00127   void ReleaseGraphicsResources(vtkWindow *);
00128 
00130 
00132   float *GetCorrectedScalarOpacityArray(int);
00133   float *GetCorrectedScalarOpacityArray()
00134     {return this->GetCorrectedScalarOpacityArray(0);};
00136 
00138 
00140   float *GetScalarOpacityArray(int);
00141   float *GetScalarOpacityArray(){return this->GetScalarOpacityArray(0);};
00143 
00145 
00147   float *GetGradientOpacityArray(int);
00148   float *GetGradientOpacityArray(){return this->GetGradientOpacityArray(0);};
00150 
00152 
00154   float *GetGrayArray(int);
00155   float *GetGrayArray(){return this->GetGrayArray(0);};
00157 
00159 
00161   float *GetRGBArray(int);
00162   float *GetRGBArray(){return this->GetRGBArray(0);};
00164 
00166 
00168   float  GetGradientOpacityConstant(int);
00169   float  GetGradientOpacityConstant()
00170     {return this->GetGradientOpacityConstant(0);};
00172 
00175   float  GetArraySize () { return static_cast<float>(this->ArraySize); };
00176 
00179   void UpdateTransferFunctions( vtkRenderer *ren );
00180 
00182 
00184   void UpdateScalarOpacityforSampleSize( vtkRenderer *ren, 
00185                                          float sample_distance );
00187 
00188 //ETX
00189 
00190 protected:
00191   vtkVolume();
00192   ~vtkVolume();
00193 
00194   vtkAbstractVolumeMapper      *Mapper;
00195   vtkVolumeProperty            *Property;
00196 
00197   // The rgb transfer function array - for unsigned char data this
00198   // is 256 elements, for short or unsigned short it is 65536 elements
00199   // This is a sample at each scalar value of the rgb transfer
00200   // function.  A time stamp is kept to know when it needs rebuilding
00201   float                *RGBArray[VTK_MAX_VRCOMP];
00202   vtkTimeStamp          RGBArrayMTime[VTK_MAX_VRCOMP];
00203 
00204   // The gray transfer function array - for unsigned char data this
00205   // is 256 elements, for short or unsigned short it is 65536 elements
00206   // This is a sample at each scalar value of the gray transfer
00207   // function.  A time stamp is kept to know when it needs rebuilding
00208   float                *GrayArray[VTK_MAX_VRCOMP];
00209   vtkTimeStamp          GrayArrayMTime[VTK_MAX_VRCOMP];
00210 
00211   // The scalar opacity transfer function array - for unsigned char data this
00212   // is 256 elements, for short or unsigned short it is 65536 elements
00213   // This is a sample at each scalar value of the opacity transfer
00214   // function.  A time stamp is kept to know when it needs rebuilding
00215   float                *ScalarOpacityArray[VTK_MAX_VRCOMP];
00216   vtkTimeStamp          ScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
00217 
00218   // The corrected scalar opacity transfer function array - this is identical
00219   // to the opacity transfer function array when the step size is 1.
00220   // In other cases, it is corrected to reflect the new material thickness
00221   // modeled by a step size different than 1.
00222   float                *CorrectedScalarOpacityArray[VTK_MAX_VRCOMP];
00223   vtkTimeStamp          CorrectedScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
00224 
00225   // CorrectedStepSize is the step size currently modeled by
00226   // CorrectedArray.  It is used to determine when the 
00227   // CorrectedArray needs to be updated to match SampleDistance
00228   // in the volume mapper.
00229   float                CorrectedStepSize;
00230 
00231   // Number of elements in the rgb, gray, and opacity transfer function arrays
00232   int                  ArraySize;
00233 
00234   // The magnitude of gradient opacity transfer function array
00235   float                GradientOpacityArray[VTK_MAX_VRCOMP][256];
00236   float                GradientOpacityConstant[VTK_MAX_VRCOMP];
00237   vtkTimeStamp         GradientOpacityArrayMTime[VTK_MAX_VRCOMP];
00238 
00239   // Function to compute screen coverage of this volume
00240   float ComputeScreenCoverage( vtkViewport *vp );
00241   
00242 private:
00243   vtkVolume(const vtkVolume&);  // Not implemented.
00244   void operator=(const vtkVolume&);  // Not implemented.
00245 };
00246 
00247 #endif
00248