Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkAdaptiveRegionGrowingTool.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 #include "mitkImage.h"
19 #include "mitkProperties.h"
20 #include "mitkToolManager.h"
21 // us
22 #include <usGetModuleContext.h>
23 #include <usModule.h>
24 #include <usModuleContext.h>
25 #include <usModuleResource.h>
26 
27 namespace mitk
28 {
30 }
31 
33 {
34  m_PointSetNode = mitk::DataNode::New();
35  m_PointSetNode->GetPropertyList()->SetProperty("name", mitk::StringProperty::New("3D_Regiongrowing_Seedpoint"));
36  m_PointSetNode->GetPropertyList()->SetProperty("helper object", mitk::BoolProperty::New(true));
37  m_PointSet = mitk::PointSet::New();
38  m_PointSetNode->SetData(m_PointSet);
39 }
40 
42 {
43 }
44 
46 {
47  if (referenceData == NULL)
48  return false;
49 
50  Image *image = dynamic_cast<Image *>(referenceData);
51 
52  if (image == NULL)
53  return false;
54 
55  if (image->GetDimension() < 3)
56  return false;
57 
58  return true;
59 }
60 
62 {
63  return NULL;
64 }
65 
67 {
68  return "Region Growing 3D";
69 }
70 
72 {
74  us::ModuleResource resource = module->GetResource("RegionGrowing_48x48.png");
75  return resource;
76 }
77 
79 {
80  Superclass::Activated();
81 
82  if (!GetDataStorage()->Exists(m_PointSetNode))
83  GetDataStorage()->Add(m_PointSetNode, GetWorkingData());
84  m_SeedPointInteractor = mitk::SinglePointDataInteractor::New();
85  m_SeedPointInteractor->LoadStateMachine("PointSet.xml");
86  m_SeedPointInteractor->SetEventConfig("PointSetConfig.xml");
87  m_SeedPointInteractor->SetDataNode(m_PointSetNode);
88 }
89 
91 {
92  m_PointSet->Clear();
93  GetDataStorage()->Remove(m_PointSetNode);
94 
95  Superclass::Deactivated();
96 }
97 
99 {
100  m_ToolManager->ActivateTool(-1);
101 }
102 
104 {
105  return this->m_ToolManager->GetReferenceData(0);
106 }
107 
109 {
110  return this->m_ToolManager->GetDataStorage();
111 }
112 
114 {
115  return this->m_ToolManager->GetWorkingData(0);
116 }
117 
119 {
120  return m_PointSetNode;
121 }
virtual void Deactivated() override
Removes all set points and interactors.
virtual const char * GetName() const override
Get name.
Data management class that handles 'was created by' relations.
Base of all data objects.
Definition: mitkBaseData.h:39
Dummy Tool for AdaptiveRegionGrowingToolGUI to get Tool functionality for AdaptiveRegionGrowing. The actual logic is implemented in QmitkAdaptiveRegionGrowingToolGUI.
static Pointer New()
#define MITKSEGMENTATION_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
static mitk::DataStorage::Pointer GetDataStorage()
#define MITK_TOOL_MACRO(EXPORT_SPEC, CLASS_NAME, DESCRIPTION)
mitk::DataNode * GetReferenceData()
get reference data
static Pointer New()
virtual DataNode::Pointer GetPointSetNode()
get pointset node
static Pointer New()
Module * GetModule() const
mitk::DataStorage * GetDataStorage()
Get datastorage.
Image class for storing images.
Definition: mitkImage.h:76
us::ModuleResource GetIconResource() const override
Get icon resource.
virtual void Activated() override
Adds interactor for the seedpoint and creates a seedpoint if neccessary.
unsigned int GetDimension() const
Get dimension of the image.
Definition: mitkImage.cpp:110
ModuleResource GetResource(const std::string &path) const
Definition: usModule.cpp:267
virtual const char ** GetXPM() const override
Get XPM.
mitk::DataNode * GetWorkingData()
Get working data.
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
static Pointer New()
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66
bool CanHandle(BaseData *referenceData) const override