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 =========================================================================*/
31 #ifndef vtkImageWeightedSum_h
32 #define vtkImageWeightedSum_h
33 
34 #include "vtkImagingMathModule.h" // For export macro
36 
37 class vtkDoubleArray;
38 class VTKIMAGINGMATH_EXPORT vtkImageWeightedSum : public vtkThreadedImageAlgorithm
39 {
40 public:
41  static vtkImageWeightedSum *New();
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
46 
50  virtual void SetWeights(vtkDoubleArray*);
51  vtkGetObjectMacro(Weights, vtkDoubleArray);
53 
57  virtual void SetWeight(vtkIdType id, double weight);
58 
60 
66  vtkGetMacro(NormalizeByWeight, vtkTypeBool);
67  vtkSetClampMacro(NormalizeByWeight, vtkTypeBool, 0, 1);
68  vtkBooleanMacro(NormalizeByWeight, vtkTypeBool);
70 
74  double CalculateTotalWeight();
75 
76 protected:
78  ~vtkImageWeightedSum() override;
79 
80  // Array to hold all the weights
82 
83  // Boolean flag to divide by sum or not
85 
86  int RequestInformation (vtkInformation * vtkNotUsed(request),
87  vtkInformationVector** vtkNotUsed( inputVector ),
88  vtkInformationVector *outputVector) override;
89 
90  void ThreadedRequestData (vtkInformation* request,
91  vtkInformationVector** inputVector,
92  vtkInformationVector* outputVector,
93  vtkImageData ***inData, vtkImageData **outData,
94  int ext[6], int id) override;
95  int FillInputPortInformation(int i, vtkInformation* info) override;
96 
97 private:
99  void operator=(const vtkImageWeightedSum&) = delete;
100 };
101 
102 #endif
103 
vtkThreadedImageAlgorithm::ThreadedRequestData
virtual void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, int extent[6], int threadId)
If the subclass does not define an Execute method, then the task will be broken up,...
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkImageWeightedSum::Weights
vtkDoubleArray * Weights
Definition: vtkImageWeightedSum.h:81
vtkX3D::weight
Definition: vtkX3D.h:532
vtkThreadedImageAlgorithm
Generic filter that has one input.
Definition: vtkThreadedImageAlgorithm.h:43
vtkThreadedImageAlgorithm.h
vtkImageWeightedSum::NormalizeByWeight
vtkTypeBool NormalizeByWeight
Definition: vtkImageWeightedSum.h:84
vtkImageAlgorithm::RequestInformation
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Subclasses can reimplement this method to collect information from their inputs and set information f...
vtkThreadedImageAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkX3D::info
Definition: vtkX3D.h:376
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkImageWeightedSum
adds any number of images, weighting each according to the weight set using this->SetWeights(i,...
Definition: vtkImageWeightedSum.h:38
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:41
vtkImageAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69