VTK
vtkImageMapper3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageMapper3D.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
31 #ifndef __vtkImageMapper3D_h
32 #define __vtkImageMapper3D_h
33 
34 #include "vtkAbstractMapper3D.h"
35 
36 class vtkRenderer;
37 class vtkProp3D;
38 class vtkPoints;
39 class vtkMatrix4x4;
40 class vtkLookupTable;
41 class vtkScalarsToColors;
42 class vtkImageSlice;
43 class vtkImageProperty;
44 class vtkImageData;
45 class vtkMultiThreader;
46 class vtkImageToImageMapper3DFriendship;
47 
49 {
50 public:
52  void PrintSelf(ostream& os, vtkIndent indent);
53 
55  virtual void Render(vtkRenderer *renderer, vtkImageSlice *prop) = 0;
56 
60  virtual void ReleaseGraphicsResources(vtkWindow *) = 0;
61 
63 
64  void SetInput(vtkImageData *input);
65  vtkImageData *GetInput();
66  vtkDataSet *GetDataSetInput();
67  vtkDataObject *GetDataObjectInput();
69 
71 
74  vtkSetMacro(Border, int);
75  vtkBooleanMacro(Border, int);
76  vtkGetMacro(Border, int);
78 
80 
84  vtkSetMacro(Background, int);
85  vtkBooleanMacro(Background, int);
86  vtkGetMacro(Background, int);
88 
90 
93  vtkSetMacro(SliceAtFocalPoint, int);
94  vtkBooleanMacro(SliceAtFocalPoint, int);
95  vtkGetMacro(SliceAtFocalPoint, int);
97 
99 
102  vtkSetMacro(SliceFacesCamera, int);
103  vtkBooleanMacro(SliceFacesCamera, int);
104  vtkGetMacro(SliceFacesCamera, int);
106 
108 
113  vtkGetObjectMacro(SlicePlane, vtkPlane);
115 
117 
120  virtual void GetSlicePlaneInDataCoords(vtkMatrix4x4 *propMatrix,
121  double plane[4]);
123 
125 
126  vtkSetClampMacro(NumberOfThreads, int, 1, VTK_MAX_THREADS);
127  vtkGetMacro(NumberOfThreads, int);
129 
130 protected:
132  ~vtkImageMapper3D();
133 
135 
139 
141 
142  virtual int ProcessRequest(vtkInformation* request,
143  vtkInformationVector** inInfo,
144  vtkInformationVector* outInfo);
146 
148 
150  static void CheckerboardRGBA(
151  unsigned char *data, int xsize, int ysize,
152  double originx, double originy, double spacingx, double spacingy);
154 
156 
159  unsigned char *MakeTextureData(
160  vtkImageProperty *property, vtkImageData *input, int extent[6],
161  int &xsize, int &ysize, int &bytesPerPixel, bool &reuseTexture,
162  bool &reuseData);
164 
166 
168  void MakeTextureGeometry(
169  const int extent[6], double coords[12], double tcoords[8]);
171 
173 
178  virtual void ComputeTextureSize(
179  const int extent[6], int &xdim, int &ydim,
180  int imageSize[2], int textureSize[2]);
182 
185  vtkRenderer *GetCurrentRenderer();
186 
188  vtkImageSlice *GetCurrentProp() { return this->CurrentProp; }
189 
192  vtkMatrix4x4 *GetDataToWorldMatrix();
193 
196  void GetBackgroundColor(vtkImageProperty *property, double color[4]);
197 
198  int Border;
203 
204  // The slice.
208 
209  // Information about the image, updated by UpdateInformation
210  double DataSpacing[3];
211  double DataOrigin[3];
212  int DataWholeExtent[6];
213 
214  // Set by vtkImageStack when doing multi-pass rendering
218 
219 private:
220  // The prop this mapper is attached to, or zero if none.
221  vtkImageSlice *CurrentProp;
222  vtkRenderer *CurrentRenderer;
223 
224  // The cached data-to-world matrix
225  vtkMatrix4x4 *DataToWorldMatrix;
226 
227  vtkImageMapper3D(const vtkImageMapper3D&); // Not implemented.
228  void operator=(const vtkImageMapper3D&); // Not implemented.
229 
230  friend class vtkImageToImageMapper3DFriendship;
231 };
232 
233 #endif