Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Imaging/vtkImageBlend.h

Go to the documentation of this file.
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 "vtkImageMultipleInputFilter.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 vtkImageMultipleInputFilter
00088 {
00089 public:
00090   static vtkImageBlend *New();
00091   vtkTypeRevisionMacro(vtkImageBlend,vtkImageMultipleInputFilter);
00092   void PrintSelf(ostream& os, vtkIndent indent);
00093 
00095 
00097   void SetOpacity(int idx, double opacity);
00098   double GetOpacity(int idx);
00100 
00102 
00103   virtual void SetStencil(vtkImageStencilData*);
00104   vtkGetObjectMacro(Stencil, vtkImageStencilData);
00106 
00108 
00109   vtkSetClampMacro(BlendMode,int,
00110                    VTK_IMAGE_BLEND_MODE_NORMAL, 
00111                    VTK_IMAGE_BLEND_MODE_COMPOUND );
00112   vtkGetMacro(BlendMode,int);
00113   void SetBlendModeToNormal() 
00114         {this->SetBlendMode(VTK_IMAGE_BLEND_MODE_NORMAL);};
00115   void SetBlendModeToCompound() 
00116         {this->SetBlendMode(VTK_IMAGE_BLEND_MODE_COMPOUND);};
00117   const char *GetBlendModeAsString(void);
00119 
00121 
00123   vtkSetMacro(CompoundThreshold,double);
00124   vtkGetMacro(CompoundThreshold,double);
00126 
00127 protected:
00128   vtkImageBlend();
00129   ~vtkImageBlend();
00130 
00131   void ComputeInputUpdateExtent(int inExt[6], int outExt[6],
00132                                 int whichInput);
00133 
00134   void ExecuteInformation() {
00135     this->vtkImageMultipleInputFilter::ExecuteInformation(); };
00136 
00137   void ExecuteInformation(vtkImageData **, vtkImageData *);
00138 
00139   void ThreadedExecute(vtkImageData **inDatas, 
00140                        vtkImageData *outData,
00141                        int extent[6], 
00142                        int id);
00143 
00144   void ExecuteData(vtkDataObject *output);
00145   
00146   vtkImageStencilData *Stencil;
00147   double *Opacity;
00148   int OpacityArrayLength;
00149   int BlendMode;
00150   double CompoundThreshold;
00151   int DataWasPassed;  
00152 private:
00153   vtkImageBlend(const vtkImageBlend&);  // Not implemented.
00154   void operator=(const vtkImageBlend&);  // Not implemented.
00155 };
00156 
00158 inline const char *vtkImageBlend::GetBlendModeAsString()
00159 {
00160   switch (this->BlendMode)
00161     {
00162     case VTK_IMAGE_BLEND_MODE_NORMAL:
00163       return "Normal";
00164     case VTK_IMAGE_BLEND_MODE_COMPOUND:
00165       return "Compound";
00166     default:
00167       return "Unknown Blend Mode";
00168     }
00169 }
00170 
00171 
00172 #endif
00173 
00174 
00175 
00176