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 =========================================================================*/
29 #ifndef vtkImageDifference_h
30 #define vtkImageDifference_h
31 
32 #include "vtkImagingCoreModule.h" // For export macro
34 
35 class vtkImageDifferenceThreadData;
36 class vtkImageDifferenceSMPThreadLocal;
37 
38 class VTKIMAGINGCORE_EXPORT vtkImageDifference : public vtkThreadedImageAlgorithm
39 {
40 public:
41  static vtkImageDifference *New();
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
46 
50  {
51  this->SetInputConnection(1, output);
52  }
53  void SetImageData(vtkDataObject *image) {this->SetInputData(1,image);}
54  vtkImageData *GetImage();
56 
60  double GetError() { return this->Error; }
61  void GetError(double *e) { *e = this->GetError(); };
62 
68  double GetThresholdedError() { return this->ThresholdedError; }
69  void GetThresholdedError(double *e) { *e = this->GetThresholdedError(); };
70 
72 
75  vtkSetMacro(Threshold,int);
76  vtkGetMacro(Threshold,int);
78 
80 
87  vtkSetMacro(AllowShift,vtkTypeBool);
88  vtkGetMacro(AllowShift,vtkTypeBool);
89  vtkBooleanMacro(AllowShift,vtkTypeBool);
91 
93 
99  vtkSetMacro(Averaging,vtkTypeBool);
100  vtkGetMacro(Averaging,vtkTypeBool);
101  vtkBooleanMacro(Averaging,vtkTypeBool);
103 
105 
109  vtkSetMacro(AverageThresholdFactor,double);
110  vtkGetMacro(AverageThresholdFactor,double);
112 
113 protected:
115  ~vtkImageDifference() override {}
116 
117  // Parameters
121 
122  // Outputs
123  const char *ErrorMessage;
124  double Error;
127 
130  vtkInformationVector *) override;
133  vtkInformationVector *) override;
136  vtkInformationVector *) override;
137 
138  void ThreadedRequestData(vtkInformation *request,
139  vtkInformationVector **inputVector,
140  vtkInformationVector *outputVector,
141  vtkImageData ***inData,
142  vtkImageData **outData,
143  int extent[6], int threadId) override;
144 
145  // Used for vtkMultiThreader operation.
146  vtkImageDifferenceThreadData *ThreadData;
147 
148  // Used for vtkSMPTools operation.
149  vtkImageDifferenceSMPThreadLocal *SMPThreadData;
150 
151 private:
152  vtkImageDifference(const vtkImageDifference&) = delete;
153  void operator=(const vtkImageDifference&) = delete;
154 
155  friend class vtkImageDifferenceSMPFunctor;
156 };
157 
158 #endif
159 
160 
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:125
vtkImageDifference::GetThresholdedError
void GetThresholdedError(double *e)
Definition: vtkImageDifference.h:69
vtkImageDifference::SetImageData
void SetImageData(vtkDataObject *image)
Definition: vtkImageDifference.h:53
vtkImageDifference::SetImageConnection
void SetImageConnection(vtkAlgorithmOutput *output)
Specify the Image to compare the input to.
Definition: vtkImageDifference.h:49
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkImageDifference
Compares images for regression tests.
Definition: vtkImageDifference.h:38
vtkX3D::image
Definition: vtkX3D.h:374
vtkThreadedImageAlgorithm
Generic filter that has one input.
Definition: vtkThreadedImageAlgorithm.h:37
vtkImageDifference::GetError
void GetError(double *e)
Definition: vtkImageDifference.h:61
vtkImageDifference::AllowShift
vtkTypeBool AllowShift
Definition: vtkImageDifference.h:118
vtkThreadedImageAlgorithm.h
vtkImageDifference::AverageThresholdFactor
double AverageThresholdFactor
Definition: vtkImageDifference.h:126
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:68
vtkImageDifference::ThreadData
vtkImageDifferenceThreadData * ThreadData
Definition: vtkImageDifference.h:146
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:60
vtkImageDifference::SMPThreadData
vtkImageDifferenceSMPThreadLocal * SMPThreadData
Definition: vtkImageDifference.h:149
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkImageDifference::ErrorMessage
const char * ErrorMessage
Definition: vtkImageDifference.h:123
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:80
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkImageDifference::Error
double Error
Definition: vtkImageDifference.h:124
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:36
vtkImageDifference::Averaging
vtkTypeBool Averaging
Definition: vtkImageDifference.h:120
vtkX3D::extent
Definition: vtkX3D.h:345
vtkImageDifference::Threshold
int Threshold
Definition: vtkImageDifference.h:119
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:58
vtkThreadedImageAlgorithm::RequestData
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
vtkImageDifference::~vtkImageDifference
~vtkImageDifference() override
Definition: vtkImageDifference.h:115
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69