Medical Imaging Interaction Toolkit  2018.4.99-f51274ea
Medical Imaging Interaction Toolkit
mitkMAPRegistrationWrapper.cpp
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 
14 
15 #include <mapExceptionObjectMacros.h>
16 #include <mapRegistrationManipulator.h>
17 
18 mitk::MAPRegistrationWrapper::MAPRegistrationWrapper(map::core::RegistrationBase* registration) : m_spRegistration(registration)
19 {
20  if (registration == nullptr)
21  {
22  mitkThrow() << "Error. Cannot create MAPRegistrationWrapper with invalid registration instance (nullptr).";
23  }
24 
25  Identifiable::SetUID(registration->getRegistrationUID());
26 }
27 
29 {
30 }
31 
33 {
34  //nothing to do
35 }
36 
38 {
39  return false;
40 }
41 
43 {
44  return true;
45 }
46 
48 {
49  //nothing to do
50 }
51 
53 {
54  if (m_spRegistration.IsNull())
55  {
56  mitkThrow()<< "Error. Cannot return moving dimension. Wrapper points to invalid registration (nullptr).";
57  }
58  return m_spRegistration->getMovingDimensions();
59 }
60 
61 
63 {
64  if (m_spRegistration.IsNull())
65  {
66  mitkThrow()<< "Error. Cannot return target dimension. Wrapper points to invalid registration (nullptr).";
67  }
68  return m_spRegistration->getTargetDimensions();
69 }
70 
72 {
73  if (m_spRegistration.IsNull())
74  {
75  mitkThrow()<< "Error. Cannot return registration tags. Wrapper points to invalid registration (nullptr).";
76  }
77  return m_spRegistration->getTags();
78 }
79 
81 {
82  if (m_spRegistration.IsNull())
83  {
84  mitkThrow()<< "Error. Cannot return registration tag value. Wrapper points to invalid registration (nullptr). Tag: " << tag;
85  }
86  return m_spRegistration->getTagValue(tag,value);
87 }
88 
90 {
91  if (m_spRegistration.IsNull())
92  {
93  mitkThrow()<< "Error. Cannot determin HasLimitedTargetRepresentation(). Wrapper points to invalid registration (nullptr).";
94  }
95  return m_spRegistration->hasLimitedTargetRepresentation();
96 }
97 
99 {
100  if (m_spRegistration.IsNull())
101  {
102  mitkThrow()<< "Error. Cannot determin HasLimitedMovingRepresentation(). Wrapper points to invalid registration (nullptr).";
103  }
104  return m_spRegistration->hasLimitedMovingRepresentation();
105 }
106 
107 map::core::RegistrationBase* mitk::MAPRegistrationWrapper::GetRegistration()
108 {
109  return m_spRegistration;
110 }
111 
112 const map::core::RegistrationBase* mitk::MAPRegistrationWrapper::GetRegistration() const
113 {
114  return m_spRegistration;
115 }
116 
117 void mitk::MAPRegistrationWrapper::PrintSelf (std::ostream &os, itk::Indent indent) const
118 {
119  Superclass::PrintSelf(os,indent);
120  if (m_spRegistration.IsNull())
121  {
122  os<< "Error. Wrapper points to invalid registration (nullptr).";
123  }
124  else
125  {
126  os<<std::endl<<indent<<"MatchPoint registration instance:";
127  m_spRegistration->Print(os,indent.GetNextIndent());
128 
129  typedef map::core::Registration<3,3> CastedRegType;
130  const CastedRegType* pCastedReg = dynamic_cast<const CastedRegType*>(m_spRegistration.GetPointer());
131 
132  os<<std::endl<<indent<<"MatchPoint registration direct kernel instance:";
133  pCastedReg->getDirectMapping().Print(os,indent.GetNextIndent());
134 
135  os<<std::endl<<indent<<"MatchPoint registration inverse kernel instance:";
136  pCastedReg->getInverseMapping().Print(os,indent.GetNextIndent());
137 
138  }
139 }
140 
142 {
143  if (m_spRegistration.IsNull())
144  {
145  mitkThrow() << "Error. Cannot set UID. Wrapper points to invalid registration (nullptr).";
146  }
148  ::map::core::RegistrationBaseManipulator manip(m_spRegistration);
149  manip.getTagValues()[::map::tags::RegistrationUID] = uid;
150 };
151 
153 {
154  if (m_spRegistration.IsNull())
155  {
156  mitkThrow() << "Error. Cannot return UID. Wrapper points to invalid registration (nullptr).";
157  }
158  return m_spRegistration->getRegistrationUID();
159 };
MAPRegistrationWrapper(::map::core::RegistrationBase *registration)
virtual unsigned int GetTargetDimensions() const
Gets the number of target dimensions.
virtual void SetUID(const UIDType &uid)
bool RequestedRegionIsOutsideOfTheBufferedRegion() override
::map::core::RegistrationBase::ValueType ValueType
void PrintSelf(std::ostream &os, itk::Indent indent) const override
::map::core::RegistrationBase::TagType TagType
void SetUID(const UIDType &uid) override
const TagMapType & GetTags() const
returns the tags associated with this registration
::map::core::RegistrationBase * GetRegistration()
#define mitkThrow()
bool GetTagValue(const TagType &tag, ValueType &value) const
returns the tag value for a specific tag
Identifiable::UIDType GetUID() const override
Get unique ID of an object.
::map::core::RegistrationBase::Pointer m_spRegistration
::map::core::RegistrationBase::TagMapType TagMapType
void SetRequestedRegion(const itk::DataObject *) override
virtual unsigned int GetMovingDimensions() const
Gets the number of moving dimensions.