ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkTestingHashImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 itkTestingHashImageFilter_h
19 #define itkTestingHashImageFilter_h
20 
21 
23 #include "itkInPlaceImageFilter.h"
24 
25 namespace itk
26 {
27 namespace Testing
28 {
29 
44 template < typename TImageType >
45 class ITK_TEMPLATE_EXPORT HashImageFilter:
46  public InPlaceImageFilter< TImageType, TImageType >
47 {
48 public:
49  ITK_DISALLOW_COPY_AND_ASSIGN(HashImageFilter);
50 
56 
58 
60  itkNewMacro(Self);
61 
63  itkTypeMacro(HashImageFilter, CastImageFilter);
64 
67 
70 
72  std::string GetHash() const
73  { return this->GetHashOutput()->Get(); }
75  { return static_cast< HashObjectType *>( this->ProcessObject::GetOutput(1) ); }
77  { return static_cast<const HashObjectType *>( this->ProcessObject::GetOutput(1) ); }
79 
83  using Superclass::MakeOutput;
84  DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override;
85 
86  enum HashFunction { MD5 };
87 
91  itkSetMacro( HashFunction, HashFunction );
92  itkGetMacro( HashFunction, HashFunction );
94 
95 protected:
96 
98 
99  // virtual ~HashImageFilter(); // implementation not needed
100 
101  void PrintSelf(std::ostream & os, Indent indent) const override;
102 
104  void ThreadedGenerateData(const typename Superclass::OutputImageRegionType &,
105  ThreadIdType) override {}
106  void DynamicThreadedGenerateData(const typename Superclass::OutputImageRegionType &) override {}
108 
109  // See superclass for doxygen documentation
110  //
111  // This method is to do work after the superclass potential threaded
112  // copy.
113  void AfterThreadedGenerateData() override;
114 
115  // See superclass for doxygen documentation
116  //
117  // Override since the filter produces all of its output
118  void EnlargeOutputRequestedRegion(DataObject *data) override;
119 
120 private:
122 };
123 
124 } // end namespace Testing
125 } // end namespace itk
126 
127 
128 #include "itkTestingHashImageFilter.hxx"
129 
130 #endif // itkTestingHashImageFilter_h
Light weight base class for most itk classes.
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Decorates any &quot;simple&quot; data type (data types without smart pointers) with a DataObject API...
Generates a md5 hash string from an image.
const HashObjectType * GetHashOutput() const
void ThreadedGenerateData(const typename Superclass::OutputImageRegionType &, ThreadIdType) override
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
typename TImageType::RegionType RegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
void DynamicThreadedGenerateData(const typename Superclass::OutputImageRegionType &) override
Base class for filters that take an image as input and overwrite that image as the output...
SmartPointer< Self > Pointer
Base class for all data objects in ITK.
Casts input pixels to output pixel type.
DataObject * GetOutput(const DataObjectIdentifierType &key)