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 "vtkImagingCoreModule.h" // For export macro 00081 #include "vtkThreadedImageAlgorithm.h" 00082 00083 class vtkImageStencilData; 00084 00085 #define VTK_IMAGE_BLEND_MODE_NORMAL 0 00086 #define VTK_IMAGE_BLEND_MODE_COMPOUND 1 00087 00088 class VTKIMAGINGCORE_EXPORT vtkImageBlend : public vtkThreadedImageAlgorithm 00089 { 00090 public: 00091 static vtkImageBlend *New(); 00092 vtkTypeMacro(vtkImageBlend,vtkThreadedImageAlgorithm); 00093 void PrintSelf(ostream& os, vtkIndent indent); 00094 00099 virtual void ReplaceNthInputConnection(int idx, vtkAlgorithmOutput* input); 00100 00102 00105 void SetInputData(int num, vtkDataObject *input); 00106 void SetInputData(vtkDataObject *input) { this->SetInputData(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 00131 void SetStencilConnection(vtkAlgorithmOutput *algOutput); 00132 00134 00135 void SetStencilData(vtkImageStencilData *stencil); 00136 vtkImageStencilData *GetStencil(); 00138 00140 00141 vtkSetClampMacro(BlendMode,int, 00142 VTK_IMAGE_BLEND_MODE_NORMAL, 00143 VTK_IMAGE_BLEND_MODE_COMPOUND ); 00144 vtkGetMacro(BlendMode,int); 00145 void SetBlendModeToNormal() 00146 {this->SetBlendMode(VTK_IMAGE_BLEND_MODE_NORMAL);}; 00147 void SetBlendModeToCompound() 00148 {this->SetBlendMode(VTK_IMAGE_BLEND_MODE_COMPOUND);}; 00149 const char *GetBlendModeAsString(void); 00151 00153 00155 vtkSetMacro(CompoundThreshold,double); 00156 vtkGetMacro(CompoundThreshold,double); 00158 00159 protected: 00160 vtkImageBlend(); 00161 ~vtkImageBlend(); 00162 00163 virtual int RequestUpdateExtent(vtkInformation *, 00164 vtkInformationVector **, 00165 vtkInformationVector *); 00166 00167 void InternalComputeInputUpdateExtent(int inExt[6], int outExt[6], 00168 int inWExtent[6]); 00169 00170 void ThreadedRequestData (vtkInformation* request, 00171 vtkInformationVector** inputVector, 00172 vtkInformationVector* outputVector, 00173 vtkImageData ***inData, vtkImageData **outData, 00174 int ext[6], int id); 00175 00176 // see vtkAlgorithm for docs. 00177 virtual int FillInputPortInformation(int, vtkInformation*); 00178 00179 // see vtkAlgorithm for docs. 00180 virtual int RequestData(vtkInformation* request, 00181 vtkInformationVector** inputVector, 00182 vtkInformationVector* outputVector); 00183 00184 double *Opacity; 00185 int OpacityArrayLength; 00186 int BlendMode; 00187 double CompoundThreshold; 00188 int DataWasPassed; 00189 00190 private: 00191 vtkImageBlend(const vtkImageBlend&); // Not implemented. 00192 void operator=(const vtkImageBlend&); // Not implemented. 00193 }; 00194 00196 00197 inline const char *vtkImageBlend::GetBlendModeAsString() 00198 { 00199 switch (this->BlendMode) 00200 { 00201 case VTK_IMAGE_BLEND_MODE_NORMAL: 00202 return "Normal"; 00203 case VTK_IMAGE_BLEND_MODE_COMPOUND: 00204 return "Compound"; 00205 default: 00206 return "Unknown Blend Mode"; 00207 } 00208 } 00210 00211 00212 #endif 00213 00214 00215 00216