Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
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 (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 
13 #include "mitkSegmentationSink.h"
14 #include "mitkDataStorage.h"
15 #include "mitkRenderingManager.h"
16 
17 namespace mitk
18 {
22  {
23  Superclass::Initialize(other);
24  // sinks should be called explicitly from the tool, because otherwise the order of setting "Input" and "Group node"
25  // would matter
26  UnDefineTriggerParameter("Input");
27 
28  // some basedata output
29  DataNode::Pointer groupNode;
30  bool showResult(true);
31 
32  if (other)
33  {
34  other->GetPointerParameter("Group node", groupNode);
35  other->GetParameter("Show result", showResult);
36  }
37 
38  SetPointerParameter("Group node", groupNode);
39  SetParameter("Show result", showResult);
40  }
41 
43  {
45  GetPointerParameter("Input", image);
46 
47  DataNode::Pointer groupNode;
48  GetPointerParameter("Group node", groupNode);
49 
50  return image.IsNotNull() && groupNode.IsNotNull();
51  }
52 
57  {
58  DataNode *groupNode = GetGroupNode();
59 
60  if (!m_DataStorage.IsExpired())
61  {
62  if (node)
63  node->GetData()->DisconnectPipeline();
64  m_DataStorage.Lock()->Add(node, groupNode);
65  }
66 
68  }
69 
71  {
72  DataNode::Pointer groupNode;
73  GetPointerParameter("Group node", groupNode);
74 
75  return groupNode.GetPointer();
76  }
77 
79  {
80  DataNode::Pointer groupNode;
81  GetPointerParameter("Group node", groupNode);
82 
83  if (groupNode.IsNotNull() && !m_DataStorage.IsExpired())
84  {
85  return m_DataStorage.Lock()->GetNamedDerivedNode(name, groupNode, true);
86  }
87 
88  return nullptr;
89  }
90 
91 } // 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.
WeakPointer< DataStorage > m_DataStorage
void Initialize(const NonBlockingAlgorithm *other=nullptr) override
void GetParameter(const char *parameter, T &value) const
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
static RenderingManager * GetInstance()
mitk::Image::Pointer image
bool ThreadedUpdateFunction() override
void GetPointerParameter(const char *parameter, itk::SmartPointer< T > &value) const
DataNode * LookForPointerTargetBelowGroupNode(const char *name)
void SetPointerParameter(const char *parameter, const itk::SmartPointer< T > &value)
For any kind of smart pointers.
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57