VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkImageBlend.h,v $ 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 =========================================================================*/ 00076 #ifndef __vtkImageBlend_h 00077 #define __vtkImageBlend_h 00078 00079 00080 #include "vtkThreadedImageAlgorithm.h" 00081 00082 class vtkImageStencilData; 00083 00084 #define VTK_IMAGE_BLEND_MODE_NORMAL 0 00085 #define VTK_IMAGE_BLEND_MODE_COMPOUND 1 00086 00087 class VTK_IMAGING_EXPORT vtkImageBlend : public vtkThreadedImageAlgorithm 00088 { 00089 public: 00090 static vtkImageBlend *New(); 00091 vtkTypeRevisionMacro(vtkImageBlend,vtkThreadedImageAlgorithm); 00092 void PrintSelf(ostream& os, vtkIndent indent); 00093 00098 virtual void ReplaceNthInputConnection(int idx, vtkAlgorithmOutput* input); 00099 00101 00105 void SetInput(int num, vtkDataObject *input); 00106 void SetInput(vtkDataObject *input) { this->SetInput(0, input); }; 00108 00110 00113 vtkDataObject *GetInput(int num); 00114 vtkDataObject *GetInput() { return this->GetInput(0); }; 00116 00120 int GetNumberOfInputs() { return this->GetNumberOfInputConnections(0); }; 00121 00123 00125 void SetOpacity(int idx, double opacity); 00126 double GetOpacity(int idx); 00128 00130 00131 void SetStencil(vtkImageStencilData *stencil); 00132 vtkImageStencilData *GetStencil(); 00134 00136 00137 vtkSetClampMacro(BlendMode,int, 00138 VTK_IMAGE_BLEND_MODE_NORMAL, 00139 VTK_IMAGE_BLEND_MODE_COMPOUND ); 00140 vtkGetMacro(BlendMode,int); 00141 void SetBlendModeToNormal() 00142 {this->SetBlendMode(VTK_IMAGE_BLEND_MODE_NORMAL);}; 00143 void SetBlendModeToCompound() 00144 {this->SetBlendMode(VTK_IMAGE_BLEND_MODE_COMPOUND);}; 00145 const char *GetBlendModeAsString(void); 00147 00149 00151 vtkSetMacro(CompoundThreshold,double); 00152 vtkGetMacro(CompoundThreshold,double); 00154 00155 protected: 00156 vtkImageBlend(); 00157 ~vtkImageBlend(); 00158 00159 virtual int RequestUpdateExtent(vtkInformation *, 00160 vtkInformationVector **, 00161 vtkInformationVector *); 00162 00163 void InternalComputeInputUpdateExtent(int inExt[6], int outExt[6], 00164 int inWExtent[6]); 00165 00166 00167 00168 virtual int RequestInformation (vtkInformation *, 00169 vtkInformationVector **, 00170 vtkInformationVector *); 00171 00172 void ThreadedRequestData (vtkInformation* request, 00173 vtkInformationVector** inputVector, 00174 vtkInformationVector* outputVector, 00175 vtkImageData ***inData, vtkImageData **outData, 00176 int ext[6], int id); 00177 00178 // see vtkAlgorithm for docs. 00179 virtual int FillInputPortInformation(int, vtkInformation*); 00180 00181 // see vtkAlgorithm for docs. 00182 virtual int RequestData(vtkInformation* request, 00183 vtkInformationVector** inputVector, 00184 vtkInformationVector* outputVector); 00185 00186 double *Opacity; 00187 int OpacityArrayLength; 00188 int BlendMode; 00189 double CompoundThreshold; 00190 int DataWasPassed; 00191 00192 private: 00193 vtkImageBlend(const vtkImageBlend&); // Not implemented. 00194 void operator=(const vtkImageBlend&); // Not implemented. 00195 }; 00196 00198 inline const char *vtkImageBlend::GetBlendModeAsString() 00199 { 00200 switch (this->BlendMode) 00201 { 00202 case VTK_IMAGE_BLEND_MODE_NORMAL: 00203 return "Normal"; 00204 case VTK_IMAGE_BLEND_MODE_COMPOUND: 00205 return "Compound"; 00206 default: 00207 return "Unknown Blend Mode"; 00208 } 00209 } 00210 00211 00212 #endif 00213 00214 00215 00216