Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkDiffusionCoreObjectFactory.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"
20 #include "mitkBaseRenderer.h"
21 #include "mitkDataNode.h"
22 
23 #include "mitkCompositeMapper.h"
24 #include "mitkGPUVolumeMapper3D.h"
25 
26 
27 typedef short DiffusionPixelType;
28 
29 typedef std::multimap<std::string, std::string> MultimapType;
30 
33 {
34 
35  static bool alreadyDone = false;
36  if (!alreadyDone)
37  {
38  MITK_DEBUG << "DiffusionCoreObjectFactory c'tor" << std::endl;
39 
41 
42  alreadyDone = true;
43  }
44 
45 }
46 
48 {
49 
50 }
51 
53 {
54  mitk::Mapper::Pointer newMapper=NULL;
55 
57  {
58  std::string classname("QBallImage");
59  if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0)
60  {
61  newMapper = mitk::CompositeMapper::New();
62  newMapper->SetDataNode(node);
63  node->SetMapper(3, ((CompositeMapper*)newMapper.GetPointer())->GetImageMapper());
64  }
65  classname = "TensorImage";
66  if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0)
67  {
68  newMapper = mitk::CompositeMapper::New();
69  newMapper->SetDataNode(node);
70  node->SetMapper(3, ((CompositeMapper*)newMapper.GetPointer())->GetImageMapper());
71  }
72 
73  }
74  else if ( id == mitk::BaseRenderer::Standard3D )
75  {
76  std::string classname("QBallImage");
77  if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0)
78  {
79  newMapper = mitk::GPUVolumeMapper3D::New();
80  newMapper->SetDataNode(node);
81  }
82  classname = "TensorImage";
83  if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0)
84  {
85  newMapper = mitk::GPUVolumeMapper3D::New();
86  newMapper->SetDataNode(node);
87  }
88  }
89 
90  return newMapper;
91 }
92 
94 {
95  std::string classname = "QBallImage";
96  if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0)
97  {
100  }
101 
102  classname = "TensorImage";
103  if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0)
104  {
107  }
108 
109 }
110 
112 {
113  std::string fileExtension;
114  this->CreateFileExtensions(m_FileExtensionsMap, fileExtension);
115  return fileExtension.c_str();
116 }
117 
119 {
120  return m_FileExtensionsMap;
121 }
122 
124 {
125  std::string fileExtension;
126  this->CreateFileExtensions(m_SaveFileExtensionsMap, fileExtension);
127  return fileExtension.c_str();
128 }
129 
131 {
132  return m_SaveFileExtensionsMap;
133 }
134 
136 {
137 
138 }
139 
140 struct RegisterDiffusionCoreObjectFactory{
141  RegisterDiffusionCoreObjectFactory()
142  : m_Factory( mitk::DiffusionCoreObjectFactory::New() )
143  {
144  mitk::CoreObjectFactory::GetInstance()->RegisterExtraFactory( m_Factory );
145  }
146 
147  ~RegisterDiffusionCoreObjectFactory()
148  {
149  mitk::CoreObjectFactory::GetInstance()->UnRegisterExtraFactory( m_Factory );
150  }
151 
153 };
154 
155 static RegisterDiffusionCoreObjectFactory registerDiffusionCoreObjectFactory;
156 
std::multimap< std::string, std::string > MultimapType
static void SetDefaultProperties(DataNode *node, BaseRenderer *renderer=NULL, bool overwrite=false)
virtual void SetMapper(MapperSlotId id, mitk::Mapper *mapper)
virtual const char * GetFileExtensions() override
virtual Mapper::Pointer CreateMapper(mitk::DataNode *node, MapperSlotId slotId) override
#define MITK_DEBUG
Definition: mitkLogMacros.h:26
DataCollection - Class to facilitate loading/accessing structured data.
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
static Pointer New()
Composite pattern for combination of different mappers.
static Pointer New()
virtual void SetDefaultProperties(mitk::DataNode *node) override
virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap() override
virtual const char * GetSaveFileExtensions() override
virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap() override
static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer=NULL, bool overwrite=false)
static RegisterDiffusionCoreObjectFactory registerDiffusionCoreObjectFactory
unsigned int MapperSlotId
Definition: mitkCommon.h:37
std::multimap< std::string, std::string > MultimapType
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.