Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
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
mitk::SimpleFunctorPolicy::IndexType
itk::Index< 3 > IndexType
Definition: mitkSimpleFunctorPolicy.h:32
mitk::SimpleFunctorPolicy::FunctorConstPointer
SimpleFunctorBase::ConstPointer FunctorConstPointer
Definition: mitkSimpleFunctorPolicy.h:30
mitk::SimpleFunctorPolicy::operator()
OutputPixelArrayType operator()(const InputPixelArrayType &value, const IndexType &) const
Definition: mitkSimpleFunctorPolicy.h:46
mitk::SimpleFunctorPolicy::OutputPixelArrayType
std::vector< mitk::ScalarType > OutputPixelArrayType
Definition: mitkSimpleFunctorPolicy.h:27
MitkModelFitExports.h
itk::SmartPointer< const Self >
MITKMODELFIT_EXPORT
#define MITKMODELFIT_EXPORT
Definition: MitkModelFitExports.h:15
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::operator!=
MITKCORE_EXPORT bool operator!=(const InteractionEvent &a, const InteractionEvent &b)
mitk::SimpleFunctorPolicy::InputPixelArrayType
std::vector< mitk::ScalarType > InputPixelArrayType
Definition: mitkSimpleFunctorPolicy.h:26
mitk::operator==
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
mitk::SimpleFunctorPolicy::FunctorType
SimpleFunctorBase FunctorType
Definition: mitkSimpleFunctorPolicy.h:29
mitkSimpleFunctorBase.h
mitk::SimpleFunctorPolicy
Definition: mitkSimpleFunctorPolicy.h:23
mitk::SimpleFunctorBase
Definition: mitkSimpleFunctorBase.h:28