MCPcopy Create free account
hub / github.com/MITK/MITK / SetData

Method SetData

Modules/MatchPointRegistration/src/Helper/mitkMAPAlgorithmHelper.cpp:212–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210 }
211
212 void MAPAlgorithmHelper::SetData(const mitk::BaseData* moving, const mitk::BaseData* target)
213 {
214 if (! m_AlgorithmBase)
215 {
216 mapDefaultExceptionStaticMacro( << "Error, cannot check data. Helper has no algorithm defined.");
217 }
218
219 if (! moving)
220 {
221 mapDefaultExceptionStaticMacro( << "Error, cannot check data. Moving data pointer is nullptr.");
222 }
223
224 if (! target)
225 {
226 mapDefaultExceptionStaticMacro( << "Error, cannot check data. Target data pointer is nullptr.");
227 }
228
229 unsigned int movingDim = m_AlgorithmBase->getMovingDimensions();
230 unsigned int targetDim = m_AlgorithmBase->getTargetDimensions();
231
232 if (movingDim != targetDim)
233 {
234 mapDefaultExceptionStaticMacro( <<
235 "Error, cannot set data. Current version of MAPAlgorithmHelper only supports images/point sets with same dimensionality.");
236 }
237
238 if (GetDataAsPointSet(target) && GetDataAsPointSet(moving))
239 {
240 typedef ::map::core::continuous::Elements<3>::InternalPointSetType InternalDefaultPointSetType;
241 typedef ::map::algorithm::facet::PointSetRegistrationAlgorithmInterface<InternalDefaultPointSetType, InternalDefaultPointSetType>
242 PointSetRegInterface;
243
244 PointSetRegInterface* pPointSetInterface = dynamic_cast<PointSetRegInterface*>
245 (m_AlgorithmBase.GetPointer());
246
247 pPointSetInterface->setMovingPointSet(mitk::PointSetMappingHelper::ConvertPointSetMITKtoMAP(
248 GetDataAsPointSet(moving)->GetPointSet()));
249 pPointSetInterface->setTargetPointSet(mitk::PointSetMappingHelper::ConvertPointSetMITKtoMAP(
250 GetDataAsPointSet(target)->GetPointSet()));
251 }
252 else if (GetDataAsImage(moving) && GetDataAsImage(target))
253 {
254 if (movingDim == 2)
255 {
256 AccessTwoImagesFixedDimensionByItk(GetDataAsImage(moving), GetDataAsImage(target), DoSetImages, 2);
257 }
258 else if (movingDim == 3)
259 {
260 AccessTwoImagesFixedDimensionByItk(GetDataAsImage(moving), GetDataAsImage(target), DoSetImages, 3);
261 }
262 }
263 }
264
265 template<typename TInImageType, typename TOutImageType>
266 typename TOutImageType::Pointer MAPAlgorithmHelper::CastImage(const TInImageType* input) const

Callers 15

generateModelFitTestNodeFunction · 0.45
setUpMethod · 0.45
setUpMethod · 0.45
CreateNodeFunction · 0.45
CreateImageNodeMethod · 0.45
RenderSplineMethod · 0.45
RenderBlueSplineMethod · 0.45
RenderThickSplineMethod · 0.45

Calls 4

GetDataAsPointSetFunction · 0.85
GetDataAsImageFunction · 0.85
GetPointerMethod · 0.80
GetPointSetMethod · 0.45

Tested by 9

generateModelFitTestNodeFunction · 0.36
setUpMethod · 0.36
setUpMethod · 0.36
CreateImageNodeMethod · 0.36
RenderSplineMethod · 0.36
RenderBlueSplineMethod · 0.36
RenderThickSplineMethod · 0.36