Medical Imaging Interaction Toolkit  2026.06.00
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 
33  {
34  public:
35  typedef std::vector<mitk::ScalarType> InputPixelArrayType;
36  typedef std::vector<mitk::ScalarType> OutputPixelArrayType;
37 
40 
41  typedef itk::Index<3> IndexType;
42 
44 
46 
47  unsigned int GetNumberOfOutputs() const;
48 
49  void SetFunctor(const mitk::SimpleFunctorBase *functor);
50 
51  bool operator!=(const SimpleFunctorPolicy & other) const;
52 
53  bool operator==(const SimpleFunctorPolicy & other) const;
54 
55  inline OutputPixelArrayType operator()( const InputPixelArrayType & value, const IndexType& /*currentIndex*/ ) const
56  {
57  if (!m_Functor)
58  {
59  itkGenericExceptionMacro(<< "Error. Cannot process operator(). Functor is Null.");
60  }
61 
62  OutputPixelArrayType result = m_Functor->Compute(value);
63 
64  return result;
65  }
66 
67  private:
68 
69  FunctorConstPointer m_Functor;
70  };
71 
72 }
73 
74 
75 #endif
#define MITKMODELFIT_EXPORT
Abstract base class for simple functors used with itkMultiOutputNaryFunctorImageFilter.
Policy class adapting a SimpleFunctorBase for use with itkMultiOutputNaryFunctorImageFilter.
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.