Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkResultNodeGenerationHelper.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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
18 
19 #include <mitkProperties.h>
21 #include <mitkImage.h>
22 
24  mitk::generateRegistrationResultNode(const std::string& nodeName, mitk::MAPRegistrationWrapper::Pointer resultReg, const std::string& algorithmUID, const std::string& movingDataUID, const std::string& targetDataUID)
25 {
26  if (resultReg.IsNull())
27  {
28  mitkThrow() << "Cannot generate registration result node. Passed registration wrapper points to NULL.";
29  }
30 
32  m_spRegNode->SetData(resultReg);
33  m_spRegNode->SetName(nodeName);
34  resultReg->SetProperty(mitk::Prop_RegAlgUsed, mitk::StringProperty::New(algorithmUID));
35  resultReg->SetProperty(mitk::Prop_RegAlgMovingData, mitk::StringProperty::New(movingDataUID));
36  resultReg->SetProperty(mitk::Prop_RegAlgTargetData, mitk::StringProperty::New(targetDataUID));
37  resultReg->SetProperty(mitk::Prop_RegUID, mitk::StringProperty::New(resultReg->GetRegistration()->getRegistrationUID()));
38 
39  return m_spRegNode;
40 };
41 
42 
44  mitk::generateMappedResultNode(const std::string& nodeName, mitk::BaseData::Pointer mappedData, const std::string& regUID, const std::string& inputDataUID, const bool refinedGeometry, const std::string& interpolator)
45 {
46  if (mappedData.IsNull())
47  {
48  mitkThrow() << "Cannot generate mapping result node. Passed mapped data points to NULL.";
49  }
50 
52 
53  mappedDataNode->SetData(mappedData);
54  mappedDataNode->SetName(nodeName);
55  if (!regUID.empty())
56  {
57  mappedData->SetProperty(mitk::Prop_RegUID, mitk::StringProperty::New(regUID));
58  }
59  mappedData->SetProperty(mitk::Prop_MappingInputData, mitk::StringProperty::New(inputDataUID));
60  if (refinedGeometry)
61  {
62  mappedData->SetProperty(mitk::Prop_MappingInterpolator, mitk::StringProperty::New("None"));
63  mappedData->SetProperty(mitk::Prop_MappingRefinedGeometry, mitk::BoolProperty::New(true));
64  }
65  else
66  {
67  mitk::Image* image = dynamic_cast<mitk::Image*>(mappedData.GetPointer());
68 
69  if(image)
70  {
71  mappedData->SetProperty(mitk::Prop_MappingInterpolator, mitk::StringProperty::New(interpolator));
72  }
73  else
74  {
75  mappedData->SetProperty(mitk::Prop_MappingInterpolator, mitk::StringProperty::New("None"));
76  mappedDataNode->SetColor(0.0, 0.0, 1.0);
77  }
78  }
79 
80  return mappedDataNode;
81 };
const char *const Prop_MappingInterpolator
MITKMATCHPOINTREGISTRATION_EXPORT mitk::DataNode::Pointer generateMappedResultNode(const std::string &nodeName, mitk::BaseData::Pointer mappedData, const std::string &regUID, const std::string &inputDataUID, const bool refinedGeometry, const std::string &interpolator="Unkown")
const char *const Prop_MappingRefinedGeometry
const char *const Prop_MappingInputData
static Pointer New()
const char *const Prop_RegUID
static Pointer New()
#define mitkThrow()
Image class for storing images.
Definition: mitkImage.h:76
const char *const Prop_RegAlgTargetData
const char *const Prop_RegAlgUsed
const char *const Prop_RegAlgMovingData
MITKMATCHPOINTREGISTRATION_EXPORT mitk::DataNode::Pointer generateRegistrationResultNode(const std::string &nodeName, mitk::MAPRegistrationWrapper::Pointer resultReg, const std::string &algorithmUID, const std::string &movingDataUID, const std::string &targetDataUID)
static Pointer New()