Medical Imaging Interaction Toolkit  2018.4.99-3e3f1a6e
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 (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 <mitkProperties.h>
17 #include <mitkImage.h>
18 
20  mitk::generateRegistrationResultNode(const std::string& nodeName, mitk::MAPRegistrationWrapper::Pointer resultReg, const std::string& algorithmUID, const std::string& movingDataUID, const std::string& targetDataUID)
21 {
22  if (resultReg.IsNull())
23  {
24  mitkThrow() << "Cannot generate registration result node. Passed registration wrapper points to nullptr.";
25  }
26 
28  m_spRegNode->SetData(resultReg);
29  m_spRegNode->SetName(nodeName);
30  resultReg->SetProperty(mitk::Prop_RegAlgUsed, mitk::StringProperty::New(algorithmUID));
31  resultReg->SetProperty(mitk::Prop_RegAlgMovingData, mitk::StringProperty::New(movingDataUID));
32  resultReg->SetProperty(mitk::Prop_RegAlgTargetData, mitk::StringProperty::New(targetDataUID));
33  resultReg->SetProperty(mitk::Prop_RegUID, mitk::StringProperty::New(resultReg->GetRegistration()->getRegistrationUID()));
34 
35  return m_spRegNode;
36 };
37 
38 
40  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)
41 {
42  if (mappedData.IsNull())
43  {
44  mitkThrow() << "Cannot generate mapping result node. Passed mapped data points to nullptr.";
45  }
46 
48 
49  mappedDataNode->SetData(mappedData);
50  mappedDataNode->SetName(nodeName);
51  if (!regUID.empty())
52  {
53  mappedData->SetProperty(mitk::Prop_RegUID, mitk::StringProperty::New(regUID));
54  }
55  mappedData->SetProperty(mitk::Prop_MappingInputData, mitk::StringProperty::New(inputDataUID));
56  if (refinedGeometry)
57  {
58  mappedData->SetProperty(mitk::Prop_MappingInterpolator, mitk::StringProperty::New("None"));
59  mappedData->SetProperty(mitk::Prop_MappingRefinedGeometry, mitk::BoolProperty::New(true));
60  }
61  else
62  {
63  mitk::Image* image = dynamic_cast<mitk::Image*>(mappedData.GetPointer());
64 
65  if(image)
66  {
67  mappedData->SetProperty(mitk::Prop_MappingInterpolator, mitk::StringProperty::New(interpolator));
68  }
69  else
70  {
71  mappedData->SetProperty(mitk::Prop_MappingInterpolator, mitk::StringProperty::New("None"));
72  mappedDataNode->SetColor(0.0, 0.0, 1.0);
73  }
74  }
75 
76  return mappedDataNode;
77 };
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:72
mitk::Image::Pointer image
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()