ITK  4.8.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 >
46  public InPlaceImageFilter< TImageType, TImageType >
47 {
48 public:
54 
55  typedef typename TImageType::RegionType RegionType;
56 
58  itkNewMacro(Self);
59 
62 
64  typedef typename DataObject::Pointer DataObjectPointer;
65 
68 
70  std::string GetHash() const
71  { return this->GetHashOutput()->Get(); }
73  { return static_cast< HashObjectType *>( this->ProcessObject::GetOutput(1) ); }
75  { return static_cast<const HashObjectType *>( this->ProcessObject::GetOutput(1) ); }
77 
83 
84  enum HashFunction { MD5 };
85 
89  itkSetMacro( HashFunction, HashFunction );
90  itkGetMacro( HashFunction, HashFunction );
92 
93 protected:
94 
96 
97  // virtual ~HashImageFilter(); // implementation not needed
98 
99  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
100 
101  virtual
103  ThreadIdType) ITK_OVERRIDE {}
104 
105  // See superclass for doxygen documentation
106  //
107  // This method is to do work after the superclass potential threaded
108  // copy.
109  void AfterThreadedGenerateData() ITK_OVERRIDE;
110 
111  // See superclass for doxygen documentation
112  //
113  // Override since the filter produces all of its output
114  void EnlargeOutputRequestedRegion(DataObject *data) ITK_OVERRIDE;
115 
116 private:
117  HashImageFilter(const Self &); //purposely not implemented
118  void operator=(const Self &); //purposely not implemented
119 
121 };
122 
123 } // end namespace Testing
124 } // end namespace itk
125 
126 
127 #include "itkTestingHashImageFilter.hxx"
128 
129 #endif // itkTestingHashImageFilter_h
void AfterThreadedGenerateData() override
virtual ProcessObject::DataObjectPointer MakeOutput(ProcessObject::DataObjectPointerArraySizeType idx) override
Light weight base class for most itk classes.
void EnlargeOutputRequestedRegion(DataObject *data) override
virtual void PrintSelf(std::ostream &os, Indent indent) const override
virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override
Decorates any &quot;simple&quot; data type (data types without smart pointers) with a DataObject API...
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
SmartPointer< const Self > ConstPointer
SimpleDataObjectDecorator< std::string > HashObjectType
Generates a md5 hash string from an image.
const HashObjectType * GetHashOutput() const
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
InPlaceImageFilter< TImageType, TImageType > Superclass
Superclass::OutputImageRegionType OutputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void ThreadedGenerateData(const typename Superclass::OutputImageRegionType &, ThreadIdType) override
ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
Base class for filters that take an image as input and overwrite that image as the output...
Base class for all data objects in ITK.
Casts input pixels to output pixel type.
DataObject * GetOutput(const DataObjectIdentifierType &key)