NorMIT-nav  16.5
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxDicomModelNode.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 #ifndef CXDICOMMODELNODE_H
34 #define CXDICOMMODELNODE_H
35 
36 #include "org_custusx_dicom_Export.h"
37 
38 #include "boost/shared_ptr.hpp"
39 #include <vector>
40 #include "cxDICOMModel.h"
41 #include "ctkDICOMDatabase.h"
42 #include "cxDicomImageReader.h"
43 
44 namespace cx
45 {
46 typedef boost::shared_ptr<class DicomModelNode> NodePtr;
47 
48 
59 class org_custusx_dicom_EXPORT DicomModelNode
60 {
61 public:
62  static NodePtr createNode(int row, DicomModelNode* parent, QSharedPointer<ctkDICOMDatabase> dataBase);
63  static NodePtr getNullNode();
64 
66  virtual ~DicomModelNode() {}
67 
68  bool canFetchMore() const;
69  bool hasChildren() const;
70  NodePtr getFetchedChildForRow(int row) const;
71 
72  virtual DICOMModel::IndexType getType() const = 0;
73  virtual void fillChildrenUids() = 0;
74  virtual QVariant getName() const { return QVariant(); }
75  virtual QVariant getTimestamp() const { return QVariant(); }
76  virtual QVariant getModality() const { return QVariant(); }
77  virtual QVariant getImageCount() const { return QVariant(); }
78 
79  QVariant getDefaultName() const { return "No description"; }
80  QString format_date() const { return "yyyy-MM-dd"; }
81  QString format_time() const { return "hh:mm"; }
82 
83  DicomImageReaderPtr createReader() const;
84  virtual QString getFirstDICOMFilename() const { return ""; }
85  QString getUid() const { return UID; }
86  int getRow() const;
87  DicomModelNode* getParent() const { return Parent; }
88  const std::vector<NodePtr>& getFetchedChildren() const { return FetchedChildren; }
89  QStringList getChildrenUID() const { return ChildrenUID; }
90  void removeChild(int index);
91 
92  QVariant getValue(int column) const;
93  QStringList getHeaders() const;
94  bool isNull() const { return this->getType()==DICOMModel::NoneType; }
95 
96 protected:
97  QVariant getUncachedValue(int column) const;
98 
100  std::vector<NodePtr> FetchedChildren;
101  QStringList ChildrenUID;
102 // int Row;
103  QString UID;
104  mutable std::map<int, QVariant> CachedValues;
105  QSharedPointer<ctkDICOMDatabase> DataBase;
107 };
108 
109 
113 class org_custusx_dicom_EXPORT NullDicomModelNode : public DicomModelNode
114 {
115 public:
117  virtual ~NullDicomModelNode() {}
118 
120  virtual void fillChildrenUids() {}
121 };
122 
126 class org_custusx_dicom_EXPORT RootDicomModelNode : public DicomModelNode
127 {
128 public:
130  virtual ~RootDicomModelNode() {}
131 
133  virtual void fillChildrenUids();
134 };
135 
136 
140 class org_custusx_dicom_EXPORT PatientDicomModelNode : public DicomModelNode
141 {
142 public:
145 
147  virtual void fillChildrenUids();
148  virtual QVariant getName() const;
149  virtual QVariant getTimestamp() const;
150  virtual QString getFirstDICOMFilename() const;
151 };
152 
156 class org_custusx_dicom_EXPORT StudyDicomModelNode : public DicomModelNode
157 {
158 public:
160  virtual ~StudyDicomModelNode() {}
161 
163  virtual void fillChildrenUids();
164  virtual QVariant getName() const;
165  virtual QVariant getTimestamp() const;
166  virtual QString getFirstDICOMFilename() const;
167 };
168 
172 class org_custusx_dicom_EXPORT SeriesDicomModelNode : public DicomModelNode
173 {
174 public:
177 
179  virtual void fillChildrenUids() {}
180  virtual QVariant getName() const;
181  virtual QVariant getTimestamp() const;
182  virtual QVariant getModality() const;
183  virtual QVariant getImageCount() const;
184  virtual QString getFirstDICOMFilename() const;
185  int getFrameCountForSeries(QString series) const;
186 };
187 
188 } // namespace cx
189 
190 #endif // CXDICOMMODELNODE_H
virtual void fillChildrenUids()
std::vector< NodePtr > FetchedChildren
all children currently loaded (filled by fetchMore())
bool isNull() const
QString getUid() const
QString format_time() const
QStringList getChildrenUID() const
uids of all loaded and unloaded children.
virtual DICOMModel::IndexType getType() const
virtual DICOMModel::IndexType getType() const
QSharedPointer< ctkDICOMDatabase > DataBase
boost::shared_ptr< class DicomModelNode > NodePtr
virtual DICOMModel::IndexType getType() const
DicomModelNode * getParent() const
DicomModelNode * Parent
virtual DICOMModel::IndexType getType() const
QVariant getDefaultName() const
virtual DICOMModel::IndexType getType() const
QStringList ChildrenUID
uids of all loaded and unloaded children.
static NodePtr NullNode
virtual void fillChildrenUids()
const std::vector< NodePtr > & getFetchedChildren() const
all children currently loaded (filled by fetchMore())
boost::shared_ptr< class DicomImageReader > DicomImageReaderPtr
virtual QVariant getImageCount() const
std::map< int, QVariant > CachedValues
virtual QString getFirstDICOMFilename() const
virtual QVariant getName() const
QString format_date() const
virtual QVariant getModality() const
virtual QVariant getTimestamp() const