Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkCESTImageDetectionHelper.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 
14 
15 #include "mitkCustomTagParser.h"
16 #include "mitkImage.h"
17 #include "mitkDataNode.h"
19 
20 bool mitk::IsAnyCESTImage(const Image* cestImage)
21 {
22  if (!cestImage) return false;
23 
24  auto prop = cestImage->GetProperty(mitk::CEST_PROPERTY_NAME_TOTALSCANTIME().c_str());
25 
26  return prop.IsNotNull();
27 };
28 
29 bool mitk::IsCESTorWasabiImage(const Image* cestImage)
30 {
31  if (!cestImage) return false;
32 
33  return IsAnyCESTImage(cestImage) && !IsCESTT1Image(cestImage);
34 };
35 
36 bool mitk::IsCESTT1Image(const Image* cestImage)
37 {
38  if (!cestImage) return false;
39 
40  auto prop = cestImage->GetProperty(mitk::CEST_PROPERTY_NAME_TREC().c_str());
41 
42  return prop.IsNotNull();
43 };
44 
46 {
47  auto cestCheck = [](const mitk::DataNode * node)
48  {
49  if (node)
50  {
51  return mitk::IsAnyCESTImage(dynamic_cast<const mitk::Image*>(node->GetData()));
52  }
53  return false;
54  };
55 
56  return mitk::NodePredicateFunction::New(cestCheck).GetPointer();
57 };
58 
60 {
61  auto cestCheck = [](const mitk::DataNode * node)
62  {
63  if (node)
64  {
65  return mitk::IsCESTorWasabiImage(dynamic_cast<const mitk::Image*>(node->GetData()));
66  }
67  return false;
68  };
69 
70  return mitk::NodePredicateFunction::New(cestCheck).GetPointer();
71 };
72 
74 {
75  auto cestCheck = [](const mitk::DataNode * node)
76  {
77  if (node)
78  {
79  return mitk::IsCESTT1Image(dynamic_cast<const mitk::Image*>(node->GetData()));
80  }
81  return false;
82  };
83 
84  return mitk::NodePredicateFunction::New(cestCheck).GetPointer();
85 };
MITKCEST_EXPORT bool IsAnyCESTImage(const Image *cestImage)
static Pointer New(const FunctionType &_arg)
const std::string MITKCEST_EXPORT CEST_PROPERTY_NAME_TOTALSCANTIME()
MITKCEST_EXPORT bool IsCESTT1Image(const Image *cestImage)
MITKCEST_EXPORT bool IsCESTorWasabiImage(const Image *cestImage)
Image class for storing images.
Definition: mitkImage.h:72
const std::string MITKCEST_EXPORT CEST_PROPERTY_NAME_TREC()
MITKCEST_EXPORT NodePredicateBase::Pointer CreateCESTorWasabiImageNodePredicate()
mitk::BaseProperty::Pointer GetProperty(const char *propertyKey) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList, and set it to this, respectively;.
MITKCEST_EXPORT NodePredicateBase::Pointer CreateAnyCESTImageNodePredicate()
MITKCEST_EXPORT NodePredicateBase::Pointer CreateCESTT1ImageNodePredicate()
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57