Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
mitkNodePredicateDataType.h
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 #ifndef mitkNodePredicateDataType_h
14 #define mitkNodePredicateDataType_h
15 
16 #include "mitkDataNode.h"
17 #include "mitkNodePredicateBase.h"
18 #include <string>
19 
20 namespace mitk
21 {
22  //##Documentation
23  //## @brief Predicate that evaluates if the given DataNodes data object is of a specific data type
24  //##
25  //## The data type must be specified in the constructor as a string. The string must equal the result
26  //## value of the requested data types GetNameOfClass() method.
27  //##
28  //## @ingroup DataStorage
30  {
31  public:
34 
35  //##Documentation
36  //## @brief Standard Destructor
37  ~NodePredicateDataType() override;
38 
39  //##Documentation
40  //## @brief Checks, if the nodes data object is of a specific data type
41  bool CheckNode(const mitk::DataNode *node) const override;
42 
43  protected:
44  //##Documentation
45  //## @brief Protected constructor, use static instantiation functions instead
46  NodePredicateDataType(const char *datatype);
47 
48  std::string m_ValidDataType;
49  };
50 
59  template <class T>
61  {
62  public:
64  itkFactorylessNewMacro(TNodePredicateDataType);
65 
67  //##Documentation
68  //## @brief Checks, if the nodes data object is of a specific data type (casts)
69  bool CheckNode(const mitk::DataNode *node) const override
70  {
71  return node && node->GetData() && dynamic_cast<T *>(node->GetData());
72  }
73 
74  protected:
75  //##Documentation
76  //## @brief Protected constructor, use static instantiation functions instead
78  };
79 
80 } // namespace mitk
81 
82 #endif
mitk::NodePredicateDataType
Predicate that evaluates if the given DataNodes data object is of a specific data type.
Definition: mitkNodePredicateDataType.h:29
mitkNewMacro1Param
#define mitkNewMacro1Param(classname, type)
Definition: mitkCommon.h:68
mitk::NodePredicateBase
Interface for evaluation conditions used in the DataStorage class GetSubset() method.
Definition: mitkNodePredicateBase.h:35
mitk::NodePredicateDataType::m_ValidDataType
std::string m_ValidDataType
Definition: mitkNodePredicateDataType.h:48
mitkNodePredicateBase.h
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::DataNode::GetData
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
mitk::TNodePredicateDataType::CheckNode
bool CheckNode(const mitk::DataNode *node) const override
Checks, if the nodes data object is of a specific data type (casts)
Definition: mitkNodePredicateDataType.h:69
mitk::TNodePredicateDataType
Tests for type compatibility (dynamic_cast).
Definition: mitkNodePredicateDataType.h:60
mitk::TNodePredicateDataType::TNodePredicateDataType
TNodePredicateDataType()
Protected constructor, use static instantiation functions instead.
Definition: mitkNodePredicateDataType.h:77
mitkDataNode.h
mitk::TNodePredicateDataType::~TNodePredicateDataType
~TNodePredicateDataType() override
Definition: mitkNodePredicateDataType.h:66
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63