vtkVolumeMapper.h 5.18 KB
Newer Older
1 2 3 4 5
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkVolumeMapper.h

6
  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 8
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9

10 11
     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12
     PURPOSE.  See the above copyright notice for more information.
13 14

=========================================================================*/
Lisa Avila's avatar
Lisa Avila committed
15 16 17
// .NAME vtkVolumeMapper - Abstract class for a volume mapper

// .SECTION Description
18 19 20
// vtkVolumeMapper is the abstract definition of a volume mapper for regular
// rectilinear data (vtkImageData).  Several  basic types of volume mappers 
// are supported. 
Lisa Avila's avatar
Lisa Avila committed
21 22

// .SECTION see also
23
// vtkVolumeRayCastMapper vtkVolumeTextureMapper2D
Lisa Avila's avatar
Lisa Avila committed
24 25 26 27

#ifndef __vtkVolumeMapper_h
#define __vtkVolumeMapper_h

28
#include "vtkAbstractVolumeMapper.h"
Lisa Avila's avatar
Lisa Avila committed
29 30 31

class vtkRenderer;
class vtkVolume;
32
class vtkImageData;
Lisa Avila's avatar
Lisa Avila committed
33

34 35 36 37 38 39
#define VTK_CROP_SUBVOLUME              0x0002000
#define VTK_CROP_FENCE                  0x2ebfeba
#define VTK_CROP_INVERTED_FENCE         0x5140145
#define VTK_CROP_CROSS                  0x0417410
#define VTK_CROP_INVERTED_CROSS         0x7be8bef

40
class vtkWindow;
41
class vtkImageClip;
42

43
class VTK_RENDERING_EXPORT vtkVolumeMapper : public vtkAbstractVolumeMapper
Lisa Avila's avatar
Lisa Avila committed
44 45
{
public:
Lisa Avila's avatar
Lisa Avila committed
46
  vtkTypeRevisionMacro(vtkVolumeMapper,vtkAbstractVolumeMapper);
Andy Cedilnik's avatar
Andy Cedilnik committed
47
  void PrintSelf( ostream& os, vtkIndent indent );
Lisa Avila's avatar
Lisa Avila committed
48

49 50
  // Description:
  // Set/Get the input data
51
  virtual void SetInput( vtkImageData * );
52
  virtual void SetInput( vtkDataSet * );
53
  vtkImageData *GetInput();
54

Lisa Avila's avatar
Lisa Avila committed
55
  // Description:
56
  // Turn On/Off orthogonal cropping. (Clipping planes are
Will Schroeder's avatar
Will Schroeder committed
57
  // perpendicular to the coordinate axes.)
58
  vtkSetClampMacro(Cropping,int,0,1);
59 60
  vtkGetMacro(Cropping,int);
  vtkBooleanMacro(Cropping,int);
Will Schroeder's avatar
Will Schroeder committed
61

Ken Martin's avatar
Ken Martin committed
62
  // Description:
63
  // Set/Get the Cropping Region Planes ( xmin, xmax, ymin, ymax, zmin, zmax )
64 65
  // These planes are defined in volume coordinates - spacing and origin are
  // considered.
Lisa Avila's avatar
Lisa Avila committed
66 67
  vtkSetVector6Macro( CroppingRegionPlanes, double );
  vtkGetVectorMacro(  CroppingRegionPlanes, double, 6 );
Lisa Avila's avatar
Lisa Avila committed
68

69 70 71
  // Description:
  // Get the cropping region planes in voxels. Only valid during the 
  // rendering process
Lisa Avila's avatar
Lisa Avila committed
72
  vtkGetVectorMacro( VoxelCroppingRegionPlanes, double, 6 );
73
  
Lisa Avila's avatar
Lisa Avila committed
74
  // Description:
75 76 77 78 79 80 81
  // Set the flags for the cropping regions. The clipping planes divide the
  // volume into 27 regions - there is one bit for each region. The regions 
  // start from the one containing voxel (0,0,0), moving along the x axis 
  // fastest, the y axis next, and the z axis slowest. These are represented 
  // from the lowest bit to bit number 27 in the integer containing the 
  // flags. There are several convenience functions to set some common 
  // configurations - subvolume (the default), fence (between any of the 
Bill Lorensen's avatar
Bill Lorensen committed
82
  // clip plane pairs), inverted fence, cross (between any two of the 
83 84 85 86 87 88 89 90 91 92 93 94 95
  // clip plane pairs) and inverted cross.
  vtkSetClampMacro( CroppingRegionFlags, int, 0x0, 0x7ffffff );
  vtkGetMacro( CroppingRegionFlags, int );
  void SetCroppingRegionFlagsToSubVolume() 
    {this->SetCroppingRegionFlags( VTK_CROP_SUBVOLUME );};
  void SetCroppingRegionFlagsToFence() 
    {this->SetCroppingRegionFlags( VTK_CROP_FENCE );};
  void SetCroppingRegionFlagsToInvertedFence() 
    {this->SetCroppingRegionFlags( VTK_CROP_INVERTED_FENCE );};
  void SetCroppingRegionFlagsToCross() 
    {this->SetCroppingRegionFlags( VTK_CROP_CROSS );};
  void SetCroppingRegionFlagsToInvertedCross() 
    {this->SetCroppingRegionFlags( VTK_CROP_INVERTED_CROSS );};
96

97
//BTX  
98 99 100 101 102 103 104 105 106 107 108 109 110

  // Description:
  // WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE
  // DO NOT USE THIS METHOD OUTSIDE OF THE RENDERING PROCESS
  // Render the volume
  virtual void Render(vtkRenderer *ren, vtkVolume *vol)=0;

  // Description:
  // WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE
  // Release any graphics resources that are being consumed by this mapper.
  // The parameter window could be used to determine which graphic
  // resources to release.
  virtual void ReleaseGraphicsResources(vtkWindow *) {};
111
  
112 113
//ETX

114
  // Description:
115
  // The default behaviour is to use a vtkImageClip on input to ensure it is 
116 117 118 119 120
  // the right size. Allow the user to turn that behaviour off.
  virtual void SetUseImageClipper(int);
  vtkGetMacro(UseImageClipper, int );
  vtkBooleanMacro(UseImageClipper, int );
  
Lisa Avila's avatar
Lisa Avila committed
121
protected:
122 123
  vtkVolumeMapper();
  ~vtkVolumeMapper();
124

Ken Martin's avatar
Ken Martin committed
125 126 127
  virtual void ReportReferences(vtkGarbageCollector*);
  virtual void RemoveReferences();

128 129
  // Cropping variables, and a method for converting the world
  // coordinate cropping region planes to voxel coordinates
130
  int                  Cropping;
Lisa Avila's avatar
Lisa Avila committed
131 132
  double               CroppingRegionPlanes[6];
  double               VoxelCroppingRegionPlanes[6];
133
  int                  CroppingRegionFlags;
134 135 136
  void ConvertCroppingRegionPlanesToVoxels();
  
  // Clipper used on input to ensure it is the right size
137
  int UseImageClipper;
138
  vtkImageClip        *ImageClipper;
139 140
  
  
141 142 143
private:
  vtkVolumeMapper(const vtkVolumeMapper&);  // Not implemented.
  void operator=(const vtkVolumeMapper&);  // Not implemented.
Lisa Avila's avatar
Lisa Avila committed
144 145 146 147 148 149
};


#endif