VTK-m  2.0
ImageDifference.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 
11 #ifndef vtk_m_filter_image_processing_ImageDifference_h
12 #define vtk_m_filter_image_processing_ImageDifference_h
13 
15 #include <vtkm/filter/image_processing/vtkm_filter_image_processing_export.h>
16 
17 namespace vtkm
18 {
19 namespace filter
20 {
21 namespace image_processing
22 {
32 class VTKM_FILTER_IMAGE_PROCESSING_EXPORT ImageDifference : public vtkm::filter::FilterField
33 {
34 public:
36 
37  VTKM_CONT vtkm::IdComponent GetAverageRadius() const { return this->AverageRadius; }
38  VTKM_CONT void SetAverageRadius(const vtkm::IdComponent& averageRadius)
39  {
40  this->AverageRadius = averageRadius;
41  }
42 
43  VTKM_CONT vtkm::IdComponent GetPixelShiftRadius() const { return this->PixelShiftRadius; }
44  VTKM_CONT void SetPixelShiftRadius(const vtkm::IdComponent& pixelShiftRadius)
45  {
46  this->PixelShiftRadius = pixelShiftRadius;
47  }
48 
50  {
51  return this->AllowedPixelErrorRatio;
52  }
54  {
55  this->AllowedPixelErrorRatio = pixelErrorRatio;
56  }
57 
58  VTKM_CONT vtkm::FloatDefault GetPixelDiffThreshold() const { return this->PixelDiffThreshold; }
60  {
61  this->PixelDiffThreshold = threshold;
62  }
63 
64  VTKM_CONT bool GetImageDiffWithinThreshold() const { return this->ImageDiffWithinThreshold; }
65  VTKM_CONT void SetThresholdFieldName(const std::string& name) { this->ThresholdFieldName = name; }
66  VTKM_CONT std::string GetThresholdFieldName() const { return this->ThresholdFieldName; }
67 
70  VTKM_CONT
72  const std::string& name,
74  {
75  this->SetActiveField(name, association);
76  }
77 
78  VTKM_CONT std::string GetPrimaryFieldName() const { return this->GetActiveFieldName(); }
80  {
81  return this->GetActiveFieldAssociation();
82  }
83 
86  VTKM_CONT
88  const std::string& name,
90  {
91  this->SetActiveField(1, name, association);
92  }
93 
94  VTKM_CONT std::string GetSecondaryFieldName() const { return this->GetActiveFieldName(1); }
96  {
97  return this->GetActiveFieldAssociation(1);
98  }
99 
100 private:
101  VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& primaryArray) override;
102 
103  vtkm::IdComponent AverageRadius = 0;
104  vtkm::IdComponent PixelShiftRadius = 0;
105  vtkm::FloatDefault AllowedPixelErrorRatio = 0.00025f;
106  vtkm::FloatDefault PixelDiffThreshold = 0.05f;
107  bool ImageDiffWithinThreshold = true;
108  std::string ThresholdFieldName = "threshold-output";
109 };
110 } // namespace image_processing
111 } // namespace filter
112 } // namespace vtkm
113 
114 #endif // vtk_m_filter_image_processing_ImageDifference_h
vtkm::filter::image_processing::ImageDifference::GetSecondaryFieldName
VTKM_CONT std::string GetSecondaryFieldName() const
Definition: ImageDifference.h:94
vtkm::filter::image_processing::ImageDifference::GetPixelShiftRadius
VTKM_CONT vtkm::IdComponent GetPixelShiftRadius() const
Definition: ImageDifference.h:43
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::filter::image_processing::ImageDifference::SetPrimaryField
VTKM_CONT void SetPrimaryField(const std::string &name, vtkm::cont::Field::Association association=vtkm::cont::Field::Association::Any)
Choose the primary field to operate on.
Definition: ImageDifference.h:71
vtkm::IdComponent
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
vtkm::cont::Field::Association
Association
Definition: cont/Field.h:34
vtkm::filter::image_processing::ImageDifference::SetPixelDiffThreshold
VTKM_CONT void SetPixelDiffThreshold(const vtkm::FloatDefault &threshold)
Definition: ImageDifference.h:59
vtkm::cont::DataSet
Definition: DataSet.h:34
vtkm::filter::image_processing::ImageDifference::SetAllowedPixelErrorRatio
VTKM_CONT void SetAllowedPixelErrorRatio(const vtkm::FloatDefault &pixelErrorRatio)
Definition: ImageDifference.h:53
FilterField.h
vtkm::filter::image_processing::ImageDifference
Construct an ImageDifference of a given DataSet.
Definition: ImageDifference.h:32
vtkm::filter::FilterField
Definition: FilterField.h:21
vtkm::filter::image_processing::ImageDifference::GetThresholdFieldName
VTKM_CONT std::string GetThresholdFieldName() const
Definition: ImageDifference.h:66
vtkm::filter::image_processing::ImageDifference::GetPrimaryFieldAssociation
VTKM_CONT vtkm::cont::Field::Association GetPrimaryFieldAssociation() const
Definition: ImageDifference.h:79
vtkm::cont::Field::Association::Any
@ Any
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::filter::image_processing::ImageDifference::SetPixelShiftRadius
VTKM_CONT void SetPixelShiftRadius(const vtkm::IdComponent &pixelShiftRadius)
Definition: ImageDifference.h:44
vtkm::filter::image_processing::ImageDifference::SetAverageRadius
VTKM_CONT void SetAverageRadius(const vtkm::IdComponent &averageRadius)
Definition: ImageDifference.h:38
vtkm::filter::image_processing::ImageDifference::SetSecondaryField
VTKM_CONT void SetSecondaryField(const std::string &name, vtkm::cont::Field::Association association=vtkm::cont::Field::Association::Any)
Choose the secondary field to operate on.
Definition: ImageDifference.h:87
vtkm::filter::image_processing::ImageDifference::GetAllowedPixelErrorRatio
VTKM_CONT vtkm::FloatDefault GetAllowedPixelErrorRatio() const
Definition: ImageDifference.h:49
vtkm::filter::image_processing::ImageDifference::SetThresholdFieldName
VTKM_CONT void SetThresholdFieldName(const std::string &name)
Definition: ImageDifference.h:65
vtkm::FloatDefault
vtkm::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:198
vtkm::filter::image_processing::ImageDifference::GetImageDiffWithinThreshold
VTKM_CONT bool GetImageDiffWithinThreshold() const
Definition: ImageDifference.h:64
vtkm::filter::image_processing::ImageDifference::GetSecondaryFieldAssociation
VTKM_CONT vtkm::cont::Field::Association GetSecondaryFieldAssociation() const
Definition: ImageDifference.h:95
vtkm::filter::image_processing::ImageDifference::GetPrimaryFieldName
VTKM_CONT std::string GetPrimaryFieldName() const
Definition: ImageDifference.h:78
vtkm::filter::image_processing::ImageDifference::GetAverageRadius
VTKM_CONT vtkm::IdComponent GetAverageRadius() const
Definition: ImageDifference.h:37
vtkm::filter::image_processing::ImageDifference::GetPixelDiffThreshold
VTKM_CONT vtkm::FloatDefault GetPixelDiffThreshold() const
Definition: ImageDifference.h:58