CustusX  2023.01.05-dev+develop.0da12
An IGT application
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) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #ifndef CXDICOMMODELNODE_H
13 #define CXDICOMMODELNODE_H
14 
15 #include "org_custusx_dicom_Export.h"
16 
17 #include "boost/shared_ptr.hpp"
18 #include <vector>
19 #include "cxDICOMModel.h"
20 #include "ctkDICOMDatabase.h"
21 #include "cxDicomImageReader.h"
22 
23 namespace cx
24 {
25 typedef boost::shared_ptr<class DicomModelNode> NodePtr;
26 
27 
38 class org_custusx_dicom_EXPORT DicomModelNode
39 {
40 public:
41  static NodePtr createNode(int row, DicomModelNode* parent, QSharedPointer<ctkDICOMDatabase> dataBase);
42  static NodePtr getNullNode();
43 
45  virtual ~DicomModelNode() {}
46 
47  bool canFetchMore() const;
48  bool hasChildren() const;
49  NodePtr getFetchedChildForRow(int row) const;
50 
51  virtual DICOMModel::IndexType getType() const = 0;
52  virtual void fillChildrenUids() = 0;
53  virtual QVariant getName() const { return QVariant(); }
54  virtual QVariant getTimestamp() const { return QVariant(); }
55  virtual QVariant getModality() const { return QVariant(); }
56  virtual QVariant getImageCount() const { return QVariant(); }
57 
58  QVariant getDefaultName() const { return "No description"; }
59  QString format_date() const { return "yyyy-MM-dd"; }
60  QString format_time() const { return "hh:mm"; }
61 
62  DicomImageReaderPtr createReader() const;
63  virtual QString getFirstDICOMFilename() const { return ""; }
64  QString getUid() const { return UID; }
65  int getRow() const;
66  DicomModelNode* getParent() const { return Parent; }
67  const std::vector<NodePtr>& getFetchedChildren() const { return FetchedChildren; }
68  QStringList getChildrenUID() const { return ChildrenUID; }
69  void removeChild(int index);
70 
71  QVariant getValue(int column) const;
72  QStringList getHeaders() const;
73  bool isNull() const { return this->getType()==DICOMModel::NoneType; }
74 
75 protected:
76  QVariant getUncachedValue(int column) const;
77 
79  std::vector<NodePtr> FetchedChildren;
80  QStringList ChildrenUID;
81 // int Row;
82  QString UID;
83  mutable std::map<int, QVariant> CachedValues;
84  QSharedPointer<ctkDICOMDatabase> DataBase;
85  static NodePtr NullNode;
86 };
87 
88 
92 class org_custusx_dicom_EXPORT NullDicomModelNode : public DicomModelNode
93 {
94 public:
96  virtual ~NullDicomModelNode() {}
97 
99  virtual void fillChildrenUids() {}
100 };
101 
105 class org_custusx_dicom_EXPORT RootDicomModelNode : public DicomModelNode
106 {
107 public:
109  virtual ~RootDicomModelNode() {}
110 
112  virtual void fillChildrenUids();
113 };
114 
115 
119 class org_custusx_dicom_EXPORT PatientDicomModelNode : public DicomModelNode
120 {
121 public:
124 
126  virtual void fillChildrenUids();
127  virtual QVariant getName() const;
128  virtual QVariant getTimestamp() const;
129  virtual QString getFirstDICOMFilename() const;
130 };
131 
135 class org_custusx_dicom_EXPORT StudyDicomModelNode : public DicomModelNode
136 {
137 public:
139  virtual ~StudyDicomModelNode() {}
140 
142  virtual void fillChildrenUids();
143  virtual QVariant getName() const;
144  virtual QVariant getTimestamp() const;
145  virtual QString getFirstDICOMFilename() const;
146 };
147 
151 class org_custusx_dicom_EXPORT SeriesDicomModelNode : public DicomModelNode
152 {
153 public:
156 
158  virtual void fillChildrenUids() {}
159  virtual QVariant getName() const;
160  virtual QVariant getTimestamp() const;
161  virtual QVariant getModality() const;
162  virtual QVariant getImageCount() const;
163  virtual QString getFirstDICOMFilename() const;
164  int getFrameCountForSeries(QString series) const;
165 };
166 
167 } // namespace cx
168 
169 #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
Namespace for all CustusX production code.
virtual QVariant getTimestamp() const