VTK  9.3.1
vtkImageWeightedSum.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
19 #ifndef vtkImageWeightedSum_h
20 #define vtkImageWeightedSum_h
21 
22 #include "vtkImagingMathModule.h" // For export macro
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 class vtkDoubleArray;
27 class VTKIMAGINGMATH_EXPORT vtkImageWeightedSum : public vtkThreadedImageAlgorithm
28 {
29 public:
30  static vtkImageWeightedSum* New();
32  void PrintSelf(ostream& os, vtkIndent indent) override;
33 
35 
39  virtual void SetWeights(vtkDoubleArray*);
40  vtkGetObjectMacro(Weights, vtkDoubleArray);
42 
46  virtual void SetWeight(vtkIdType id, double weight);
47 
49 
55  vtkGetMacro(NormalizeByWeight, vtkTypeBool);
56  vtkSetClampMacro(NormalizeByWeight, vtkTypeBool, 0, 1);
57  vtkBooleanMacro(NormalizeByWeight, vtkTypeBool);
59 
63  double CalculateTotalWeight();
64 
65 protected:
67  ~vtkImageWeightedSum() override;
68 
69  // Array to hold all the weights
71 
72  // Boolean flag to divide by sum or not
74 
75  int RequestInformation(vtkInformation* vtkNotUsed(request),
76  vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector* outputVector) override;
77 
78  void ThreadedRequestData(vtkInformation* request, vtkInformationVector** inputVector,
79  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData, int ext[6],
80  int id) override;
81  int FillInputPortInformation(int i, vtkInformation* info) override;
82 
83 private:
85  void operator=(const vtkImageWeightedSum&) = delete;
86 };
87 
88 VTK_ABI_NAMESPACE_END
89 #endif
Store vtkAlgorithm input/output information.
int vtkIdType
Definition: vtkType.h:315
dynamic, self-adjusting array of double
int vtkTypeBool
Definition: vtkABI.h:64
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:28
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Subclasses can reimplement this method to collect information from their inputs and set information f...
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, multiple threads will be spawned, and each thread will call this method.
int FillInputPortInformation(int port, vtkInformation *info) override
These method should be reimplemented by subclasses that have more than a single input or single outpu...
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.
vtkDoubleArray * Weights