SimpleITK  
itkHashImageFilter.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  * http://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 itkHashImageFilter_h
19 #define itkHashImageFilter_h
20 
21 
24 #include "itkCastImageFilter.h"
25 #include "itkByteSwapper.h"
26 
27 
28 namespace itk
29 {
30 
40 template <class TImageType>
41 class HashImageFilter : public CastImageFilter<TImageType, TImageType>
42 {
43 public:
49 
50  using RegionType = typename TImageType::RegionType;
51 
54 
57 
60 
63 
65  std::string
66  GetHash() const
67  {
68  return this->GetHashOutput()->Get();
69  }
72  {
73  return static_cast<HashObjectType *>(this->ProcessObject::GetOutput(1));
74  }
75  const HashObjectType *
76  GetHashOutput() const
77  {
78  return static_cast<const HashObjectType *>(this->ProcessObject::GetOutput(1));
79  }
80 
82  {
85  };
86 
90 
97 
98 protected:
100 
101  // virtual ~HashImageFilter(); // implementation not needed
102 
103  void
104  PrintSelf(std::ostream & os, Indent indent) const override;
105 
106  // See superclass for doxygen documentation
107  //
108  // This method is to do work after the superclass potential threaded
109  // copy.
110  void
111  AfterThreadedGenerateData() override;
112 
113  // See superclass for doxygen documentation
114  //
115  // Override since the filter produces all of its output
116  void
117  EnlargeOutputRequestedRegion(DataObject * data) override;
118 
119 private:
120  HashImageFilter(const Self &); // purposely not implemented
121  void
122  operator=(const Self &); // purposely not implemented
123 
124 
126 };
127 
128 
129 } // namespace itk
130 
131 
132 #include "itkHashImageFilter.hxx"
133 
134 #endif // itkHashImageFilter_h
itk::SimpleDataObjectDecorator
itk::CastImageFilter
itk::HashImageFilter::MD5
@ MD5
Definition: itkHashImageFilter.h:84
itk::HashImageFilter
Generates a hash string from an image.
Definition: itkHashImageFilter.h:41
itk::HashImageFilter::AfterThreadedGenerateData
void AfterThreadedGenerateData() override
itkByteSwapper.h
itk::HashImageFilter::itkGetMacro
itkGetMacro(HashFunction, HashFunction)
itk::HashImageFilter::GetHash
std::string GetHash() const
Definition: itkHashImageFilter.h:66
itk::HashImageFilter::HashImageFilter
HashImageFilter()
itk::ProcessObject::GetOutput
DataObject * GetOutput(const DataObjectIdentifierType &key)
itk::ImageSource::MakeOutput
ProcessObject::DataObjectPointer MakeOutput(ProcessObject::DataObjectPointerArraySizeType idx) override
itk::SmartPointer< Self >
itk::Indent
itkCastImageFilter.h
itk::ProcessObject::DataObjectPointerArraySizeType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
itk::HashImageFilter::GetHashOutput
HashObjectType * GetHashOutput()
Definition: itkHashImageFilter.h:71
itk::HashImageFilter::operator=
void operator=(const Self &)
itk::HashImageFilter::HashFunction
HashFunction
Definition: itkHashImageFilter.h:81
HashFunction
HashFunction
itk::HashImageFilter::EnlargeOutputRequestedRegion
void EnlargeOutputRequestedRegion(DataObject *data) override
itkImageLinearConstIteratorWithIndex.h
itk::ImageSource
itk::HashImageFilter::MakeOutput
DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override
itk::HashImageFilter::SHA1
@ SHA1
Definition: itkHashImageFilter.h:83
itk::HashImageFilter::HashObjectType
SimpleDataObjectDecorator< std::string > HashObjectType
Definition: itkHashImageFilter.h:62
itk::HashImageFilter::RegionType
typename TImageType::RegionType RegionType
Definition: itkHashImageFilter.h:50
itk::HashImageFilter::itkNewMacro
itkNewMacro(Self)
itk::HashImageFilter::m_HashFunction
HashFunction m_HashFunction
Definition: itkHashImageFilter.h:125
itk::ImageSource::DataObjectPointerArraySizeType
Superclass::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
itk::HashImageFilter::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const override
itk
itk::ProcessObject
itk::HashImageFilter::GetHashOutput
const HashObjectType * GetHashOutput() const
Definition: itkHashImageFilter.h:76
itkSimpleDataObjectDecorator.h
itk::SimpleDataObjectDecorator::Get
virtual T & Get()
itk::DataObject::Pointer
SmartPointer< Self > Pointer
itk::HashImageFilter::itkSetMacro
itkSetMacro(HashFunction, HashFunction)
itk::HashImageFilter::itkTypeMacro
itkTypeMacro(HashImageFilter, CastImageFilter)
itk::DataObject