VTK
|
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 "vtkAbstractMapper3D.h" 00035 00036 class vtkRenderer; 00037 class vtkProp3D; 00038 class vtkPoints; 00039 class vtkMatrix4x4; 00040 class vtkLookupTable; 00041 class vtkScalarsToColors; 00042 class vtkImageSlice; 00043 class vtkImageProperty; 00044 class vtkImageData; 00045 class vtkMultiThreader; 00046 class vtkImageToImageMapper3DFriendship; 00047 00048 class VTK_RENDERING_EXPORT vtkImageMapper3D : public vtkAbstractMapper3D 00049 { 00050 public: 00051 vtkTypeMacro(vtkImageMapper3D,vtkAbstractMapper3D); 00052 void PrintSelf(ostream& os, vtkIndent indent); 00053 00055 virtual void Render(vtkRenderer *renderer, vtkImageSlice *prop) = 0; 00056 00060 virtual void ReleaseGraphicsResources(vtkWindow *) = 0; 00061 00063 00064 void SetInput(vtkImageData *input); 00065 vtkImageData *GetInput(); 00066 vtkDataSet *GetDataSetInput(); 00067 vtkDataObject *GetDataObjectInput(); 00069 00071 00074 vtkSetMacro(Border, int); 00075 vtkBooleanMacro(Border, int); 00076 vtkGetMacro(Border, int); 00078 00080 00084 vtkSetMacro(Background, int); 00085 vtkBooleanMacro(Background, int); 00086 vtkGetMacro(Background, int); 00088 00090 00093 vtkSetMacro(SliceAtFocalPoint, int); 00094 vtkBooleanMacro(SliceAtFocalPoint, int); 00095 vtkGetMacro(SliceAtFocalPoint, int); 00097 00099 00102 vtkSetMacro(SliceFacesCamera, int); 00103 vtkBooleanMacro(SliceFacesCamera, int); 00104 vtkGetMacro(SliceFacesCamera, int); 00106 00108 00113 vtkGetObjectMacro(SlicePlane, vtkPlane); 00115 00117 00120 virtual void GetSlicePlaneInDataCoords(vtkMatrix4x4 *propMatrix, 00121 double plane[4]); 00123 00125 00126 vtkSetClampMacro(NumberOfThreads, int, 1, VTK_MAX_THREADS); 00127 vtkGetMacro(NumberOfThreads, int); 00129 00130 protected: 00131 vtkImageMapper3D(); 00132 ~vtkImageMapper3D(); 00133 00135 00136 virtual int FillInputPortInformation(int port, vtkInformation* info); 00137 virtual int FillOutputPortInformation(int port, vtkInformation* info); 00139 00141 00142 virtual int ProcessRequest(vtkInformation* request, 00143 vtkInformationVector** inInfo, 00144 vtkInformationVector* outInfo); 00146 00148 00150 static void CheckerboardRGBA( 00151 unsigned char *data, int xsize, int ysize, 00152 double originx, double originy, double spacingx, double spacingy); 00154 00156 00159 unsigned char *MakeTextureData( 00160 vtkImageProperty *property, vtkImageData *input, int extent[6], 00161 int &xsize, int &ysize, int &bytesPerPixel, bool &reuseTexture, 00162 bool &reuseData); 00164 00166 00168 void MakeTextureGeometry( 00169 const int extent[6], double coords[12], double tcoords[8]); 00171 00173 00178 virtual void ComputeTextureSize( 00179 const int extent[6], int &xdim, int &ydim, 00180 int imageSize[2], int textureSize[2]); 00182 00185 vtkRenderer *GetCurrentRenderer(); 00186 00188 vtkImageSlice *GetCurrentProp() { return this->CurrentProp; } 00189 00192 vtkMatrix4x4 *GetDataToWorldMatrix(); 00193 00196 void GetBackgroundColor(vtkImageProperty *property, double color[4]); 00197 00198 int Border; 00199 int Background; 00200 vtkScalarsToColors *DefaultLookupTable; 00201 vtkMultiThreader *Threader; 00202 int NumberOfThreads; 00203 00204 // The slice. 00205 vtkPlane *SlicePlane; 00206 int SliceAtFocalPoint; 00207 int SliceFacesCamera; 00208 00209 // Information about the image, updated by UpdateInformation 00210 double DataSpacing[3]; 00211 double DataOrigin[3]; 00212 int DataWholeExtent[6]; 00213 00214 // Set by vtkImageStack when doing multi-pass rendering 00215 bool MatteEnable; 00216 bool ColorEnable; 00217 bool DepthEnable; 00218 00219 private: 00220 // The prop this mapper is attached to, or zero if none. 00221 vtkImageSlice *CurrentProp; 00222 vtkRenderer *CurrentRenderer; 00223 00224 // The cached data-to-world matrix 00225 vtkMatrix4x4 *DataToWorldMatrix; 00226 00227 vtkImageMapper3D(const vtkImageMapper3D&); // Not implemented. 00228 void operator=(const vtkImageMapper3D&); // Not implemented. 00229 00230 friend class vtkImageToImageMapper3DFriendship; 00231 }; 00232 00233 #endif