VTK
dox/Rendering/Core/vtkImageMapper3D.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkImageMapper3D.h
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 =========================================================================*/
00031 #ifndef __vtkImageMapper3D_h
00032 #define __vtkImageMapper3D_h
00033 
00034 #include "vtkRenderingCoreModule.h" // For export macro
00035 #include "vtkAbstractMapper3D.h"
00036 
00037 class vtkRenderer;
00038 class vtkProp3D;
00039 class vtkPoints;
00040 class vtkMatrix4x4;
00041 class vtkLookupTable;
00042 class vtkScalarsToColors;
00043 class vtkImageSlice;
00044 class vtkImageProperty;
00045 class vtkImageData;
00046 class vtkMultiThreader;
00047 class vtkImageToImageMapper3DFriendship;
00048 
00049 class VTKRENDERINGCORE_EXPORT vtkImageMapper3D : public vtkAbstractMapper3D
00050 {
00051 public:
00052   vtkTypeMacro(vtkImageMapper3D, vtkAbstractMapper3D);
00053   void PrintSelf(ostream& os, vtkIndent indent);
00054 
00056   virtual void Render(vtkRenderer *renderer, vtkImageSlice *prop) = 0;
00057 
00061   virtual void ReleaseGraphicsResources(vtkWindow *) = 0;
00062 
00064 
00065   void SetInputData(vtkImageData *input);
00066   vtkImageData *GetInput();
00067   vtkDataSet *GetDataSetInput();
00068   vtkDataObject *GetDataObjectInput();
00070 
00072 
00075   vtkSetMacro(Border, int);
00076   vtkBooleanMacro(Border, int);
00077   vtkGetMacro(Border, int);
00079 
00081 
00085   vtkSetMacro(Background, int);
00086   vtkBooleanMacro(Background, int);
00087   vtkGetMacro(Background, int);
00089 
00091 
00094   vtkSetMacro(SliceAtFocalPoint, int);
00095   vtkBooleanMacro(SliceAtFocalPoint, int);
00096   vtkGetMacro(SliceAtFocalPoint, int);
00098 
00100 
00103   vtkSetMacro(SliceFacesCamera, int);
00104   vtkBooleanMacro(SliceFacesCamera, int);
00105   vtkGetMacro(SliceFacesCamera, int);
00107 
00109 
00114   vtkGetObjectMacro(SlicePlane, vtkPlane);
00116 
00118 
00121   virtual void GetSlicePlaneInDataCoords(vtkMatrix4x4 *propMatrix,
00122                                          double plane[4]);
00124 
00126 
00127   vtkSetClampMacro(NumberOfThreads, int, 1, VTK_MAX_THREADS);
00128   vtkGetMacro(NumberOfThreads, int);
00130 
00131 protected:
00132   vtkImageMapper3D();
00133   ~vtkImageMapper3D();
00134 
00136 
00137   virtual int FillInputPortInformation(int port, vtkInformation* info);
00138   virtual int FillOutputPortInformation(int port, vtkInformation* info);
00140 
00142 
00143   virtual int ProcessRequest(vtkInformation* request,
00144                              vtkInformationVector** inInfo,
00145                              vtkInformationVector* outInfo);
00147 
00149 
00151   static void CheckerboardRGBA(
00152     unsigned char *data, int xsize, int ysize,
00153     double originx, double originy, double spacingx, double spacingy);
00155 
00157 
00160   unsigned char *MakeTextureData(
00161     vtkImageProperty *property, vtkImageData *input, int extent[6],
00162     int &xsize, int &ysize, int &bytesPerPixel, bool &reuseTexture,
00163     bool &reuseData);
00165 
00167 
00169   void MakeTextureGeometry(
00170     const int extent[6], double coords[12], double tcoords[8]);
00172 
00174 
00179   virtual void ComputeTextureSize(
00180     const int extent[6], int &xdim, int &ydim,
00181     int imageSize[2], int textureSize[2]);
00183 
00186   vtkRenderer *GetCurrentRenderer();
00187 
00189   vtkImageSlice *GetCurrentProp() { return this->CurrentProp; }
00190 
00193   vtkMatrix4x4 *GetDataToWorldMatrix();
00194 
00197   void GetBackgroundColor(vtkImageProperty *property, double color[4]);
00198 
00199   int Border;
00200   int Background;
00201   vtkScalarsToColors *DefaultLookupTable;
00202   vtkMultiThreader *Threader;
00203   int NumberOfThreads;
00204 
00205   // The slice.
00206   vtkPlane *SlicePlane;
00207   int SliceAtFocalPoint;
00208   int SliceFacesCamera;
00209 
00210   // Information about the image, updated by UpdateInformation
00211   double DataSpacing[3];
00212   double DataOrigin[3];
00213   int DataWholeExtent[6];
00214 
00215   // Set by vtkImageStack when doing multi-pass rendering
00216   bool MatteEnable;
00217   bool ColorEnable;
00218   bool DepthEnable;
00219 
00220 private:
00221   // The prop this mapper is attached to, or zero if none.
00222   vtkImageSlice *CurrentProp;
00223   vtkRenderer *CurrentRenderer;
00224 
00225   // The cached data-to-world matrix
00226   vtkMatrix4x4 *DataToWorldMatrix;
00227 
00228   vtkImageMapper3D(const vtkImageMapper3D&);  // Not implemented.
00229   void operator=(const vtkImageMapper3D&);  // Not implemented.
00230 
00231   friend class vtkImageToImageMapper3DFriendship;
00232 };
00233 
00234 #endif