Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkMAPRegistrationWrapperObjectFactory.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>
16 #include <mitkBaseRenderer.h>
17 #include <mitkDataNode.h>
18 
22 
23 typedef std::multimap<std::string, std::string> MultimapType;
24 
27 {
28  static bool alreadyDone = false;
29  if (!alreadyDone)
30  {
31  alreadyDone = true;
32  }
33 
34 }
35 
37 {
38 }
39 
43 {
44  mitk::Mapper::Pointer newMapper=nullptr;
45 
46  if ( slotId == mitk::BaseRenderer::Standard2D )
47  {
48  std::string classname("MAPRegistrationWrapper");
49  if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0)
50  {
52  newMapper->SetDataNode(node);
53  }
54  }
55  else if ( slotId == mitk::BaseRenderer::Standard3D )
56  {
57  std::string classname("MAPRegistrationWrapper");
58  if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0)
59  {
61  newMapper->SetDataNode(node);
62  }
63  }
64 
65  return newMapper;
66 };
67 
69 {
70  if(node==nullptr)
71  return;
72 
73  mitk::DataNode::Pointer nodePointer = node;
74 
75  if(node->GetData() ==nullptr)
76  return;
77 
78  if( dynamic_cast<mitk::MAPRegistrationWrapper*>(node->GetData())!=nullptr )
79  {
81  }
82 }
83 
85 {
86  std::string fileExtension;
87  this->CreateFileExtensions(m_FileExtensionsMap, fileExtension);
88  return fileExtension.c_str();
89 };
90 
92 {
93  return m_FileExtensionsMap;
94 }
95 
97 {
98  std::string fileExtension;
99  this->CreateFileExtensions(m_SaveFileExtensionsMap, fileExtension);
100  return fileExtension.c_str();
101 }
102 
104 {
105  return m_SaveFileExtensionsMap;
106 }
107 
108 struct RegisterMAPRegistrationWrapperObjectFactoryHelper{
109  RegisterMAPRegistrationWrapperObjectFactoryHelper()
111  {
112  mitk::CoreObjectFactory::GetInstance()->RegisterExtraFactory( m_Factory );
113  }
114 
115  ~RegisterMAPRegistrationWrapperObjectFactoryHelper()
116  {
117  mitk::CoreObjectFactory::GetInstance()->UnRegisterExtraFactory( m_Factory );
118  }
119 
121 };
122 
123 static RegisterMAPRegistrationWrapperObjectFactoryHelper registerMITKRegistrationWrapperIOFactoryHelper;
std::multimap< std::string, std::string > MultimapType
virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap()
virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap()
static RegisterMAPRegistrationWrapperObjectFactoryHelper registerMITKRegistrationWrapperIOFactoryHelper
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
static void CreateFileExtensions(MultimapType fileExtensionsMap, std::string &fileExtensions)
create a string from a map that contains the file extensions
mitk::Mapper::Pointer CreateMapper(mitk::DataNode *node, MapperSlotId slotId) override
static void SetDefaultProperties(DataNode *node, BaseRenderer *renderer=nullptr, bool overwrite=false)
unsigned int MapperSlotId
Definition: mitkCommon.h:33
std::multimap< std::string, std::string > MultimapType
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57