SimpleITK  1.3.0.dev466
itkHashImageFilter.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 itkHashImageFilter_h
19 #define itkHashImageFilter_h
20 
21 
24 #include "itkCastImageFilter.h"
25 #include "itkByteSwapper.h"
26 
27 
28 namespace itk {
29 
39 template < class TImageType >
41  public CastImageFilter< TImageType, TImageType >
42 {
43 public:
49 
50  typedef typename TImageType::RegionType RegionType;
51 
53  itkNewMacro(Self);
54 
57 
60 
63 
65  std::string GetHash() const
66  { return this->GetHashOutput()->Get(); }
67  HashObjectType* GetHashOutput()
68  { return static_cast< HashObjectType *>( this->ProcessObject::GetOutput(1) ); }
69  const HashObjectType* GetHashOutput() const
70  { return static_cast<const HashObjectType *>( this->ProcessObject::GetOutput(1) ); }
71 
72  enum HashFunction { SHA1, MD5 };
73 
77 
82  virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE;
83 
84 protected:
85 
87 
88  // virtual ~HashImageFilter(); // implementation not needed
89 
90  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
91 
92  // See superclass for doxygen documentation
93  //
94  // This method is to do work after the superclass potential threaded
95  // copy.
96  void AfterThreadedGenerateData() ITK_OVERRIDE;
97 
98  // See superclass for doxygen documentation
99  //
100  // Override since the filter produces all of its output
101  void EnlargeOutputRequestedRegion(DataObject *data) ITK_OVERRIDE;
102 
103 private:
104  HashImageFilter(const Self &); //purposely not implemented
105  void operator=(const Self &); //purposely not implemented
106 
107 
109 };
110 
111 
112 } // end namespace itk
113 
114 
115 #include "itkHashImageFilter.hxx"
116 
117 #endif // itkHashImageFilter_h
SmartPointer< Self > Pointer
SmartPointer< const Self > ConstPointer
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
const HashObjectType * GetHashOutput() const
itkTypeMacro(HashImageFilter, CastImageFilter)
TImageType::RegionType RegionType
virtual void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
ProcessObject::DataObjectPointer MakeOutput(ProcessObject::DataObjectPointerArraySizeType idx) override
itkSetMacro(HashFunction, HashFunction)
virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE
itkGetMacro(HashFunction, HashFunction)
void EnlargeOutputRequestedRegion(DataObject *data) ITK_OVERRIDE
HashObjectType * GetHashOutput()
ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
SimpleDataObjectDecorator< std::string > HashObjectType
std::string GetHash() const
DataObject::Pointer DataObjectPointer
CastImageFilter< TImageType, TImageType > Superclass
Generates a hash string from an image.
void AfterThreadedGenerateData() ITK_OVERRIDE
DataObject * GetOutput(const DataObjectIdentifierType &key)