Computer Assited Medical Intervention Tool Kit  version 5.0
DicomParser.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2021 Univ. Grenoble Alpes, CNRS, Grenoble INP, TIMC, 38000 Grenoble, France
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 #ifndef DICOMPARSER_H
27 #define DICOMPARSER_H
28 
29 // CamiTK includes
30 #include "DicomSeries.h"
31 
32 // Qt includes
33 #include <QMap>
34 #include <QList>
35 #include <QString>
36 #include <QCoreApplication>
37 
38 // C++ includes
39 #include <cstdlib>
40 #include <vector>
41 
42 
51 class DicomParser {
52 
53  Q_DECLARE_TR_FUNCTIONS(DicomParser)
54 
55 public:
56 
57  DicomParser() = default;
58 
60  virtual ~DicomParser() = default;
61 
67  static QList<DicomSeries*> parseDirectory(const QString& directory);
68 
74  static double getZSpacing(const std::vector<std::string>& seriesFileNames);
75 
76 private:
82  static QList<QString> stdListOfStringToQt(const std::vector< std::string >& inputList);
83 
89  static std::vector< std::string > qtListOfStringToStd(const QList<QString>& inputList);
90 
96  static QDate getAcquisitionDate(const std::vector<std::string>& seriesFileNames);
97 
103  static QTime getAcquisitionTime(const std::vector<std::string>& seriesFileNames);
104 
110  static QString getPatientName(const std::vector<std::string>& seriesFileNames);
111 
117  static QString getSeriesName(const std::vector<std::string>& seriesFileNames);
118 
124  static QString getSeriesDescription(const std::vector<std::string>& seriesFileNames);
125 
131  static QString getStudyName(const std::vector<std::string>& seriesFileNames);
132 
133 };
134 
135 #endif // DICOMPARSER_H
136 
DicomParser::getSeriesName
static QString getSeriesName(const std::vector< std::string > &seriesFileNames)
Retrieve the series name.
Definition: DicomParser.cpp:163
DicomParser
DicomParser allows one to parse a directory of DICOM files looking for studies and series.
Definition: DicomParser.h:51
DicomParser::getAcquisitionDate
static QDate getAcquisitionDate(const std::vector< std::string > &seriesFileNames)
Retrieve the SERIES acquisition date.
Definition: DicomParser.cpp:124
DicomParser::getZSpacing
static double getZSpacing(const std::vector< std::string > &seriesFileNames)
Retrieve the DICOM image file Z spacing attribute (commonly known as spacing between slices)
Definition: DicomParser.cpp:219
DicomParser::getPatientName
static QString getPatientName(const std::vector< std::string > &seriesFileNames)
Retrieve the patient name information from the input files.
Definition: DicomParser.cpp:150
DicomParser::stdListOfStringToQt
static QList< QString > stdListOfStringToQt(const std::vector< std::string > &inputList)
Convert a simple std list of string into a QList of QString.
Definition: DicomParser.cpp:199
DicomSeries::setPatientName
void setPatientName(QString name)
Definition: DicomSeries.cpp:79
DicomParser::getSeriesDescription
static QString getSeriesDescription(const std::vector< std::string > &seriesFileNames)
Retrieve the series description.
Definition: DicomParser.cpp:175
DicomSeries::setStudyName
void setStudyName(QString name)
Definition: DicomSeries.cpp:70
DicomSeries.h
CAMITK_TRACE_ALT
#define CAMITK_TRACE_ALT(MSG)
Definition: Log.h:257
Log.h
DicomSeries::setAcquisitionTime
void setAcquisitionTime(QTime time)
Definition: DicomSeries.cpp:67
DicomSeries::setFileNames
void setFileNames(QList< QString > inputFileNames)
Definition: DicomSeries.cpp:82
DicomParser::qtListOfStringToStd
static std::vector< std::string > qtListOfStringToStd(const QList< QString > &inputList)
Convert a QList of QString into a std list of string.
Definition: DicomParser.cpp:209
DicomSeries::setStdFileNames
void setStdFileNames(std::vector< std::string > inputFileNames)
Definition: DicomSeries.cpp:85
DicomParser::getAcquisitionTime
static QTime getAcquisitionTime(const std::vector< std::string > &seriesFileNames)
Retrieve the SERIES acquisition time.
Definition: DicomParser.cpp:137
DicomParser::DicomParser
DicomParser()=default
DicomParser::getStudyName
static QString getStudyName(const std::vector< std::string > &seriesFileNames)
Retrieve the study name.
Definition: DicomParser.cpp:187
DicomParser.h
DicomParser::parseDirectory
static QList< DicomSeries * > parseDirectory(const QString &directory)
Parse the input directory for DICOM series.
Definition: DicomParser.cpp:36
DicomSeries::setAcquisitionDate
void setAcquisitionDate(QDate date)
Definition: DicomSeries.cpp:64
DicomSeries::setSeriesDescription
void setSeriesDescription(QString name)
Definition: DicomSeries.cpp:76
CAMITK_ERROR_ALT
#define CAMITK_ERROR_ALT(MSG)
Definition: Log.h:277
DicomParser::~DicomParser
virtual ~DicomParser()=default
Default Destructor.
DicomSeries
DicomSeries is a CamiTK high level class to represent a DICOM SERIES This class encapsulates GDCM obj...
Definition: DicomSeries.h:49
DicomSeries::setSeriesName
void setSeriesName(QString name)
Definition: DicomSeries.cpp:73