VTK
dox/Imaging/vtkImageWeightedSum.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkImageWeightedSum.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 =========================================================================*/
00030 #ifndef __vtkImageWeightedSum_h
00031 #define __vtkImageWeightedSum_h
00032 
00033 #include "vtkThreadedImageAlgorithm.h"
00034 
00035 class vtkDoubleArray;
00036 class VTK_IMAGING_EXPORT vtkImageWeightedSum : public vtkThreadedImageAlgorithm
00037 {
00038 public:
00039   static vtkImageWeightedSum *New();
00040   vtkTypeMacro(vtkImageWeightedSum,vtkThreadedImageAlgorithm);
00041   void PrintSelf(ostream& os, vtkIndent indent);
00042 
00044 
00046   virtual void SetWeights(vtkDoubleArray*);
00047   vtkGetObjectMacro(Weights, vtkDoubleArray);
00049 
00051   virtual void SetWeight(vtkIdType id, double weight);
00052 
00054 
00058   vtkGetMacro(NormalizeByWeight, int);
00059   vtkSetClampMacro(NormalizeByWeight, int, 0, 1);
00060   vtkBooleanMacro(NormalizeByWeight, int);
00062 
00064   double CalculateTotalWeight();
00065 
00066 protected:
00067   vtkImageWeightedSum();
00068   ~vtkImageWeightedSum();
00069 
00070   // Array to hold all the weights
00071   vtkDoubleArray *Weights;
00072 
00073   // Boolean flag to divide by sum or not
00074   int NormalizeByWeight;
00075 
00076   int RequestInformation (vtkInformation * vtkNotUsed(request),
00077     vtkInformationVector** vtkNotUsed( inputVector ),
00078     vtkInformationVector *outputVector);
00079 
00080   void ThreadedRequestData (vtkInformation* request,
00081                             vtkInformationVector** inputVector,
00082                             vtkInformationVector* outputVector,
00083                             vtkImageData ***inData, vtkImageData **outData,
00084                             int ext[6], int id);
00085   int FillInputPortInformation(int i, vtkInformation* info);
00086 
00087 private:
00088   vtkImageWeightedSum(const vtkImageWeightedSum&);  // Not implemented.
00089   void operator=(const vtkImageWeightedSum&);  // Not implemented.
00090 };
00091 
00092 #endif
00093