00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #include <mitkDataTreeFilterFunctions.h> 00019 #include "mitkDataNode.h" 00020 00021 namespace mitk 00022 { 00023 00024 bool DataTreeFilterFunction::operator()(DataNode* node) const 00025 { 00026 return NodeMatches(node); 00027 } 00028 00029 bool IsDataNode::NodeMatches(DataNode* node) const 00030 { 00031 return ( node != NULL ); 00032 } 00033 00034 DataTreeFilterFunction* IsDataNode::Clone() const 00035 { 00036 return new IsDataNode(); 00037 } 00038 00039 bool IsGoodDataNode::NodeMatches(DataNode* node) const 00040 { 00041 return ( node != NULL && node->GetData() ); 00042 } 00043 00044 DataTreeFilterFunction* IsGoodDataNode::Clone() const 00045 { 00046 return new IsGoodDataNode(); 00047 } 00048 00049 bool IsInResultSet::NodeMatches(DataNode* node) const 00050 { 00051 if ((node == NULL) || (m_ResultSet.empty())) 00052 return false; 00053 00054 return (std::find(m_ResultSet.begin(), m_ResultSet.end(), node) != m_ResultSet.end()); // search for node in resultset 00055 } 00056 00057 DataTreeFilterFunction* IsInResultSet::Clone() const 00058 { 00059 return new IsInResultSet(m_ResultSet); 00060 } 00061 00062 } // namespace 00063