Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkMAPAlgorithmInfoSelection.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 
16 
17 namespace mitk
18 {
19 
21  m_Selection(new ContainerType())
22 {
23 
24 }
25 
28 {
30  m_Selection->push_back(obj);
31 }
32 
35 {
36  for (AlgorithmInfoVectorType::const_iterator i = infos.begin(); i != infos.end(); ++i)
37  {
39  m_Selection->push_back(obj);
40  }
41 }
42 
44 {
45  if (m_Selection->empty())
46  return berry::Object::Pointer();
47 
48  return *(m_Selection->begin());
49 }
50 
52 {
53  return m_Selection->begin();
54 }
55 
57 {
58  return m_Selection->end();
59 }
60 
62 {
63  return m_Selection->size();
64 }
65 
67 {
68  return m_Selection;
69 }
70 
72 {
73  AlgorithmInfoVectorType selectedInfos;
74  if(IsEmpty())
75  return selectedInfos;
76 
78  AlgorithmInfoType::ConstPointer info;
79 
80  for(iterator it = Begin(); it != End(); ++it)
81  {
82  infoObject = it->Cast<MAPAlgorithmInfoObject>();
83  if(infoObject.IsNotNull())
84  {
85  info = infoObject->GetInfo();
86  if(info.IsNotNull())
87  selectedInfos.push_back(info);
88  }
89  }
90  return selectedInfos;
91 }
92 
94 {
95  return m_Selection->empty();
96 }
97 
99 {
100  if (const berry::IStructuredSelection* other = dynamic_cast<const berry::IStructuredSelection*>(obj))
101  {
102  return m_Selection == other->ToVector();
103  }
104 
105  return false;
106 }
107 
108 }
ContainerType::Pointer ToVector() const override
Light weight base class for most BlueBerry classes.
Definition: berryObject.h:72
SmartPointer< Other > Cast() const
berry wrapper for a MatchPoint algorithm deployment info
DataCollection - Class to facilitate loading/accessing structured data.
ContainerType::const_iterator iterator
AlgorithmInfoVectorType GetSelectedAlgorithmInfo() const
static void info(const char *fmt,...)
Definition: svm.cpp:86
Object::Pointer GetFirstElement() const override
std::vector< AlgorithmInfoType::ConstPointer > AlgorithmInfoVectorType
bool operator==(const berry::Object *obj) const override