VTK-m  2.2
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 
14 #include <vtkm/filter/Filter.h>
16 
17 namespace vtkm
18 {
19 namespace filter
20 {
21 namespace image_processing
22 {
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::SetPrimaryField
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
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::filter::image_processing::ImageDifference::SetAllowedPixelErrorRatio
void SetAllowedPixelErrorRatio(const vtkm::FloatDefault &pixelErrorRatio)
Definition: ImageDifference.h:53
vtkm::IdComponent
vtkm::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:194
vtkm::filter::image_processing::ImageDifference::GetAverageRadius
vtkm::IdComponent GetAverageRadius() const
Definition: ImageDifference.h:37
vtkm::cont::Field::Association
Association
Identifies what elements of a data set a field is associated with.
Definition: Field.h:38
vtkm::cont::DataSet
Contains and manages the geometric data structures that VTK-m operates on.
Definition: DataSet.h:57
vtkm::filter::image_processing::ImageDifference::GetSecondaryFieldAssociation
vtkm::cont::Field::Association GetSecondaryFieldAssociation() const
Definition: ImageDifference.h:95
vtkm::filter::image_processing::ImageDifference::GetPixelDiffThreshold
vtkm::FloatDefault GetPixelDiffThreshold() const
Definition: ImageDifference.h:58
vtkm::filter::image_processing::ImageDifference::SetPixelDiffThreshold
void SetPixelDiffThreshold(const vtkm::FloatDefault &threshold)
Definition: ImageDifference.h:59
vtkm::filter::image_processing::ImageDifference::SetThresholdFieldName
void SetThresholdFieldName(const std::string &name)
Definition: ImageDifference.h:65
vtkm::filter::image_processing::ImageDifference::SetAverageRadius
void SetAverageRadius(const vtkm::IdComponent &averageRadius)
Definition: ImageDifference.h:38
vtkm::filter::image_processing::ImageDifference
Construct an ImageDifference of a given DataSet.
Definition: ImageDifference.h:32
vtkm::filter::image_processing::ImageDifference::GetPixelShiftRadius
vtkm::IdComponent GetPixelShiftRadius() const
Definition: ImageDifference.h:43
vtkm::filter::image_processing::ImageDifference::GetImageDiffWithinThreshold
bool GetImageDiffWithinThreshold() const
Definition: ImageDifference.h:64
vtkm::filter::image_processing::ImageDifference::SetPixelShiftRadius
void SetPixelShiftRadius(const vtkm::IdComponent &pixelShiftRadius)
Definition: ImageDifference.h:44
vtkm::filter::Filter
Base class for all filters.
Definition: Filter.h:163
vtkm::cont::Field::Association::Any
@ Any
Any field regardless of the association.
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
VTKM_FILTER_IMAGE_PROCESSING_EXPORT
#define VTKM_FILTER_IMAGE_PROCESSING_EXPORT
Definition: vtkm_filter_image_processing_export.h:44
vtkm::filter::image_processing::ImageDifference::SetSecondaryField
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::FloatDefault
vtkm::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:236
vtkm::filter::image_processing::ImageDifference::GetThresholdFieldName
std::string GetThresholdFieldName() const
Definition: ImageDifference.h:66
vtkm::filter::image_processing::ImageDifference::GetPrimaryFieldAssociation
vtkm::cont::Field::Association GetPrimaryFieldAssociation() const
Definition: ImageDifference.h:79
vtkm::filter::image_processing::ImageDifference::GetSecondaryFieldName
std::string GetSecondaryFieldName() const
Definition: ImageDifference.h:94
vtkm::filter::image_processing::ImageDifference::GetAllowedPixelErrorRatio
vtkm::FloatDefault GetAllowedPixelErrorRatio() const
Definition: ImageDifference.h:49
vtkm_filter_image_processing_export.h
vtkm::filter::image_processing::ImageDifference::GetPrimaryFieldName
std::string GetPrimaryFieldName() const
Definition: ImageDifference.h:78
Filter.h