Medical Imaging Interaction Toolkit  2025.12.02
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 mitkSimpleFunctorPolicy_h
14 #define mitkSimpleFunctorPolicy_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 
32  typedef itk::Index<3> IndexType;
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
#define MITKMODELFIT_EXPORT
void SetFunctor(const mitk::SimpleFunctorBase *functor)
bool operator==(const SimpleFunctorPolicy &other) const
unsigned int GetNumberOfOutputs() const
SimpleFunctorBase::ConstPointer FunctorConstPointer
OutputPixelArrayType operator()(const InputPixelArrayType &value, const IndexType &) const
bool operator!=(const SimpleFunctorPolicy &other) const
std::vector< mitk::ScalarType > InputPixelArrayType
std::vector< mitk::ScalarType > OutputPixelArrayType
Find image slices visible on a given plane.