Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkNodePredicateSource.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 
20  : NodePredicateBase(), m_BaseNode(n), m_SearchAllSources(allsources), m_DataStorage(ds)
21 {
22 }
23 
25 {
26 }
27 
29 {
30  if (m_DataStorage && m_BaseNode)
31  {
32  const mitk::DataStorage::SetOfObjects::STLContainerType sources =
33  m_DataStorage->GetSources(childNode, nullptr, !m_SearchAllSources)->CastToSTLConstContainer();
34 
35  return std::find(sources.cbegin(), sources.cend(), m_BaseNode) != sources.cend();
36  }
37 
38  return false;
39 }
Data management class that handles 'was created by' relations.
NodePredicateSource(mitk::DataNode *n, bool allsources, mitk::DataStorage *ds)
Constructor - This class can either search only for direct source objects or for all source objects...
mitk::DataStorage::Pointer m_DataStorage
virtual bool CheckNode(const mitk::DataNode *childNode) const override
Checks, if m_BaseNode is a source node of childNode (e.g. if childNode "was created from" m_BaseNode)...
Interface for evaluation conditions used in the DataStorage class GetSubset() method.
virtual ~NodePredicateSource()
Standard Destructor.
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66