Medical Imaging Interaction Toolkit  2021.10.99-9c07a326
Medical Imaging Interaction Toolkit
mitkSimpleFunctorPolicy.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef SIMPLEFUNCTOR_POLICY_H
14 #define SIMPLEFUNCTOR_POLICY_H
15 
16 #include "itkIndex.h"
17 #include "mitkSimpleFunctorBase.h"
18 #include "MitkModelFitExports.h"
19 
20 namespace mitk
21 {
22 
24  {
25  public:
26  typedef std::vector<mitk::ScalarType> InputPixelArrayType;
27  typedef std::vector<mitk::ScalarType> OutputPixelArrayType;
28 
31 
33 
35 
37 
38  unsigned int GetNumberOfOutputs() const;
39 
40  void SetFunctor(const mitk::SimpleFunctorBase *functor);
41 
42  bool operator!=(const SimpleFunctorPolicy & other) const;
43 
44  bool operator==(const SimpleFunctorPolicy & other) const;
45 
46  inline OutputPixelArrayType operator()( const InputPixelArrayType & value, const IndexType& /*currentIndex*/ ) const
47  {
48  if (!m_Functor)
49  {
50  itkGenericExceptionMacro(<< "Error. Cannot process operator(). Functor is Null.");
51  }
52 
53  OutputPixelArrayType result = m_Functor->Compute(value);
54 
55  return result;
56  }
57 
58  private:
59 
60  FunctorConstPointer m_Functor;
61  };
62 
63 }
64 
65 
66 #endif // SIMPLEFUNCTORPOLICY_H
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
SimpleFunctorBase::ConstPointer FunctorConstPointer
DataCollection - Class to facilitate loading/accessing structured data.
#define MITKMODELFIT_EXPORT
std::vector< mitk::ScalarType > InputPixelArrayType
MITKCORE_EXPORT bool operator!=(const InteractionEvent &a, const InteractionEvent &b)
OutputPixelArrayType operator()(const InputPixelArrayType &value, const IndexType &) const
std::vector< mitk::ScalarType > OutputPixelArrayType