VTK
vtkImageDifference.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageDifference.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 =========================================================================*/
37 #ifndef vtkImageDifference_h
38 #define vtkImageDifference_h
39 
40 #include "vtkImagingCoreModule.h" // For export macro
42 
43 class vtkImageDifferenceThreadData;
44 class vtkImageDifferenceSMPThreadLocal;
45 
46 class VTKIMAGINGCORE_EXPORT vtkImageDifference : public vtkThreadedImageAlgorithm
47 {
48 public:
49  static vtkImageDifference *New();
51  void PrintSelf(ostream& os, vtkIndent indent) override;
52 
54 
58  {
59  this->SetInputConnection(1, output);
60  }
61  void SetImageData(vtkDataObject *image) {this->SetInputData(1,image);}
62  vtkImageData *GetImage();
64 
68  double GetError() { return this->Error; }
69  void GetError(double *e) { *e = this->GetError(); };
70 
76  double GetThresholdedError() { return this->ThresholdedError; }
77  void GetThresholdedError(double *e) { *e = this->GetThresholdedError(); };
78 
80 
83  vtkSetMacro(Threshold,int);
84  vtkGetMacro(Threshold,int);
86 
88 
95  vtkSetMacro(AllowShift,vtkTypeBool);
96  vtkGetMacro(AllowShift,vtkTypeBool);
97  vtkBooleanMacro(AllowShift,vtkTypeBool);
99 
101 
107  vtkSetMacro(Averaging,vtkTypeBool);
108  vtkGetMacro(Averaging,vtkTypeBool);
109  vtkBooleanMacro(Averaging,vtkTypeBool);
111 
112 protected:
114  ~vtkImageDifference() override {}
115 
116  // Parameters
120 
121  // Outputs
122  const char *ErrorMessage;
123  double Error;
125 
128  vtkInformationVector *) override;
131  vtkInformationVector *) override;
134  vtkInformationVector *) override;
135 
136  void ThreadedRequestData(vtkInformation *request,
137  vtkInformationVector **inputVector,
138  vtkInformationVector *outputVector,
139  vtkImageData ***inData,
140  vtkImageData **outData,
141  int extent[6], int threadId) override;
142 
143  // Used for vtkMultiThreader operation.
144  vtkImageDifferenceThreadData *ThreadData;
145 
146  // Used for vtkSMPTools operation.
147  vtkImageDifferenceSMPThreadLocal *SMPThreadData;
148 
149 private:
150  vtkImageDifference(const vtkImageDifference&) = delete;
151  void operator=(const vtkImageDifference&) = delete;
152 
153  friend class vtkImageDifferenceSMPFunctor;
154 };
155 
156 #endif
157 
158 
void GetError(double *e)
Store vtkAlgorithm input/output information.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
Compares images for regression tests.
void SetImageData(vtkDataObject *image)
Specify the Image to compare the input to.
void GetThresholdedError(double *e)
void SetInputData(vtkDataObject *)
Assign a data object as input.
double GetError()
Return the total error in comparing the two images.
void SetImageConnection(vtkAlgorithmOutput *output)
Specify the Image to compare the input to.
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Subclasses can reimplement this method to translate the update extent requests from each output port ...
Proxy object to connect input/output ports.
int vtkTypeBool
Definition: vtkABI.h:69
Generic filter that has one input.
a simple class to control print indentation
Definition: vtkIndent.h:33
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
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 SetInputConnection(int port, vtkAlgorithmOutput *input)
Set the connection for the given input port index.
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,...
vtkImageDifferenceThreadData * ThreadData
vtkImageDifferenceSMPThreadLocal * SMPThreadData
double GetThresholdedError()
Return the total thresholded error in comparing the two images.
~vtkImageDifference() override
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.
general representation of visualization data
Definition: vtkDataObject.h:58