Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkMAPAlgorithmHelper.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 
14 #ifndef mitkMAPAlgorithmHelper_h
15 #define mitkMAPAlgorithmHelper_h
16 
17 
18 //MatchPoint
19 #include <mapRegistrationAlgorithmBase.h>
20 #include <mapRegistrationBase.h>
21 
22 //MITK
23 #include <mitkImage.h>
24 #include <mitkPointSet.h>
25 
26 //MITK
29 
30 namespace mitk
31 {
44  {
45  public:
46 
51  MAPAlgorithmHelper(map::algorithm::RegistrationAlgorithmBase* algorithm);
52 
65  void SetData(const mitk::BaseData* moving, const mitk::BaseData* target);
66 
75  void SetAllowImageCasting(bool allowCasting);
76 
81  bool GetAllowImageCasting() const;
82 
88  static bool HasImageAlgorithmInterface(const map::algorithm::RegistrationAlgorithmBase* algorithm);
89 
95  static bool HasPointSetAlgorithmInterface(const map::algorithm::RegistrationAlgorithmBase* algorithm);
96 
100  struct CheckError
101  {
102  enum Type
103  {
104  none = 0,
105  onlyByCasting = 1,
106  wrongDimension = 2,
107  unsupportedDataType = 3
108  };
109  };
110 
120  bool CheckData(const mitk::BaseData* moving, const mitk::BaseData* target,
121  CheckError::Type& error) const;
122 
129  map::core::RegistrationBase::Pointer GetRegistration() const;
130 
137  mitk::MAPRegistrationWrapper::Pointer GetMITKRegistrationWrapper() const;
138 
140 
141  private:
142 
143  MAPAlgorithmHelper& operator = (const MAPAlgorithmHelper&);
145 
148  template<typename TInImageType, typename TOutImageType>
149  typename TOutImageType::Pointer CastImage(const TInImageType* input) const;
150 
152  template<typename TPixelType1, unsigned int VImageDimension1,
153  typename TPixelType2, unsigned int VImageDimension2>
154  void DoSetImages(const itk::Image<TPixelType1, VImageDimension1>* moving,
155  const itk::Image<TPixelType2, VImageDimension2>* target);
156 
158  template<typename TPixelType1, unsigned int VImageDimension1,
159  typename TPixelType2, unsigned int VImageDimension2>
160  void DoCheckImages(const itk::Image<TPixelType1, VImageDimension1>* moving,
161  const itk::Image<TPixelType2, VImageDimension2>* target) const;
162 
163  map::algorithm::RegistrationAlgorithmBase::Pointer m_AlgorithmBase;
164 
165  bool m_AllowImageCasting;
166 
167  mutable CheckError::Type m_Error;
168  };
169 
178  mitk::MAPRegistrationWrapper::Pointer MITKMATCHPOINTREGISTRATION_EXPORT GenerateIdentityRegistration3D();
179 
180 }
181 
182 #endif
#define MITKMATCHPOINTREGISTRATION_EXPORT
Base class of all data objects.
Definition: mitkBaseData.h:60
Helper class for bridging between MITK data objects and MatchPoint registration algorithms.
void SetData(const mitk::BaseData *moving, const mitk::BaseData *target)
Sets moving and target data on the algorithm.
static bool HasImageAlgorithmInterface(const map::algorithm::RegistrationAlgorithmBase *algorithm)
Checks whether the given algorithm supports image-based registration.
MAPAlgorithmHelper(map::algorithm::RegistrationAlgorithmBase *algorithm)
Constructs a helper for the given registration algorithm.
bool CheckData(const mitk::BaseData *moving, const mitk::BaseData *target, CheckError::Type &error) const
Checks whether the given moving and target data are compatible with the algorithm.
void SetAllowImageCasting(bool allowCasting)
Enables or disables automatic pixel type casting for images.
bool GetAllowImageCasting() const
Returns whether automatic pixel type casting is currently allowed.
static bool HasPointSetAlgorithmInterface(const map::algorithm::RegistrationAlgorithmBase *algorithm)
Checks whether the given algorithm supports point-set-based registration.
mitk::MAPRegistrationWrapper::Pointer GetMITKRegistrationWrapper() const
Retrieves the registration result wrapped in a MITK-compatible wrapper.
map::core::RegistrationBase::Pointer GetRegistration() const
Retrieves the registration result from the algorithm.
Find image slices visible on a given plane.
mitk::MAPRegistrationWrapper::Pointer MITKMATCHPOINTREGISTRATION_EXPORT GenerateIdentityRegistration3D()
Generates a 3D identity registration wrapped as a MAPRegistrationWrapper.
Error codes returned by CheckData() indicating data compatibility issues.