VTK
vtkImageWeightedSum.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageWeightedSum.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
28 #ifndef vtkImageWeightedSum_h
29 #define vtkImageWeightedSum_h
30 
31 #include "vtkImagingMathModule.h" // For export macro
33 
34 class vtkDoubleArray;
35 class VTKIMAGINGMATH_EXPORT vtkImageWeightedSum : public vtkThreadedImageAlgorithm
36 {
37 public:
38  static vtkImageWeightedSum *New();
40  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
41 
43 
47  virtual void SetWeights(vtkDoubleArray*);
48  vtkGetObjectMacro(Weights, vtkDoubleArray);
50 
54  virtual void SetWeight(vtkIdType id, double weight);
55 
57 
63  vtkGetMacro(NormalizeByWeight, int);
64  vtkSetClampMacro(NormalizeByWeight, int, 0, 1);
65  vtkBooleanMacro(NormalizeByWeight, int);
67 
71  double CalculateTotalWeight();
72 
73 protected:
75  ~vtkImageWeightedSum() VTK_OVERRIDE;
76 
77  // Array to hold all the weights
78  vtkDoubleArray *Weights;
79 
80  // Boolean flag to divide by sum or not
81  int NormalizeByWeight;
82 
83  int RequestInformation (vtkInformation * vtkNotUsed(request),
84  vtkInformationVector** vtkNotUsed( inputVector ),
85  vtkInformationVector *outputVector) VTK_OVERRIDE;
86 
87  void ThreadedRequestData (vtkInformation* request,
88  vtkInformationVector** inputVector,
89  vtkInformationVector* outputVector,
90  vtkImageData ***inData, vtkImageData **outData,
91  int ext[6], int id) VTK_OVERRIDE;
92  int FillInputPortInformation(int i, vtkInformation* info) VTK_OVERRIDE;
93 
94 private:
95  vtkImageWeightedSum(const vtkImageWeightedSum&) VTK_DELETE_FUNCTION;
96  void operator=(const vtkImageWeightedSum&) VTK_DELETE_FUNCTION;
97 };
98 
99 #endif
100 
Store vtkAlgorithm input/output information.
int vtkIdType
Definition: vtkType.h:345
dynamic, self-adjusting array of double
Generic filter that has one input.
adds any number of images, weighting each according to the weight set using this->SetWeights(i,w).
a simple class to control print indentation
Definition: vtkIndent.h:33
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.