NorMIT-nav  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
cx::PatientDicomModelNode::getType
virtual DICOMModel::IndexType getType() const
Definition: cxDicomModelNode.h:125
cx::DicomModelNode::getDefaultName
QVariant getDefaultName() const
Definition: cxDicomModelNode.h:58
cx::DicomImageReaderPtr
boost::shared_ptr< class DicomImageReader > DicomImageReaderPtr
Definition: cxDicomConverter.h:21
cx::PatientDicomModelNode::~PatientDicomModelNode
virtual ~PatientDicomModelNode()
Definition: cxDicomModelNode.h:123
cx::DicomModelNode::isNull
bool isNull() const
Definition: cxDicomModelNode.h:73
cx::StudyDicomModelNode::getType
virtual DICOMModel::IndexType getType() const
Definition: cxDicomModelNode.h:141
cx::DicomModelNode::~DicomModelNode
virtual ~DicomModelNode()
Definition: cxDicomModelNode.h:45
cx::DicomModelNode::ChildrenUID
QStringList ChildrenUID
uids of all loaded and unloaded children.
Definition: cxDicomModelNode.h:80
cx::NullDicomModelNode::~NullDicomModelNode
virtual ~NullDicomModelNode()
Definition: cxDicomModelNode.h:96
cx::NullDicomModelNode::getType
virtual DICOMModel::IndexType getType() const
Definition: cxDicomModelNode.h:98
cx::SeriesDicomModelNode::getType
virtual DICOMModel::IndexType getType() const
Definition: cxDicomModelNode.h:157
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::RootDicomModelNode::RootDicomModelNode
RootDicomModelNode()
Definition: cxDicomModelNode.h:108
cx::RootDicomModelNode::~RootDicomModelNode
virtual ~RootDicomModelNode()
Definition: cxDicomModelNode.h:109
cx::DicomModelNode::DataBase
QSharedPointer< ctkDICOMDatabase > DataBase
Definition: cxDicomModelNode.h:84
cx::DicomModelNode::getUid
QString getUid() const
Definition: cxDicomModelNode.h:64
cx::DicomModelNode
Definition: cxDicomModelNode.h:38
cx::DicomModelNode::getName
virtual QVariant getName() const
Definition: cxDicomModelNode.h:53
cx::DicomModelNode::CachedValues
std::map< int, QVariant > CachedValues
Definition: cxDicomModelNode.h:83
cx::DicomModelNode::getTimestamp
virtual QVariant getTimestamp() const
Definition: cxDicomModelNode.h:54
cx::RootDicomModelNode
Definition: cxDicomModelNode.h:105
cx::DICOMModel::NoneType
@ NoneType
Definition: cxDICOMModel.h:58
cx::SeriesDicomModelNode::SeriesDicomModelNode
SeriesDicomModelNode()
Definition: cxDicomModelNode.h:154
cx::StudyDicomModelNode
Definition: cxDicomModelNode.h:135
cx::DICOMModel::SeriesType
@ SeriesType
Definition: cxDICOMModel.h:56
cx::DICOMModel::StudyType
@ StudyType
Definition: cxDICOMModel.h:55
cx::NullDicomModelNode::fillChildrenUids
virtual void fillChildrenUids()
Definition: cxDicomModelNode.h:99
cx::DicomModelNode::getModality
virtual QVariant getModality() const
Definition: cxDicomModelNode.h:55
cx::SeriesDicomModelNode
Definition: cxDicomModelNode.h:151
cx::DicomModelNode::format_date
QString format_date() const
Definition: cxDicomModelNode.h:59
cx::PatientDicomModelNode
Definition: cxDicomModelNode.h:119
cx::SeriesDicomModelNode::fillChildrenUids
virtual void fillChildrenUids()
Definition: cxDicomModelNode.h:158
cx::DicomModelNode::UID
QString UID
Definition: cxDicomModelNode.h:82
cx::DICOMModel::PatientType
@ PatientType
Definition: cxDICOMModel.h:54
cx::DICOMModel::RootType
@ RootType
Definition: cxDICOMModel.h:53
cx::NullDicomModelNode
Definition: cxDicomModelNode.h:92
cx::StudyDicomModelNode::~StudyDicomModelNode
virtual ~StudyDicomModelNode()
Definition: cxDicomModelNode.h:139
cx::DicomModelNode::FetchedChildren
std::vector< NodePtr > FetchedChildren
all children currently loaded (filled by fetchMore())
Definition: cxDicomModelNode.h:79
cx::DicomModelNode::format_time
QString format_time() const
Definition: cxDicomModelNode.h:60
cx::DicomModelNode::getParent
DicomModelNode * getParent() const
Definition: cxDicomModelNode.h:66
cx::RootDicomModelNode::getType
virtual DICOMModel::IndexType getType() const
Definition: cxDicomModelNode.h:111
cx::SeriesDicomModelNode::~SeriesDicomModelNode
virtual ~SeriesDicomModelNode()
Definition: cxDicomModelNode.h:155
cx::DICOMModel::IndexType
IndexType
Definition: cxDICOMModel.h:52
cx::NodePtr
boost::shared_ptr< class DicomModelNode > NodePtr
Definition: cxDicomModelNode.h:25
cx::DicomModelNode::getFirstDICOMFilename
virtual QString getFirstDICOMFilename() const
Definition: cxDicomModelNode.h:63
cxDICOMModel.h
cx::DicomModelNode::Parent
DicomModelNode * Parent
Definition: cxDicomModelNode.h:78
cx::StudyDicomModelNode::StudyDicomModelNode
StudyDicomModelNode()
Definition: cxDicomModelNode.h:138
cx::PatientDicomModelNode::PatientDicomModelNode
PatientDicomModelNode()
Definition: cxDicomModelNode.h:122
cx::NullDicomModelNode::NullDicomModelNode
NullDicomModelNode()
Definition: cxDicomModelNode.h:95
cx::DicomModelNode::getImageCount
virtual QVariant getImageCount() const
Definition: cxDicomModelNode.h:56
cx::DicomModelNode::NullNode
static NodePtr NullNode
Definition: cxDicomModelNode.h:85