Fraxinus  18.10
An IGT application
cxDicomImageReader.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 #ifndef CXDICOMIMAGEREADER_H
12 #define CXDICOMIMAGEREADER_H
13 
14 #include "org_custusx_dicom_Export.h"
15 
16 #include "ctkDICOMDatabase.h"
17 #include "cxTypeConversions.h"
18 #include "cxTime.h"
19 #include "vtkImageData.h"
21 #include <vtkImageAppend.h>
22 
23 
24 #include "ctkDICOMItem.h"
25 #include "dcfilefo.h" // DcmFileFormat
26 #include "dcdeftag.h" // defines all dcm tags
27 #include "dcmimage.h"
28 #include <string.h>
29 #include "cxForwardDeclarations.h"
30 
31 typedef boost::shared_ptr<class ctkDICOMItem> ctkDICOMItemPtr;
32 
33 namespace cx
34 {
35 typedef boost::shared_ptr<class DicomImageReader> DicomImageReaderPtr;
36 
44 class org_custusx_dicom_EXPORT DicomImageReader
45 {
46 public:
47  struct WindowLevel
48  {
49  double center;
50  double width;
51  };
52 
53 public:
54  static DicomImageReaderPtr createFromFile(QString filename);
55  Transform3D getImageTransformPatient() const;
56  vtkImageDataPtr createVtkImageData();
57  ctkDICOMItemPtr item() const;
58  WindowLevel getWindowLevel() const;
59  int getNumberOfFrames() const;
60  QString getPatientName() const;
61  bool isLocalizerImage() const;
62 
63 private:
64  DcmFileFormat mFileFormat;
65  DcmDataset *mDataset;
66  QString mFilename;
67 
69  bool loadFile(QString filename);
70  Eigen::Array3d getSpacing() const;
71  Eigen::Array3i getDim(const DicomImage& dicomImage) const;
72  void error(QString message) const;
73  double getDouble(const DcmTagKey& tag, const unsigned long pos=0, const OFBool searchIntoSub = OFFalse) const;
74 // double getDouble(DcmObject *dcmObject, const DcmTagKey &tag, const unsigned long pos, const bool searchIntoSub) const;
75  QString formatPatientName(QString rawName) const;
76 
77  ctkDICOMItemPtr wrapInCTK(DcmItem* item) const;
78  double getSliceSpacing() const;
79  QVector<double> getZPositions() const;
80  bool isMultiFrameImage() const;
81 };
82 
83 
84 } // namespace cx
85 
86 
87 #endif // CXDICOMIMAGEREADER_H
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class ctkDICOMItem > ctkDICOMItemPtr
boost::shared_ptr< class DicomImageReader > DicomImageReaderPtr
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
Namespace for all CustusX production code.