Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkTubeGraphObjectFactory.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 <mitkBaseRenderer.h>
16 #include <mitkDataNode.h>
17 #include <mitkProperties.h>
18 
19 #include "mitkTubeGraph.h"
21 
23 {
24  static bool alreadyDone = false;
25  if (!alreadyDone)
26  {
27  MITK_INFO << "TubeGraphObjectFactory c'tor" << std::endl;
28  CreateFileExtensionsMap();
29 
30  alreadyDone = true;
31  }
32 }
33 
35 {
36  mitk::Mapper::Pointer newMapper = nullptr;
37 
39  {
40  if ((dynamic_cast<mitk::TubeGraph *>(node->GetData()) != nullptr))
41  {
42  newMapper = mitk::TubeGraphVtkMapper3D::New();
43  newMapper->SetDataNode(node);
44  }
45  }
46 
47  return newMapper;
48 }
49 
51 {
52  if ((dynamic_cast<mitk::TubeGraph *>(node->GetData()) != nullptr))
53  {
54  node->SetProperty("Tube Graph.Clip Structures", mitk::BoolProperty::New(false));
56  }
57 }
58 
60 {
61  std::string fileExtension;
62  this->CreateFileExtensions(m_FileExtensionsMap, fileExtension);
63  return fileExtension.c_str();
64 };
65 
67 {
68  return m_FileExtensionsMap;
69 }
70 
72 {
73  std::string fileExtension;
74  this->CreateFileExtensions(m_SaveFileExtensionsMap, fileExtension);
75  return fileExtension.c_str();
76 };
77 
79 {
80  return m_SaveFileExtensionsMap;
81 }
82 
83 void mitk::TubeGraphObjectFactory::CreateFileExtensionsMap()
84 {
85 }
86 
87 struct RegisterTubeGraphObjectFactory
88 {
89  RegisterTubeGraphObjectFactory() : m_Factory(mitk::TubeGraphObjectFactory::New())
90  {
91  mitk::CoreObjectFactory::GetInstance()->RegisterExtraFactory(m_Factory);
92  }
93  ~RegisterTubeGraphObjectFactory() { mitk::CoreObjectFactory::GetInstance()->UnRegisterExtraFactory(m_Factory); }
95 };
96 
97 static RegisterTubeGraphObjectFactory registerTubeGraphObjectFactory;
static RegisterTubeGraphObjectFactory registerTubeGraphObjectFactory
#define MITK_INFO
Definition: mitkLogMacros.h:18
mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap() override
mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap() override
Mapper::Pointer CreateMapper(mitk::DataNode *node, MapperSlotId slotId) override
static Pointer New()
void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Add new or change existent property.
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
const char * GetSaveFileExtensions() override
static void CreateFileExtensions(MultimapType fileExtensionsMap, std::string &fileExtensions)
create a string from a map that contains the file extensions
void SetDefaultProperties(mitk::DataNode *node) override
unsigned int MapperSlotId
Definition: mitkCommon.h:33
std::multimap< std::string, std::string > MultimapType
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57
static void SetDefaultProperties(DataNode *node, BaseRenderer *renderer=nullptr, bool overwrite=false)
Set default values of properties used by this mapper to node.
Definition: mitkMapper.cpp:143