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 =========================================================================*/
00045 #ifndef __vtkVolumeMapper_h
00046 #define __vtkVolumeMapper_h
00047 
00048 #include "vtkAbstractMapper3D.h"
00049 
00050 class vtkRenderer;
00051 class vtkVolume;
00052 class vtkImageData;
00053 
00054 #define VTK_CROP_SUBVOLUME              0x0002000
00055 #define VTK_CROP_FENCE                  0x2ebfeba
00056 #define VTK_CROP_INVERTED_FENCE         0x5140145
00057 #define VTK_CROP_CROSS                  0x0417410
00058 #define VTK_CROP_INVERTED_CROSS         0x7be8bef
00059 
00060 class vtkWindow;
00061 class vtkImageClip;
00062 
00063 class VTK_RENDERING_EXPORT vtkVolumeMapper : public vtkAbstractMapper3D
00064 {
00065 public:
00066   vtkTypeRevisionMacro(vtkVolumeMapper,vtkAbstractMapper3D);
00067   void PrintSelf( ostream& os, vtkIndent indent );
00068 
00070   virtual void Update();
00071 
00073 
00074   virtual void SetInput( vtkImageData * );
00075   vtkImageData *GetInput();
00077 
00079 
00094   vtkSetClampMacro( IndependentComponents, int, 0, 1 );
00095   vtkGetMacro( IndependentComponents, int );
00096   vtkBooleanMacro( IndependentComponents, int );
00098 
00100 
00104   vtkSetClampMacro( ComponentBlendMode, int, 
00105                     vtkVolumeMapper::ComponentBlendAdd,
00106                     vtkVolumeMapper::ComponentBlendMaxOpacity );
00107   vtkGetMacro( ComponentBlendMode, int );
00108   void SetComponentBlendModeToAdd() 
00109     {this->SetComponentBlendMode(vtkVolumeMapper::ComponentBlendAdd);};
00110   void SetComponentBlendModeToMaxOpacity() 
00111     {this->SetComponentBlendMode(vtkVolumeMapper::ComponentBlendMaxOpacity);};
00113   
00114       
00115   
00117 
00119   vtkSetClampMacro(Cropping,int,0,1);
00120   vtkGetMacro(Cropping,int);
00121   vtkBooleanMacro(Cropping,int);
00123 
00125 
00128   vtkSetVector6Macro( CroppingRegionPlanes, float );
00129   vtkGetVectorMacro(  CroppingRegionPlanes, float, 6 );
00131 
00133 
00135   vtkGetVectorMacro( VoxelCroppingRegionPlanes, float, 6 );
00137   
00139 
00148   vtkSetClampMacro( CroppingRegionFlags, int, 0x0, 0x7ffffff );
00149   vtkGetMacro( CroppingRegionFlags, int );
00150   void SetCroppingRegionFlagsToSubVolume() 
00151     {this->SetCroppingRegionFlags( VTK_CROP_SUBVOLUME );};
00152   void SetCroppingRegionFlagsToFence() 
00153     {this->SetCroppingRegionFlags( VTK_CROP_FENCE );};
00154   void SetCroppingRegionFlagsToInvertedFence() 
00155     {this->SetCroppingRegionFlags( VTK_CROP_INVERTED_FENCE );};
00156   void SetCroppingRegionFlagsToCross() 
00157     {this->SetCroppingRegionFlags( VTK_CROP_CROSS );};
00158   void SetCroppingRegionFlagsToInvertedCross() 
00159     {this->SetCroppingRegionFlags( VTK_CROP_INVERTED_CROSS );};
00161 
00163 
00165   virtual float *GetBounds();
00166   virtual void GetBounds(float bounds[6])
00167     { this->vtkAbstractMapper3D::GetBounds(bounds); };
00169 
00170 
00171 //BTX
00173 
00174   virtual float GetGradientMagnitudeScale() {return 1.0;};
00175   virtual float GetGradientMagnitudeBias()  {return 0.0;};
00176   virtual float GetGradientMagnitudeScale(int) {return 1.0;};
00177   virtual float GetGradientMagnitudeBias(int)  {return 0.0;};
00179   
00180 
00183   virtual void Render(vtkRenderer *ren, vtkVolume *vol)=0;
00184 
00189   virtual void ReleaseGraphicsResources(vtkWindow *) {};
00190   
00191   enum ComponentBlendModes {
00192     ComponentBlendAdd = 0,
00193     ComponentBlendMaxOpacity
00194   };
00195   
00196 //ETX
00197 
00199 
00201   virtual void SetUseImageClipper(int);
00202   vtkGetMacro(UseImageClipper, int );
00203   vtkBooleanMacro(UseImageClipper, int );
00205   
00206 protected:
00207   vtkVolumeMapper();
00208   ~vtkVolumeMapper();
00209 
00210   // Cropping variables, and a method for converting the world
00211   // coordinate cropping region planes to voxel coordinates
00212   int                  Cropping;
00213   float                CroppingRegionPlanes[6];
00214   float                VoxelCroppingRegionPlanes[6];
00215   int                  CroppingRegionFlags;
00216   void ConvertCroppingRegionPlanesToVoxels();
00217   
00218   // Flag for independent or dependent components
00219   int                  IndependentComponents;
00220   
00221   // How should we combine the components
00222   int                  ComponentBlendMode;
00223   
00224   vtkTimeStamp         BuildTime;
00225 
00226   // Clipper used on input to ensure it is the right size
00227   int UseImageClipper;
00228   vtkImageClip        *ImageClipper;
00229   
00230   
00231 private:
00232   vtkVolumeMapper(const vtkVolumeMapper&);  // Not implemented.
00233   void operator=(const vtkVolumeMapper&);  // Not implemented.
00234 };
00235 
00236 
00237 #endif
00238 
00239