ITK  5.4.0
Insight Toolkit
itkTestingHashImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef itkTestingHashImageFilter_h
19#define itkTestingHashImageFilter_h
20
21
24
25namespace itk
26{
27namespace Testing
28{
34{
35public:
40 enum class HashFunction : uint8_t
41 {
42 MD5
43 };
44};
45// Define how to print enumeration
46extern std::ostream &
47operator<<(std::ostream & out, HashImageFilterEnums::HashFunction value);
48
64template <typename TImageType>
65class ITK_TEMPLATE_EXPORT HashImageFilter : public InPlaceImageFilter<TImageType, TImageType>
66{
67public:
68 ITK_DISALLOW_COPY_AND_MOVE(HashImageFilter);
69
75
77
79 itkNewMacro(Self);
80
82 itkOverrideGetNameOfClassMacro(HashImageFilter);
83
86
89
91 std::string
92 GetHash() const
93 {
94 return this->GetHashOutput()->Get();
95 }
96 HashObjectType *
98 {
99 return static_cast<HashObjectType *>(this->ProcessObject::GetOutput(1));
100 }
101 const HashObjectType *
103 {
104 return static_cast<const HashObjectType *>(this->ProcessObject::GetOutput(1));
105 }
111 using Superclass::MakeOutput;
114
116#if !defined(ITK_LEGACY_REMOVE)
118 static constexpr HashFunctionEnum MD5 = HashFunctionEnum::MD5;
119#endif
120
128protected:
130
131 // virtual ~HashImageFilter(); // implementation not needed
132
133 void
134 PrintSelf(std::ostream & os, Indent indent) const override;
135
137 void
138 ThreadedGenerateData(const typename Superclass::OutputImageRegionType &, ThreadIdType) override
139 {}
140 void
141 DynamicThreadedGenerateData(const typename Superclass::OutputImageRegionType &) override
142 {}
145 // See superclass for doxygen documentation
146 //
147 // This method is to do work after the superclass potential threaded
148 // copy.
149 void
151
152 // See superclass for doxygen documentation
153 //
154 // Override since the filter produces all of its output
155 void
157
158private:
159 HashFunctionEnum m_HashFunction{ HashFunctionEnum::MD5 };
160};
161
162} // end namespace Testing
163} // end namespace itk
164
165
166#include "itkTestingHashImageFilter.hxx"
167
168#endif // itkTestingHashImageFilter_h
Base class for all data objects in ITK.
SmartPointer< Self > Pointer
Base class for filters that take an image as input and overwrite that image as the output.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
DataObject * GetOutput(const DataObjectIdentifierType &key)
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Decorates any "simple" data type (data types without smart pointers) with a DataObject API.
Enum classes for HashImageFilter.
Generates a md5 hash string from an image.
void DynamicThreadedGenerateData(const typename Superclass::OutputImageRegionType &) override
void EnlargeOutputRequestedRegion(DataObject *data) override
void ThreadedGenerateData(const typename Superclass::OutputImageRegionType &, ThreadIdType) override
DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override
Make a DataObject of the correct type to used as the specified output.
const HashObjectType * GetHashOutput() const
void PrintSelf(std::ostream &os, Indent indent) const override
void AfterThreadedGenerateData() override
typename TImageType::RegionType RegionType
std::ostream & operator<<(std::ostream &out, const ExtractSliceImageFilterEnums::TestExtractSliceImageFilterCollapseStrategy value)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned int ThreadIdType
Definition: itkIntTypes.h:99