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
mitkSegmentationSink.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 
17 #include "mitkSegmentationSink.h"
18 #include "mitkDataStorage.h"
19 #include "mitkRenderingManager.h"
20 
21 namespace mitk
22 {
26  {
27  Superclass::Initialize(other);
28  // sinks should be called explicitly from the tool, because otherwise the order of setting "Input" and "Group node"
29  // would matter
30  UnDefineTriggerParameter("Input");
31 
32  // some basedata output
33  DataNode::Pointer groupNode;
34  bool showResult(true);
35 
36  if (other)
37  {
38  other->GetPointerParameter("Group node", groupNode);
39  other->GetParameter("Show result", showResult);
40  }
41 
42  SetPointerParameter("Group node", groupNode);
43  SetParameter("Show result", showResult);
44  }
45 
47  {
48  Image::Pointer image;
49  GetPointerParameter("Input", image);
50 
51  DataNode::Pointer groupNode;
52  GetPointerParameter("Group node", groupNode);
53 
54  return image.IsNotNull() && groupNode.IsNotNull();
55  }
56 
61  {
62  DataNode *groupNode = GetGroupNode();
63 
64  if (m_DataStorage.IsNotNull())
65  {
66  if (node)
67  node->GetData()->DisconnectPipeline();
68  m_DataStorage->Add(node, groupNode);
69  }
70 
72  }
73 
75  {
76  DataNode::Pointer groupNode;
77  GetPointerParameter("Group node", groupNode);
78 
79  return groupNode.GetPointer();
80  }
81 
83  {
84  DataNode::Pointer groupNode;
85  GetPointerParameter("Group node", groupNode);
86 
87  if (groupNode.IsNotNull() && m_DataStorage.IsNotNull())
88  {
89  return m_DataStorage->GetNamedDerivedNode(name, groupNode, true);
90  }
91 
92  return nullptr;
93  }
94 
95 } // namespace
void InsertBelowGroupNode(mitk::DataNode *node)
DataCollection - Class to facilitate loading/accessing structured data.
void SetParameter(const char *parameter, const T &value)
For any kind of normal types.
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
WeakPointer< DataStorage > m_DataStorage
virtual void Initialize(const NonBlockingAlgorithm *other=nullptr) override
static RenderingManager * GetInstance()
virtual bool ThreadedUpdateFunction() override
virtual bool ReadyToRun() override
DataNode * LookForPointerTargetBelowGroupNode(const char *name)
void SetPointerParameter(const char *parameter, const itk::SmartPointer< T > &value)
For any kind of smart pointers.
void GetPointerParameter(const char *parameter, itk::SmartPointer< T > &value) const
void GetParameter(const char *parameter, T &value) const
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66