[ismrmrd] 251/281: Removed custem classes for strings and vectors

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:01:20 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to annotated tag ismrmrd0.5
in repository ismrmrd.

commit 79a0ff630485179fc6e45e2002ccc9193e23196a
Author: Michael S. Hansen <michael.hansen at nih.gov>
Date:   Tue Aug 12 16:29:13 2014 -0400

    Removed custem classes for strings and vectors
---
 xml/dump_ismrmrd_header.cpp |  29 +++--
 xml/ismrmrd_xml.cpp         | 177 +++++++++++++++++---------
 xml/ismrmrd_xml.h           | 302 +++++++++++---------------------------------
 3 files changed, 203 insertions(+), 305 deletions(-)

diff --git a/xml/dump_ismrmrd_header.cpp b/xml/dump_ismrmrd_header.cpp
index 010906d..a22dc50 100644
--- a/xml/dump_ismrmrd_header.cpp
+++ b/xml/dump_ismrmrd_header.cpp
@@ -18,18 +18,21 @@ int main(int argc, char** argv)
   ISMRMRD::IsmrmrdDataset d(filename.c_str(),"/dataset");
   
   boost::shared_ptr<std::string> xml = d.readHeader();
-  std::cout << "XML: \n" << *xml << std::endl;
-
-  ISMRMRD::IsmrmrdHeaderProxy hp(xml->c_str());
-
-  std::cout << "Resonance frequency: " << hp.h().experimentalConditions.get().H1resonanceFrequency_Hz << std::endl;
-  std::cout << "TR: " << hp.h().sequenceParameters.get().TR[0] << std::endl;
-  //for (size_t i = 0; i < hp.h().userParameters.get().userParameterLong.size(); i++) {
-    //std::cout << "UserLong: " << hp.h().userParameters.get().userParameterLong[i].name.size() << std::endl;
-    /*
-    std::cout << "UserLong: " << hp.h().userParameters.get().userParameterLong[i].name.c_str() << ", " 
-	      << hp.h().userParameters.get().userParameterLong[i].value << std::endl;
-    */
-  //}
+  //std::cout << "XML: \n" << *xml << std::endl;
+
+  ISMRMRD::IsmrmrdHeader h;
+  deserialize(xml->c_str(),h);
+
+  std::cout << "Resonance frequency: " << h.experimentalConditions.get().H1resonanceFrequency_Hz << std::endl;
+  std::cout << "TR: " << h.sequenceParameters.get().TR[0] << std::endl;
+  if (h.userParameters) {
+    std::cout << "User parameters found" << std::endl;
+    for (size_t i = 0; i < h.userParameters->userParameterLong.size(); i++) {
+      std::cout << "UserLong: " << h.userParameters->userParameterLong[i].name.c_str() << ", " 
+		<< h.userParameters->userParameterLong[i].value << std::endl;
+    }
+  }
+
+  serialize(h,std::cout);
   return 0;
 }
diff --git a/xml/ismrmrd_xml.cpp b/xml/ismrmrd_xml.cpp
index 29586af..1aea1e1 100644
--- a/xml/ismrmrd_xml.cpp
+++ b/xml/ismrmrd_xml.cpp
@@ -4,32 +4,6 @@
 
 namespace ISMRMRD
 {
-  IsmrmrdHeaderProxy::IsmrmrdHeaderProxy(const char* xml)
-  {
-    deserialize(xml);
-  }
-
-  IsmrmrdHeaderProxy::IsmrmrdHeaderProxy(const std::string& xml)
-  {
-    deserialize(xml.c_str());
-  }
-
-  IsmrmrdHeaderProxy::IsmrmrdHeaderProxy()
-  {
-
-  }
-  
-  IsmrmrdHeaderProxy::IsmrmrdHeaderProxy(const IsmrmrdHeader& h)
-  {
-    h_ = h;
-  }
-  
-  IsmrmrdHeaderProxy& IsmrmrdHeaderProxy::operator=(const IsmrmrdHeader& h)
-  {
-    h_ = h;
-    return *this;
-  }
-  
   //Utility Functions for deserializing Header
   EncodingSpace parse_encoding_space(pugi::xml_node& n, const char* child) 
   {
@@ -73,17 +47,17 @@ namespace ISMRMRD
     return o;
   }
 
-  String parse_string(pugi::xml_node& n, const char* child) 
+  std::string parse_string(pugi::xml_node& n, const char* child) 
   {
-    String r(n.child_value(child));
+    std::string r(n.child_value(child));
     if (r.size() == 0) throw std::runtime_error("Null length string");
     return r;
   }
 
-  Optional<String> parse_optional_string(pugi::xml_node& n, const char* child)
+  Optional<std::string> parse_optional_string(pugi::xml_node& n, const char* child)
   {
-    String s(n.child_value(child));
-    Optional<String> r;
+    std::string s(n.child_value(child));
+    Optional<std::string> r;
     if (s.size()) r = s;
     return r;
   }
@@ -116,9 +90,9 @@ namespace ISMRMRD
     return r;
   }
 
-  Vector<float> parse_vector_float(pugi::xml_node& n, const char* child) 
+  std::vector<float> parse_vector_float(pugi::xml_node& n, const char* child) 
   {
-    Vector<float> r;
+    std::vector<float> r;
     
     pugi::xml_node nc = n.child(child);
 
@@ -131,21 +105,21 @@ namespace ISMRMRD
     return r;
   }
 
-  Vector<String> parse_vector_string(pugi::xml_node& n, const char* child)
+  std::vector<std::string> parse_vector_string(pugi::xml_node& n, const char* child)
   {
-    Vector<String> r;
+    std::vector<std::string> r;
     pugi::xml_node nc = n.child(child);
     while (nc) {
-      String s = nc.child_value();
+      std::string s = nc.child_value();
       r.push_back(s);
       nc = nc.next_sibling(child);
     }
     return r;
   }
 
-  Vector<UserParameterLong> parse_user_parameter_long(pugi::xml_node& n, const char* child) 
+  std::vector<UserParameterLong> parse_user_parameter_long(pugi::xml_node& n, const char* child) 
   {
-    Vector<UserParameterLong> r;
+    std::vector<UserParameterLong> r;
     pugi::xml_node nc = n.child(child);
     while (nc) {
       UserParameterLong v;
@@ -156,7 +130,7 @@ namespace ISMRMRD
 	throw std::runtime_error("Malformed user parameter (long)");
       }
 
-      v.name = String(name.child_value());
+      v.name = std::string(name.child_value());
       v.value = std::atoi(value.child_value());
 
       r.push_back(v);
@@ -166,9 +140,9 @@ namespace ISMRMRD
     return r;
   }
 
-  Vector<UserParameterDouble> parse_user_parameter_double(pugi::xml_node& n, const char* child) 
+  std::vector<UserParameterDouble> parse_user_parameter_double(pugi::xml_node& n, const char* child) 
   {
-    Vector<UserParameterDouble> r;
+    std::vector<UserParameterDouble> r;
     pugi::xml_node nc = n.child(child);
     while (nc) {
       UserParameterDouble v;
@@ -181,8 +155,8 @@ namespace ISMRMRD
 
       char buffer[10000];
       memcpy(buffer,name.child_value(),strlen(name.child_value())+1);
-      String tmp("BLAH");
-      v.name = "BLAKKK";//tmp;//String("BLAH");//name.child_value());
+      std::string tmp("BLAH");
+      v.name = "BLAKKK";//xtmp;//std::string("BLAH");//name.child_value());
       v.value = std::atof(value.child_value());
 
       r.push_back(v);
@@ -193,9 +167,9 @@ namespace ISMRMRD
     return r;
   }
 
-  Vector<UserParameterString> parse_user_parameter_string(pugi::xml_node& n, const char* child) 
+  std::vector<UserParameterString> parse_user_parameter_string(pugi::xml_node& n, const char* child) 
   {
-    Vector<UserParameterString> r;
+    std::vector<UserParameterString> r;
     pugi::xml_node nc = n.child(child);
     while (nc) {
       UserParameterString v;
@@ -206,8 +180,8 @@ namespace ISMRMRD
 	throw std::runtime_error("Malformed user parameter (string)");
       }
 
-      v.name = String(name.child_value());
-      v.value = String(value.child_value());
+      v.name = std::string(name.child_value());
+      v.value = std::string(value.child_value());
 
       r.push_back(v);
 
@@ -219,7 +193,7 @@ namespace ISMRMRD
 
   //End of utility functions for deserializing header
 
-  void IsmrmrdHeaderProxy::deserialize(const char* xml) 
+  void deserialize(const char* xml, IsmrmrdHeader& h) 
   {
     pugi::xml_document doc;
     pugi::xml_parse_result result = doc.load(xml);
@@ -244,7 +218,7 @@ namespace ISMRMRD
       } else {
 	ExperimentalConditions e;
 	e.H1resonanceFrequency_Hz = std::atoi(experimentalConditions.child_value("H1resonanceFrequency_Hz"));
-	h_.experimentalConditions = e;
+	h.experimentalConditions = e;
       }
 
       
@@ -284,7 +258,7 @@ namespace ISMRMRD
 	  if (!trajectory) {
 	    throw std::runtime_error("trajectory not found in encoding section");
 	  } else {
-	    e.trajectory = String(encoding.child_value("trajectory"));
+	    e.trajectory = std::string(encoding.child_value("trajectory"));
 	  }
 
 	  pugi::xml_node trajectoryDescription = encoding.child("trajectoryDescription");
@@ -306,7 +280,7 @@ namespace ISMRMRD
 	    
 	  }
 
-	  h_.encoding.push_back(e);
+	  h.encoding.push_back(e);
 	  encoding = encoding.next_sibling("encoding");
 	}
 
@@ -319,7 +293,7 @@ namespace ISMRMRD
 	info.patientID = parse_optional_string(subjectInformation, "patientID");
 	info.patientBirthdate = parse_optional_string(subjectInformation, "patientBirthdate");
 	info.patientGender = parse_optional_string(subjectInformation, "patientGender");
-	h_.subjectInformation = info;
+	h.subjectInformation = info;
       }
 
       if (studyInformation) {
@@ -330,7 +304,7 @@ namespace ISMRMRD
 	info.accessionNumber = parse_optional_long(studyInformation,"accessionNumber");
 	info.referringPhysicianName = parse_optional_string(studyInformation,"referringPhysicianName");
 	info.studyDescription = parse_optional_string(studyInformation,"studyDescription");
-	h_.studyInformation = info;
+	h.studyInformation = info;
       }
 
       if (measurementInformation) {
@@ -356,7 +330,7 @@ namespace ISMRMRD
 	  } 
 	  measurementDependency = measurementDependency.next_sibling("measurementDependency");
 	}
-	h_.measurementInformation = info;
+	h.measurementInformation = info;
       }
 
       if (acquisitionSystemInformation) {
@@ -369,7 +343,7 @@ namespace ISMRMRD
 	info.institutionName = parse_optional_string(acquisitionSystemInformation, "institutionName");
 	info.stationName = parse_optional_string(acquisitionSystemInformation, "stationName");
 
-	h_.acquisitionSystemInformation = info;
+	h.acquisitionSystemInformation = info;
       }
 
       if (parallelImaging) {
@@ -385,7 +359,7 @@ namespace ISMRMRD
 
 	info.calibrationMode = parse_optional_string(parallelImaging,"calibrationMode");
 	info.interleavingDimension = parse_optional_string(parallelImaging,"interleavingDimension");
-	h_.parallelImaging = info;
+	h.parallelImaging = info;
       }
 
       if (sequenceParameters) {
@@ -393,7 +367,7 @@ namespace ISMRMRD
 	p.TR = parse_vector_float(sequenceParameters,"TR");
 	p.TE = parse_vector_float(sequenceParameters,"TE");
 	p.TI = parse_vector_float(sequenceParameters,"TI");
-	h_.sequenceParameters = p;
+	h.sequenceParameters = p;
       }
 
       if (dicomParameters) { 
@@ -428,19 +402,17 @@ namespace ISMRMRD
 	  m.freqEncodingDirection = parse_optional_string(mrimageModule, "freqEncodingDirection");
 	  p.mrImageModule = m;
 	}
-	h_.dicomParameters = p;
+	h.dicomParameters = p;
       }
 
-
       if (userParameters) {
 	UserParameters p;
- 	//p.userParameterLong = parse_user_parameter_long(userParameters,"userParameterLong");
+ 	p.userParameterLong = parse_user_parameter_long(userParameters,"userParameterLong");
  	p.userParameterDouble = parse_user_parameter_double(userParameters,"userParameterDouble");
  	p.userParameterString = parse_user_parameter_string(userParameters,"userParameterString");
  	p.userParameterBase64 = parse_user_parameter_string(userParameters,"userParameterBase64");
-	h_.userParameters = p;
+	h.userParameters = p;
       }
-
     } else {
       throw std::runtime_error("Root node 'ismrmrdHeader' not found");
     }
@@ -448,9 +420,88 @@ namespace ISMRMRD
   }
 
 
-  void serialize(std::ostream& o)
+  //Utility functions for serialization
+  void to_string_val(const std::string& v, std::string& o)
+  {
+    o = v;
+  }
+
+  void to_string_val(const float& v, std::string& o)
+  {
+    char buffer[256];
+    sprintf(buffer,"%f",v);
+    o = std::string(buffer);
+  }
+
+  void to_string_val(const unsigned short& v, std::string& o)
+  {
+    char buffer[256];
+    sprintf(buffer,"%d",v);
+    o = std::string(buffer);
+  }
+
+  template <class T> void append_optional_node(pugi::xml_node& n, const char* child, const Optional<T>& v) {
+    if (v) {
+      pugi::xml_node n2 = n.append_child(child);
+      std::string v_as_string;
+      to_string_val(*v, v_as_string);
+      n2.append_child(pugi::node_pcdata).set_value(v_as_string.c_str());
+    }
+  } 
+  
+  template <class T> void append_node(pugi::xml_node& n, const char* child, const T& v) {
+    pugi::xml_node n2 = n.append_child(child);
+    std::string v_as_string;
+    to_string_val(*v, v_as_string);
+    n2.append_child(pugi::node_pcdata).set_value(v_as_string.c_str());
+  } 
+
+  //End utility functions for serialization
+
+  void serialize(const IsmrmrdHeader& h, std::ostream& o)
   {
+    pugi::xml_document doc;
+    pugi::xml_node root = doc.append_child();
+    pugi::xml_node n1;
+    pugi::xml_attribute a;
+
+    root.set_name("ismrmrdHeader");
+
+    a = root.append_attribute("xmlns");
+    a.set_value("http://www.ismrm.org/ISMRMRD");
+
+    a = root.append_attribute("xmlns:xsi");
+    a.set_value("http://www.w3.org/2001/XMLSchema-instance");
+  
+    a = root.append_attribute("xmlns:xs");
+    a.set_value("http://www.w3.org/2001/XMLSchema");
+    
+    a = root.append_attribute("xsi:schemaLocation");
+    a.set_value("http://www.ismrm.org/ISMRMRD ismrmrd.xsd");
+
+    if (h.subjectInformation) {
+      n1 = root.append_child();
+      n1.set_name("subjectInformation");
+      append_optional_node(n1,"patientName",h.subjectInformation->patientName);
+      append_optional_node(n1,"patientWeight_kg",h.subjectInformation->patientWeight_kg);
+      append_optional_node(n1,"patientID",h.subjectInformation->patientID);
+      append_optional_node(n1,"patientBirthdate",h.subjectInformation->patientBirthdate);
+      append_optional_node(n1,"patientGender",h.subjectInformation->patientGender);
+    }
+
+    if (h.acquisitionSystemInformation) {
+      n1 = root.append_child();
+      n1.set_name("acquisitionSystemInformation");
+      append_optional_node(n1,"systemVendor",h.acquisitionSystemInformation->systemVendor);
+      append_optional_node(n1,"systemModel",h.acquisitionSystemInformation->systemModel);
+      append_optional_node(n1,"systemFieldStrength_T",h.acquisitionSystemInformation->systemFieldStrength_T);
+      append_optional_node(n1,"relativeReceiverNoiseBandwidth",h.acquisitionSystemInformation->relativeReceiverNoiseBandwidth);
+      append_optional_node(n1,"receiverChannels",h.acquisitionSystemInformation->receiverChannels);
+      append_optional_node(n1,"institutionName",h.acquisitionSystemInformation->institutionName);
+      append_optional_node(n1,"stationName",h.acquisitionSystemInformation->stationName);
+    }
 
+    doc.save(o);
   }
 
 
diff --git a/xml/ismrmrd_xml.h b/xml/ismrmrd_xml.h
index 9584aa4..2459022 100644
--- a/xml/ismrmrd_xml.h
+++ b/xml/ismrmrd_xml.h
@@ -7,7 +7,8 @@
 #include <stdio.h>
 #include <string.h>
 #include <iostream>
-
+#include <string>
+#include <vector>
 
 /*
   TODO LIST
@@ -21,181 +22,6 @@
 namespace ISMRMRD
 {
 
-  template <typename T> class Vector
-  {
-
-  public:
-
-    Vector()
-      : v_(0)
-      , len_(0)
-      , siz_(0)
-      {} 
-
-    Vector(const T* v, size_t len)
-      : v_(0)
-      , len_(0)
-      , siz_(0)
-    {
-      allocate(len);
-      copy(v,len);
-      siz_ = len;
-    }
-
-    Vector(size_t len)
-      : v_(0)
-      , len_(0)
-      , siz_(0)
-    {
-      allocate(len);
-      siz_ = len;
-    }
-
-    Vector(size_t len, const T& val) 
-      : Vector()
-    { 
-      allocate(len);
-      siz_ = len;
-      for (size_t i = 0; i < siz_; i++) v_[i] = val;
-    }
-
-    //Copy constructor
-    Vector(const Vector& v) {
-      allocate(v.len_);
-      len_ = v.len_;
-      siz_ = v.siz_;
-      copy(v.v_,len_);      
-    }
-
-    ///Asignment operator
-    Vector& operator=(const Vector& v) {
-      allocate(v.len_);
-      len_ = v.len_;
-      siz_ = v.siz_;
-      copy(v.v_,len_);
-    }
-
-
-    virtual ~Vector() {
-      if (v_) delete [] v_;
-    }
-
-    void push_back(const T& item) {
-      if ((siz_+1) > len_) {
-	allocate(len_ + 5); //We will grow by 5 items at a time
-      }
-      v_[siz_++] = item; //Copy item to array
-    }
-
-    T& operator[](size_t index) {
-      return v_[index];
-    }
-
-    size_t size() {
-      return siz_;
-    }
-
-  protected:
-    T* v_;
-    size_t len_; ///Allocated length
-    size_t siz_; ///Size of vector
-
-    void allocate(size_t len) {
-      T* tmp_v = v_;
-      if (len != len_) {
-	if (len) {
-	  //Allocate new array
-	  try {
-	    v_ = new T[len];
-	  } catch (std::bad_alloc&) {
-	    std::cout << "Error allocating memory in ISMRMRD::Vector" << std::endl;
-	    throw;
-	  }
-	} else {
-	  v_ = 0;
-	}
-
-	//Copy old content if applicable
-	if (tmp_v) {
-	  memcpy(v_, tmp_v, (len < len_ ? len : len_)*sizeof(T));
-	  delete [] tmp_v;
-	}
-
-	len_ = len;
-      }
-    }
-
-    void copy(const T* v, size_t len) {
-      if (len > len_) {
-	throw std::length_error("Invalid length array specified for copy in IsmrmrdXmlString");
-      }
-      memcpy(v_,v,len*sizeof(T));
-    } 
-
-  };
-
-  /**
-
-     Simple string container class. The class is used for returning string values to avoid using std::string 
-     which can cause problems when exported from a DLL on Windows. 
-
-   */
-  class String : public Vector<char>
-  {
-
-  public:
-    ///Default constructor
-    String() 
-      : Vector()
-    {
-    }
-    
-
-    ///Construct taking null terminated string
-    String(const char* s)
-      : Vector(s,strlen(s)+1)
-    {
-      std::cout << "Constructing string: " << s << std::endl;
-    }
-    
-    ///Construct taking length of string as input
-    String(const char* s, size_t length) 
-      : Vector(length+1)
-    {
-      copy(s,length);
-      v_[length-1] = '\0';
-    }
-
-    ///Get a const pointer to the string
-    const char* c_str() {
-      return &v_[0];
-    }
-
-    ///Set the string
-    void  set(const char* s) {
-      size_t l = strlen(s);
-      allocate(l+1);
-      copy(s,l);
-      v_[len_-1] = '\0';
-      siz_ = len_;
-    }
-      
-    ///Set the string with specified length
-    void  set(const char* s, size_t len)
-    {
-      allocate(len+1);
-      copy(s,len);
-      v_[len_-1] = '\0';
-      siz_ = len_;
-    }
-
-    ///Get the length of the string
-    size_t size() {
-      return siz_-1;
-    }
-  };
-
-
   template <typename T> class Optional
   {
   public:
@@ -215,7 +41,19 @@ namespace ISMRMRD
       value_ = v;
     }
 
-    bool is_present() {
+    const T* operator->() const {
+      return &value_;
+    }
+
+    const T& operator*() const {
+      return value_;
+    }
+
+    operator bool() const {
+      return present_;
+    }
+
+    bool is_present() const {
       return present_;
     }
 
@@ -243,51 +81,51 @@ namespace ISMRMRD
 
   struct EXPORTISMRMRDXML SubjectInformation 
   {
-    Optional<String> patientName;
+    Optional<std::string> patientName;
     Optional<float> patientWeight_kg;
-    Optional<String> patientID;
-    Optional<String> patientBirthdate;
-    Optional<String> patientGender;
+    Optional<std::string> patientID;
+    Optional<std::string> patientBirthdate;
+    Optional<std::string> patientGender;
   };
 
   struct StudyInformation
   {
-    Optional<String> studyDate;
-    Optional<String> studyTime;
-    Optional<String> studyID;
+    Optional<std::string> studyDate;
+    Optional<std::string> studyTime;
+    Optional<std::string> studyID;
     Optional<long> accessionNumber;
-    Optional<String> referringPhysicianName;
-    Optional<String> studyDescription;
+    Optional<std::string> referringPhysicianName;
+    Optional<std::string> studyDescription;
   };
 
   struct MeasurementDependency
   {
-    String dependencyType;
-    String dependencyID;
+    std::string dependencyType;
+    std::string dependencyID;
   };
 
   struct MeasurementInformation
   {
-    Optional<String> measurementID;
-    Optional<String> seriesDate;
-    Optional<String> seriesTime;
-    String patientPosition;
+    Optional<std::string> measurementID;
+    Optional<std::string> seriesDate;
+    Optional<std::string> seriesTime;
+    std::string patientPosition;
     Optional<long int> initialSeriesNumber;
-    Optional<String> protocolName;
-    Optional<String> seriesDescription;
-    Vector<MeasurementDependency> measurementDepencency;
+    Optional<std::string> protocolName;
+    Optional<std::string> seriesDescription;
+    std::vector<MeasurementDependency> measurementDepencency;
   };
 
   
   struct AcquisitionSystemInformation
   {
-    Optional<String> systemVendor;
-    Optional<String> systemModel;
+    Optional<std::string> systemVendor;
+    Optional<std::string> systemModel;
     Optional<float> systemFieldStrength_T;
     Optional<float> relativeReceiverNoiseBandwidth;
     Optional<unsigned short> receiverChannels;
-    Optional<String> institutionName;
-    Optional<String> stationName;
+    Optional<std::string> institutionName;
+    Optional<std::string> stationName;
   };
 
 
@@ -356,36 +194,37 @@ namespace ISMRMRD
 
   struct UserParameterLong
   {
-    String name;
+    std::string name;
     long value;
   };
 
   struct UserParameterDouble
   {
-    String name;
+    std::string name;
     double value;
   };
   
   struct UserParameterString
+
   {
-    String name;
-    String value;
+    std::string name;
+    std::string value;
   };
 
   struct UserParameters
   {
-    Vector<UserParameterLong> userParameterLong;
-    Vector<UserParameterDouble> userParameterDouble;
-    Vector<UserParameterString> userParameterString;
-    Vector<UserParameterString> userParameterBase64;
+    std::vector<UserParameterLong> userParameterLong;
+    std::vector<UserParameterDouble> userParameterDouble;
+    std::vector<UserParameterString> userParameterString;
+    std::vector<UserParameterString> userParameterBase64;
   };
 
   struct TrajectoryDescription
   {
-    String identifier;
-    Vector<UserParameterLong> userParameterLong;
-    Vector<UserParameterDouble> userParameterDouble;
-    Optional<String> comment; 
+    std::string identifier;
+    std::vector<UserParameterLong> userParameterLong;
+    std::vector<UserParameterDouble> userParameterDouble;
+    Optional<std::string> comment; 
   };
 
   struct Encoding
@@ -393,42 +232,42 @@ namespace ISMRMRD
     EncodingSpace encodedSpace;
     EncodingSpace reconSpace;
     EncodingLimits encodingLimits;
-    String trajectory;
+    std::string trajectory;
     Optional<TrajectoryDescription> trajectoryDescription;
   };
 
   struct SequenceParameters
   {
-    Vector<float> TR;
-    Vector<float> TE;
-    Vector<float> TI;
+    std::vector<float> TR;
+    std::vector<float> TE;
+    std::vector<float> TI;
   };
 
   struct ReferencedImageSequence
   {
-    String referencedSOPInstanceUID;
+    std::string referencedSOPInstanceUID;
   };
   
 
   struct MRImageModule
   {
-    Optional<String> imageType;
-    Optional<String> scanningSequence;
-    Optional<String> sequenceVartiant;
-    Optional<String> scanOptions;
-    Optional<String> mrAcquisitionType;
+    Optional<std::string> imageType;
+    Optional<std::string> scanningSequence;
+    Optional<std::string> sequenceVartiant;
+    Optional<std::string> scanOptions;
+    Optional<std::string> mrAcquisitionType;
     Optional<long> echoTrainLength;
     Optional<float> triggerTime;
     Optional<float> flipAngle_deg;
-    Optional<String> freqEncodingDirection;
+    Optional<std::string> freqEncodingDirection;
   };
 
   struct DicomParameters
   {
-    String studyInstanceUID;
-    Optional<String> seriesInstanceUIDRoot;
-    Optional<String> frameOfReference;
-    Vector<ReferencedImageSequence> referencedImageSequence;
+    std::string studyInstanceUID;
+    Optional<std::string> seriesInstanceUIDRoot;
+    Optional<std::string> frameOfReference;
+    std::vector<ReferencedImageSequence> referencedImageSequence;
     Optional<MRImageModule> mrImageModule;
   };
 
@@ -442,8 +281,8 @@ namespace ISMRMRD
   struct ParallelImaging
   {
     AccelerationFactor accelerationFactor;
-    Optional<String> calibrationMode;
-    Optional<String> interleavingDimension;
+    Optional<std::string> calibrationMode;
+    Optional<std::string> interleavingDimension;
   };
 
 
@@ -454,7 +293,7 @@ namespace ISMRMRD
     Optional<MeasurementInformation> measurementInformation;
     Optional<AcquisitionSystemInformation> acquisitionSystemInformation;
     Optional<ExperimentalConditions> experimentalConditions;
-    Vector<Encoding> encoding;
+    std::vector<Encoding> encoding;
     Optional<ParallelImaging> parallelImaging;
     Optional<SequenceParameters> sequenceParameters;
     Optional<DicomParameters> dicomParameters;
@@ -463,6 +302,10 @@ namespace ISMRMRD
 
 
 
+  void deserialize(const char* xml, IsmrmrdHeader& h);
+  void serialize(const IsmrmrdHeader& h, std::ostream& o);
+
+  /*
   class IsmrmrdHeaderProxy 
   {
 
@@ -490,6 +333,7 @@ namespace ISMRMRD
   protected:
     IsmrmrdHeader h_;
   };
+  */
 
 
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ismrmrd.git



More information about the debian-science-commits mailing list