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

Rendering/vtkVolumeMapper.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkVolumeMapper.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00032 #ifndef __vtkVolumeMapper_h
00033 #define __vtkVolumeMapper_h
00034 
00035 #include "vtkAbstractMapper3D.h"
00036 
00037 class vtkRenderer;
00038 class vtkVolume;
00039 class vtkImageData;
00040 
00041 #define VTK_CROP_SUBVOLUME              0x0002000
00042 #define VTK_CROP_FENCE                  0x2ebfeba
00043 #define VTK_CROP_INVERTED_FENCE         0x5140145
00044 #define VTK_CROP_CROSS                  0x0417410
00045 #define VTK_CROP_INVERTED_CROSS         0x7be8bef
00046 
00047 class vtkWindow;
00048 class vtkImageClip;
00049 
00050 class VTK_RENDERING_EXPORT vtkVolumeMapper : public vtkAbstractMapper3D
00051 {
00052 public:
00053   vtkTypeRevisionMacro(vtkVolumeMapper,vtkAbstractMapper3D);
00054   void PrintSelf( ostream& os, vtkIndent indent );
00055 
00057   virtual void Update();
00058 
00060 
00061   virtual void SetInput( vtkImageData * );
00062   vtkImageData *GetInput();
00064 
00066 
00081   vtkSetClampMacro( IndependentComponents, int, 0, 1 );
00082   vtkGetMacro( IndependentComponents, int );
00083   vtkBooleanMacro( IndependentComponents, int );
00085 
00087 
00091   vtkSetClampMacro( ComponentBlendMode, int, 
00092                     vtkVolumeMapper::ComponentBlendAdd,
00093                     vtkVolumeMapper::ComponentBlendMaxOpacity );
00094   vtkGetMacro( ComponentBlendMode, int );
00095   void SetComponentBlendModeToAdd() 
00096     {this->SetComponentBlendMode(vtkVolumeMapper::ComponentBlendAdd);};
00097   void SetComponentBlendModeToMaxOpacity() 
00098     {this->SetComponentBlendMode(vtkVolumeMapper::ComponentBlendMaxOpacity);};
00100   
00101       
00102   
00104 
00106   vtkSetClampMacro(Cropping,int,0,1);
00107   vtkGetMacro(Cropping,int);
00108   vtkBooleanMacro(Cropping,int);
00110 
00112 
00115   vtkSetVector6Macro( CroppingRegionPlanes, float );
00116   vtkGetVectorMacro(  CroppingRegionPlanes, float, 6 );
00118 
00120 
00122   vtkGetVectorMacro( VoxelCroppingRegionPlanes, float, 6 );
00124   
00126 
00135   vtkSetClampMacro( CroppingRegionFlags, int, 0x0, 0x7ffffff );
00136   vtkGetMacro( CroppingRegionFlags, int );
00137   void SetCroppingRegionFlagsToSubVolume() 
00138     {this->SetCroppingRegionFlags( VTK_CROP_SUBVOLUME );};
00139   void SetCroppingRegionFlagsToFence() 
00140     {this->SetCroppingRegionFlags( VTK_CROP_FENCE );};
00141   void SetCroppingRegionFlagsToInvertedFence() 
00142     {this->SetCroppingRegionFlags( VTK_CROP_INVERTED_FENCE );};
00143   void SetCroppingRegionFlagsToCross() 
00144     {this->SetCroppingRegionFlags( VTK_CROP_CROSS );};
00145   void SetCroppingRegionFlagsToInvertedCross() 
00146     {this->SetCroppingRegionFlags( VTK_CROP_INVERTED_CROSS );};
00148 
00150 
00152   virtual float *GetBounds();
00153   virtual void GetBounds(float bounds[6])
00154     { this->vtkAbstractMapper3D::GetBounds(bounds); };
00156 
00157 
00158 //BTX
00160 
00161   virtual float GetGradientMagnitudeScale() {return 1.0;};
00162   virtual float GetGradientMagnitudeBias()  {return 0.0;};
00163   virtual float GetGradientMagnitudeScale(int) {return 1.0;};
00164   virtual float GetGradientMagnitudeBias(int)  {return 0.0;};
00166   
00167 
00170   virtual void Render(vtkRenderer *ren, vtkVolume *vol)=0;
00171 
00176   virtual void ReleaseGraphicsResources(vtkWindow *) {};
00177   
00178   enum ComponentBlendModes {
00179     ComponentBlendAdd = 0,
00180     ComponentBlendMaxOpacity
00181   };
00182   
00183 //ETX
00184 
00186 
00188   virtual void SetUseImageClipper(int);
00189   vtkGetMacro(UseImageClipper, int );
00190   vtkBooleanMacro(UseImageClipper, int );
00192   
00193 protected:
00194   vtkVolumeMapper();
00195   ~vtkVolumeMapper();
00196 
00197   // Cropping variables, and a method for converting the world
00198   // coordinate cropping region planes to voxel coordinates
00199   int                  Cropping;
00200   float                CroppingRegionPlanes[6];
00201   float                VoxelCroppingRegionPlanes[6];
00202   int                  CroppingRegionFlags;
00203   void ConvertCroppingRegionPlanesToVoxels();
00204   
00205   // Flag for independent or dependent components
00206   int                  IndependentComponents;
00207   
00208   // How should we combine the components
00209   int                  ComponentBlendMode;
00210   
00211   vtkTimeStamp         BuildTime;
00212 
00213   // Clipper used on input to ensure it is the right size
00214   int UseImageClipper;
00215   vtkImageClip        *ImageClipper;
00216   
00217   
00218 private:
00219   vtkVolumeMapper(const vtkVolumeMapper&);  // Not implemented.
00220   void operator=(const vtkVolumeMapper&);  // Not implemented.
00221 };
00222 
00223 
00224 #endif
00225 
00226