Viskores  1.0
ImageDifference.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 
19 #ifndef viskores_filter_image_processing_ImageDifference_h
20 #define viskores_filter_image_processing_ImageDifference_h
21 
22 #include <viskores/filter/Filter.h>
24 
25 namespace viskores
26 {
27 namespace filter
28 {
29 namespace image_processing
30 {
40 class VISKORES_FILTER_IMAGE_PROCESSING_EXPORT ImageDifference : public viskores::filter::Filter
41 {
42 public:
44 
45  VISKORES_CONT viskores::IdComponent GetAverageRadius() const { return this->AverageRadius; }
47  {
48  this->AverageRadius = averageRadius;
49  }
50 
51  VISKORES_CONT viskores::IdComponent GetPixelShiftRadius() const { return this->PixelShiftRadius; }
53  {
54  this->PixelShiftRadius = pixelShiftRadius;
55  }
56 
58  {
59  return this->AllowedPixelErrorRatio;
60  }
62  {
63  this->AllowedPixelErrorRatio = pixelErrorRatio;
64  }
65 
67  {
68  return this->PixelDiffThreshold;
69  }
71  {
72  this->PixelDiffThreshold = threshold;
73  }
74 
75  VISKORES_CONT bool GetImageDiffWithinThreshold() const { return this->ImageDiffWithinThreshold; }
76  VISKORES_CONT void SetThresholdFieldName(const std::string& name)
77  {
78  this->ThresholdFieldName = name;
79  }
80  VISKORES_CONT std::string GetThresholdFieldName() const { return this->ThresholdFieldName; }
81 
86  const std::string& name,
88  {
89  this->SetActiveField(name, association);
90  }
91 
92  VISKORES_CONT std::string GetPrimaryFieldName() const { return this->GetActiveFieldName(); }
94  {
95  return this->GetActiveFieldAssociation();
96  }
97 
102  const std::string& name,
104  {
105  this->SetActiveField(1, name, association);
106  }
107 
108  VISKORES_CONT std::string GetSecondaryFieldName() const { return this->GetActiveFieldName(1); }
110  {
111  return this->GetActiveFieldAssociation(1);
112  }
113 
114 private:
116  const viskores::cont::DataSet& primaryArray) override;
117 
118  viskores::IdComponent AverageRadius = 0;
119  viskores::IdComponent PixelShiftRadius = 0;
120  viskores::FloatDefault AllowedPixelErrorRatio = 0.00025f;
121  viskores::FloatDefault PixelDiffThreshold = 0.05f;
122  bool ImageDiffWithinThreshold = true;
123  std::string ThresholdFieldName = "threshold-output";
124 };
125 } // namespace image_processing
126 } // namespace filter
127 } // namespace viskores
128 
129 #endif // viskores_filter_image_processing_ImageDifference_h
viskores::filter::image_processing::ImageDifference::GetThresholdFieldName
std::string GetThresholdFieldName() const
Definition: ImageDifference.h:80
viskores::filter::image_processing::ImageDifference::GetSecondaryFieldName
std::string GetSecondaryFieldName() const
Definition: ImageDifference.h:108
viskores::filter::image_processing::ImageDifference
Construct an ImageDifference of a given DataSet.
Definition: ImageDifference.h:40
viskores::cont::DataSet
Contains and manages the geometric data structures that Viskores operates on.
Definition: DataSet.h:66
viskores::filter::image_processing::ImageDifference::SetSecondaryField
void SetSecondaryField(const std::string &name, viskores::cont::Field::Association association=viskores::cont::Field::Association::Any)
Choose the secondary field to operate on.
Definition: ImageDifference.h:101
viskores::cont::Field::Association
Association
Identifies what elements of a data set a field is associated with.
Definition: Field.h:46
viskores::filter::image_processing::ImageDifference::SetPixelShiftRadius
void SetPixelShiftRadius(const viskores::IdComponent &pixelShiftRadius)
Definition: ImageDifference.h:52
viskores::cont::Field::Association::Any
@ Any
Any field regardless of the association.
viskores::filter::image_processing::ImageDifference::GetPrimaryFieldName
std::string GetPrimaryFieldName() const
Definition: ImageDifference.h:92
viskores::filter::Filter
Base class for all filters.
Definition: Filter.h:171
viskores::filter::image_processing::ImageDifference::GetImageDiffWithinThreshold
bool GetImageDiffWithinThreshold() const
Definition: ImageDifference.h:75
viskores::IdComponent
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
viskores::filter::image_processing::ImageDifference::GetAllowedPixelErrorRatio
viskores::FloatDefault GetAllowedPixelErrorRatio() const
Definition: ImageDifference.h:57
viskores_filter_image_processing_export.h
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::filter::image_processing::ImageDifference::GetPixelShiftRadius
viskores::IdComponent GetPixelShiftRadius() const
Definition: ImageDifference.h:51
viskores::filter::image_processing::ImageDifference::SetPixelDiffThreshold
void SetPixelDiffThreshold(const viskores::FloatDefault &threshold)
Definition: ImageDifference.h:70
viskores::filter::image_processing::ImageDifference::GetAverageRadius
viskores::IdComponent GetAverageRadius() const
Definition: ImageDifference.h:45
viskores::filter::image_processing::ImageDifference::GetSecondaryFieldAssociation
viskores::cont::Field::Association GetSecondaryFieldAssociation() const
Definition: ImageDifference.h:109
viskores::filter::image_processing::ImageDifference::SetThresholdFieldName
void SetThresholdFieldName(const std::string &name)
Definition: ImageDifference.h:76
viskores::filter::image_processing::ImageDifference::SetAverageRadius
void SetAverageRadius(const viskores::IdComponent &averageRadius)
Definition: ImageDifference.h:46
viskores::FloatDefault
viskores::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:244
viskores::filter::image_processing::ImageDifference::SetAllowedPixelErrorRatio
void SetAllowedPixelErrorRatio(const viskores::FloatDefault &pixelErrorRatio)
Definition: ImageDifference.h:61
viskores::filter::image_processing::ImageDifference::GetPixelDiffThreshold
viskores::FloatDefault GetPixelDiffThreshold() const
Definition: ImageDifference.h:66
viskores::filter::image_processing::ImageDifference::GetPrimaryFieldAssociation
viskores::cont::Field::Association GetPrimaryFieldAssociation() const
Definition: ImageDifference.h:93
viskores::filter::image_processing::ImageDifference::SetPrimaryField
void SetPrimaryField(const std::string &name, viskores::cont::Field::Association association=viskores::cont::Field::Association::Any)
Choose the primary field to operate on.
Definition: ImageDifference.h:85
Filter.h