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 =========================================================================*/
32 #ifndef vtkImageDifference_h
33 #define vtkImageDifference_h
34 
35 #include "vtkImagingCoreModule.h" // For export macro
37 
38 class vtkImageDifferenceThreadData;
39 class vtkImageDifferenceSMPThreadLocal;
40 
41 class VTKIMAGINGCORE_EXPORT vtkImageDifference : public vtkThreadedImageAlgorithm
42 {
43 public:
44  static vtkImageDifference *New();
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
49 
53  {
54  this->SetInputConnection(1, output);
55  }
56  void SetImageData(vtkDataObject *image) {this->SetInputData(1,image);}
57  vtkImageData *GetImage();
59 
63  double GetError() { return this->Error; }
64  void GetError(double *e) { *e = this->GetError(); };
65 
71  double GetThresholdedError() { return this->ThresholdedError; }
72  void GetThresholdedError(double *e) { *e = this->GetThresholdedError(); };
73 
75 
78  vtkSetMacro(Threshold,int);
79  vtkGetMacro(Threshold,int);
81 
83 
90  vtkSetMacro(AllowShift,vtkTypeBool);
91  vtkGetMacro(AllowShift,vtkTypeBool);
92  vtkBooleanMacro(AllowShift,vtkTypeBool);
94 
96 
102  vtkSetMacro(Averaging,vtkTypeBool);
103  vtkGetMacro(Averaging,vtkTypeBool);
104  vtkBooleanMacro(Averaging,vtkTypeBool);
106 
108 
112  vtkSetMacro(AverageThresholdFactor,double);
113  vtkGetMacro(AverageThresholdFactor,double);
115 
116 protected:
118  ~vtkImageDifference() override {}
119 
120  // Parameters
124 
125  // Outputs
126  const char *ErrorMessage;
127  double Error;
130 
133  vtkInformationVector *) override;
136  vtkInformationVector *) override;
139  vtkInformationVector *) override;
140 
141  void ThreadedRequestData(vtkInformation *request,
142  vtkInformationVector **inputVector,
143  vtkInformationVector *outputVector,
144  vtkImageData ***inData,
145  vtkImageData **outData,
146  int extent[6], int threadId) override;
147 
148  // Used for vtkMultiThreader operation.
149  vtkImageDifferenceThreadData *ThreadData;
150 
151  // Used for vtkSMPTools operation.
152  vtkImageDifferenceSMPThreadLocal *SMPThreadData;
153 
154 private:
155  vtkImageDifference(const vtkImageDifference&) = delete;
156  void operator=(const vtkImageDifference&) = delete;
157 
158  friend class vtkImageDifferenceSMPFunctor;
159 };
160 
161 #endif
162 
163 
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,...
vtkImageDifference::ThresholdedError
double ThresholdedError
Definition: vtkImageDifference.h:128
vtkImageDifference::GetThresholdedError
void GetThresholdedError(double *e)
Definition: vtkImageDifference.h:72
vtkImageDifference::SetImageData
void SetImageData(vtkDataObject *image)
Definition: vtkImageDifference.h:56
vtkImageDifference::SetImageConnection
void SetImageConnection(vtkAlgorithmOutput *output)
Specify the Image to compare the input to.
Definition: vtkImageDifference.h:52
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkImageDifference
Compares images for regression tests.
Definition: vtkImageDifference.h:41
vtkX3D::image
Definition: vtkX3D.h:374
vtkThreadedImageAlgorithm
Generic filter that has one input.
Definition: vtkThreadedImageAlgorithm.h:43
vtkImageDifference::GetError
void GetError(double *e)
Definition: vtkImageDifference.h:64
vtkImageDifference::AllowShift
vtkTypeBool AllowShift
Definition: vtkImageDifference.h:121
vtkThreadedImageAlgorithm.h
vtkImageDifference::AverageThresholdFactor
double AverageThresholdFactor
Definition: vtkImageDifference.h:129
vtkImageAlgorithm::SetInputData
void SetInputData(vtkDataObject *)
Assign a data object as input.
vtkImageAlgorithm::RequestUpdateExtent
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Subclasses can reimplement this method to translate the update extent requests from each output port ...
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...
vtkImageDifference::GetThresholdedError
double GetThresholdedError()
Return the total thresholded error in comparing the two images.
Definition: vtkImageDifference.h:71
vtkImageDifference::ThreadData
vtkImageDifferenceThreadData * ThreadData
Definition: vtkImageDifference.h:149
vtkThreadedImageAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkImageDifference::GetError
double GetError()
Return the total error in comparing the two images.
Definition: vtkImageDifference.h:63
vtkImageDifference::SMPThreadData
vtkImageDifferenceSMPThreadLocal * SMPThreadData
Definition: vtkImageDifference.h:152
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkImageDifference::ErrorMessage
const char * ErrorMessage
Definition: vtkImageDifference.h:126
vtkAlgorithm::SetInputConnection
virtual void SetInputConnection(int port, vtkAlgorithmOutput *input)
Set the connection for the given input port index.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkImageDifference::Error
double Error
Definition: vtkImageDifference.h:127
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:39
vtkImageDifference::Averaging
vtkTypeBool Averaging
Definition: vtkImageDifference.h:123
vtkX3D::extent
Definition: vtkX3D.h:345
vtkImageDifference::Threshold
int Threshold
Definition: vtkImageDifference.h:122
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
vtkThreadedImageAlgorithm::RequestData
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
vtkImageDifference::~vtkImageDifference
~vtkImageDifference() override
Definition: vtkImageDifference.h:118
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69