ITK  4.2.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 < class TImageType >
45 class ITK_EXPORT HashImageFilter:
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(); }
72  HashObjectType* GetHashOutput()
73  { return static_cast< HashObjectType *>( this->ProcessObject::GetOutput(1) ); }
74  const HashObjectType* GetHashOutput() const
75  { return static_cast<const HashObjectType *>( this->ProcessObject::GetOutput(1) ); }
77 
81  using Superclass::MakeOutput;
82  virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
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;
100 
101  virtual
102  void ThreadedGenerateData(const typename Superclass::OutputImageRegionType &,
103  ThreadIdType) {}
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();
110 
111  // See superclass for doxygen documentation
112  //
113  // Override since the filter produces all of its output
114  void EnlargeOutputRequestedRegion(DataObject *data);
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
130