VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkImageBlend.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 =========================================================================*/ 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 vtkTypeMacro(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 void ThreadedRequestData (vtkInformation* request, 00167 vtkInformationVector** inputVector, 00168 vtkInformationVector* outputVector, 00169 vtkImageData ***inData, vtkImageData **outData, 00170 int ext[6], int id); 00171 00172 // see vtkAlgorithm for docs. 00173 virtual int FillInputPortInformation(int, vtkInformation*); 00174 00175 // see vtkAlgorithm for docs. 00176 virtual int RequestData(vtkInformation* request, 00177 vtkInformationVector** inputVector, 00178 vtkInformationVector* outputVector); 00179 00180 double *Opacity; 00181 int OpacityArrayLength; 00182 int BlendMode; 00183 double CompoundThreshold; 00184 int DataWasPassed; 00185 00186 private: 00187 vtkImageBlend(const vtkImageBlend&); // Not implemented. 00188 void operator=(const vtkImageBlend&); // Not implemented. 00189 }; 00190 00192 00193 inline const char *vtkImageBlend::GetBlendModeAsString() 00194 { 00195 switch (this->BlendMode) 00196 { 00197 case VTK_IMAGE_BLEND_MODE_NORMAL: 00198 return "Normal"; 00199 case VTK_IMAGE_BLEND_MODE_COMPOUND: 00200 return "Compound"; 00201 default: 00202 return "Unknown Blend Mode"; 00203 } 00204 } 00206 00207 00208 #endif 00209 00210 00211 00212