UsTK : Ultrasound ToolKit  version 2.0.1 under development (2024-05-16)
usImageHeaderXmlParser.h
1 /****************************************************************************
2  *
3  * This file is part of the ustk software.
4  * Copyright (C) 2016 - 2017 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ustk with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * This software was developed at:
17  * Inria Rennes - Bretagne Atlantique
18  * Campus Universitaire de Beaulieu
19  * 35042 Rennes Cedex
20  * France
21  *
22  * If you have questions regarding the use of this file, please contact
23  * Inria at ustk@inria.fr
24  *
25  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27  *
28  * Authors:
29  * Marc Pouliquen
30  *
31  *****************************************************************************/
32 
38 #ifndef __usImageHeaderXmlParser_h_
39 #define __usImageHeaderXmlParser_h_
40 
41 #include <visp3/ustk_core/usConfig.h>
42 
43 #if defined(VISP_HAVE_XML2) && (defined(USTK_HAVE_QT5) || defined(USTK_HAVE_VTK_QT))
44 
45 #include <iostream>
46 #include <string>
47 #include <visp3/core/vpDebug.h>
48 #include <visp3/core/vpIoTools.h>
49 #include <visp3/core/vpXmlParser.h>
50 #include <visp3/io/vpParseArgv.h>
51 #include <visp3/ustk_core/us.h>
52 
58 class VISP_EXPORT usImageHeaderXmlParser : public vpXmlParser
59 {
60 public:
62  virtual ~usImageHeaderXmlParser();
63 
64  typedef enum {
65  CODE_XML_BAD = -1,
87  } vpXmlCodeType;
88 
89  typedef enum { SEQUENCE_OK, SEQUENCE_ERROR } vpXmlCodeSequenceType;
90 
91  // getters
92  us::usImageHeader const getImageHeader() { return m_imageHeader; }
93  std::string getSequenceFileName() const { return m_sequence_name; }
94 
95  // Data setters
96  void setImageHeader(const us::usImageHeader imageHeader) { m_imageHeader = imageHeader; }
97  void setSequenceFileName(const std::string sequence_name) { m_sequence_name = sequence_name; }
98 
99 private:
100  uint32_t xmlReadUInt32Child(xmlDocPtr doc, xmlNodePtr node);
101  uint64_t xmlReadUInt64Child(xmlDocPtr doc, xmlNodePtr node);
102  void xmlWriteUInt32Child(xmlNodePtr node, const char *label, const uint32_t value);
103  void xmlWriteUInt64Child(xmlNodePtr node, const char *label, const uint64_t value);
104 
105  us::usImageHeader m_imageHeader;
106  std::string m_sequence_name;
107 
108 protected:
109  void readMainClass(xmlDocPtr doc, xmlNodePtr node);
110  void writeMainClass(xmlNodePtr node);
111 };
112 #endif // __usImageHeaderXmlParser_h_
113 #endif // VISP_HAVE_XML2 || QT
Input/output operations between ultrasound image header and the assiciated xml files....
std::string getSequenceFileName() const
void setSequenceFileName(const std::string sequence_name)
us::usImageHeader const getImageHeader()
void setImageHeader(const us::usImageHeader imageHeader)