SimpleITK  2.0.0
sitkHashImageFilter.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 sitkHashImageFilter_h
19 #define sitkHashImageFilter_h
20 
21 #include "sitkMacro.h"
23 #include "sitkImage.h"
24 #include "sitkBasicFilters.h"
25 #include "sitkImageFilter.h"
26 #include "sitkProcessObject.h"
27 
28 namespace itk {
29  namespace simple {
30 
37  : public ProcessObject {
38  public:
40 
41  // function pointer type
42  typedef std::string (Self::*MemberFunctionType)( const Image& );
43 
44  // this filter works with all itk::Image and itk::VectorImage types.
45  typedef typelist::Append<
46  typelist::Append< BasicPixelIDTypeList, ComplexPixelIDTypeList>::Type,
48 
49  ~HashImageFilter() override;
50 
52 
53  enum HashFunction { SHA1, MD5 };
54  SITK_RETURN_SELF_TYPE_HEADER SetHashFunction ( HashFunction hashFunction );
55  HashFunction GetHashFunction () const;
56 
58  std::string GetName() const override { return std::string ( "Hash"); }
59 
60  // Print ourselves out
61  std::string ToString() const override;
62 
63  std::string Execute ( const Image& );
64 
65 
66  private:
68 
69  template <class TImageType> std::string ExecuteInternal ( const Image& image );
70  template <class TImageType> std::string ExecuteInternalLabelImage ( const Image& image );
71 
72  // friend to get access to executeInternal member
73  friend struct detail::MemberFunctionAddressor<MemberFunctionType>;
74  friend struct detail::ExecuteInternalLabelImageAddressor<MemberFunctionType>;
75 
76  std::unique_ptr<detail::MemberFunctionFactory<MemberFunctionType> > m_MemberFactory;
77  };
78 
80  }
81 }
82 #endif
itk::simple::Image
The Image class for SimpleITK.
Definition: sitkImage.h:75
sitkBasicFilters.h
itk::simple::HashImageFilter::HashFunction
HashFunction
Definition: sitkHashImageFilter.h:53
itk::simple::detail::MemberFunctionAddressor
Definition: sitkDetail.h:32
itk::simple::HashImageFilter::m_MemberFactory
std::unique_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
Definition: sitkHashImageFilter.h:76
sitkImage.h
HashFunction
sitkMemberFunctionFactory.h
sitkImageFilter.h
sitkProcessObject.h
sitkMacro.h
itk::simple::detail::ExecuteInternalLabelImageAddressor
Definition: sitkDetail.h:90
itk::simple::HashImageFilter
Compute the sha1 or md5 hash of an image.
Definition: sitkHashImageFilter.h:36
itk::simple::HashImageFilter::GetName
std::string GetName() const override
Definition: sitkHashImageFilter.h:58
SITKBasicFilters_EXPORT
#define SITKBasicFilters_EXPORT
Definition: sitkBasicFilters.h:52
itk::simple::VectorPixelIDTypeList
typelist::MakeTypeList< VectorPixelID< int8_t >, VectorPixelID< uint8_t >, VectorPixelID< int16_t >, VectorPixelID< uint16_t >, VectorPixelID< int32_t >, VectorPixelID< uint32_t >, VectorPixelID< float >, VectorPixelID< double > >::Type VectorPixelIDTypeList
Definition: sitkPixelIDTypeLists.h:134
itk::simple::Hash
std::string Hash(const Image &image, HashImageFilter::HashFunction function=HashImageFilter::SHA1)
itk::simple::HashImageFilter::m_HashFunction
HashFunction m_HashFunction
Definition: sitkHashImageFilter.h:67
itk
itk::simple::ProcessObject
Base class for SimpleITK classes based on ProcessObject.
Definition: sitkProcessObject.h:51
itk::simple::HashImageFilter::PixelIDTypeList
typelist::Append< typelist::Append< BasicPixelIDTypeList, ComplexPixelIDTypeList >::Type, VectorPixelIDTypeList >::Type PixelIDTypeList
Definition: sitkHashImageFilter.h:47
itk::simple::HashImageFilter::SHA1
@ SHA1
Definition: sitkHashImageFilter.h:53