Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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,
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 
21 namespace mitk
22 {
23 
25  m_Selection(new ContainerType())
26 {
27 
28 }
29 
31  m_Selection(new ContainerType())
32 {
34  m_Selection->push_back(obj);
35 }
36 
38  m_Selection(new ContainerType())
39 {
40  for (AlgorithmInfoVectorType::const_iterator i = infos.begin(); i != infos.end(); ++i)
41  {
43  m_Selection->push_back(obj);
44  }
45 }
46 
48 {
49  if (m_Selection->empty())
50  return berry::Object::Pointer();
51 
52  return *(m_Selection->begin());
53 }
54 
56 {
57  return m_Selection->begin();
58 }
59 
61 {
62  return m_Selection->end();
63 }
64 
66 {
67  return m_Selection->size();
68 }
69 
71 {
72  return m_Selection;
73 }
74 
76 {
77  AlgorithmInfoVectorType selectedInfos;
78  if(IsEmpty())
79  return selectedInfos;
80 
83 
84  for(iterator it = Begin(); it != End(); ++it)
85  {
86  infoObject = it->Cast<MAPAlgorithmInfoObject>();
87  if(infoObject.IsNotNull())
88  {
89  info = infoObject->GetInfo();
90  if(info.IsNotNull())
91  selectedInfos.push_back(info);
92  }
93  }
94  return selectedInfos;
95 }
96 
98 {
99  return m_Selection->empty();
100 }
101 
103 {
104  if (const berry::IStructuredSelection* other = dynamic_cast<const berry::IStructuredSelection*>(obj))
105  {
106  return m_Selection == other->ToVector();
107  }
108 
109  return false;
110 }
111 
112 }
Light weight base class for most BlueBerry classes.
Definition: berryObject.h:78
DataCollection - Class to facilitate loading/accessing structured data.
ContainerType::const_iterator iterator
static void info(const char *fmt,...)
Definition: svm.cpp:100
itk::SmartPointer< const Self > ConstPointer
virtual Object::Pointer GetFirstElement() const
virtual ContainerType::Pointer ToVector() const
AlgorithmInfoVectorType GetSelectedAlgorithmInfo() const
SmartPointer< Other > Cast() const
std::vector< AlgorithmInfoType::ConstPointer > AlgorithmInfoVectorType
bool operator==(const berry::Object *obj) const