[ismrmrd] 134/177: Added version number to the schema and to the xml header.

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


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

ghisvail-guest pushed a commit to annotated tag v1.1.0.beta.1
in repository ismrmrd.

commit d2e41136e99787f2bcd2a7e8348ec5fb486e5631
Author: Souheil Inati <souheil.inati at nih.gov>
Date:   Tue Oct 7 22:45:45 2014 -0400

    Added version number to the schema and to the xml header.
---
 CMakeLists.txt                               |  6 +++---
 include/ismrmrd/xml.h                        |  1 +
 libsrc/xml.cpp                               | 11 ++++++++++-
 schema/ismrmrd.xsd                           |  3 ++-
 utilities/generate_cartesian_shepp_logan.cpp |  1 +
 utilities/recon_cartesian_2d.cpp             |  7 +++++++
 6 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c0445be..0f9b89a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,10 +50,10 @@ endif (WIN32)
 #the flexible header. The micro number changes when there are small changes
 #in the utility libraries, that don't affect the data format itself.
 set(ISMRMRD_VERSION_MAJOR 1)
-set(ISMRMRD_VERSION_MINOR 0)
-set(ISMRMRD_VERSION_PATCH 1) 
+set(ISMRMRD_VERSION_MINOR 1)
+set(ISMRMRD_VERSION_PATCH 0) 
 
-set(ISMRMRD_XML_SCHEMA_SHA1 "6f1ed6b9209075de481c02e66a37913d9a46b772")
+set(ISMRMRD_XML_SCHEMA_SHA1 "5aa55db3d67187febb1b8bb8da54e67fc745ebd0")
 
 #Remove line breaks and white space that does not change the meaning of the schema
 file(STRINGS ${CMAKE_SOURCE_DIR}/schema/ismrmrd.xsd SCHEMA_STRINGS) #Read all strings from file 
diff --git a/include/ismrmrd/xml.h b/include/ismrmrd/xml.h
index 83de7d5..8f8c18f 100644
--- a/include/ismrmrd/xml.h
+++ b/include/ismrmrd/xml.h
@@ -304,6 +304,7 @@ namespace ISMRMRD
 
   struct IsmrmrdHeader
   {
+    Optional<long> version;
     Optional<SubjectInformation> subjectInformation;
     Optional<StudyInformation> studyInformation;
     Optional<MeasurementInformation> measurementInformation;
diff --git a/libsrc/xml.cpp b/libsrc/xml.cpp
index 9bc592b..ac48d0a 100644
--- a/libsrc/xml.cpp
+++ b/libsrc/xml.cpp
@@ -212,6 +212,9 @@ namespace ISMRMRD
       pugi::xml_node encoding = root.child("encoding");
       pugi::xml_node sequenceParameters = root.child("sequenceParameters");
       pugi::xml_node userParameters = root.child("userParameters");
+
+      // Parsing version
+      h.version = parse_optional_long(root, "version");
       
       //Parsing experimentalConditions
       if (!experimentalConditions) {
@@ -221,7 +224,6 @@ namespace ISMRMRD
 	e.H1resonanceFrequency_Hz = std::atoi(experimentalConditions.child_value("H1resonanceFrequency_Hz"));
 	h.experimentalConditions = e;
       }
-
       
       //Parsing encoding section
       if (!encoding) {
@@ -517,6 +519,13 @@ namespace ISMRMRD
     a = root.append_attribute("xsi:schemaLocation");
     a.set_value("http://www.ismrm.org/ISMRMRD ismrmrd.xsd");
 
+    a = root.append_attribute("version");
+    a.set_value("1");  // TODO how should this come from a definition in the header?
+
+    if (h.version) {
+      append_optional_node(root,"version",h.version);
+    }
+    
     if (h.subjectInformation) {
       n1 = root.append_child();
       n1.set_name("subjectInformation");
diff --git a/schema/ismrmrd.xsd b/schema/ismrmrd.xsd
index fd1c946..08eb359 100644
--- a/schema/ismrmrd.xsd
+++ b/schema/ismrmrd.xsd
@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<xs:schema xmlns="http://www.ismrm.org/ISMRMRD" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.ismrm.org/ISMRMRD">
+<xs:schema xmlns="http://www.ismrm.org/ISMRMRD" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.ismrm.org/ISMRMRD" version="1">
 
     <xs:element name="ismrmrdHeader" type="ismrmrdHeader"/>
 
     <xs:complexType name="ismrmrdHeader">
       <xs:sequence>
+        <xs:element maxOccurs="1" minOccurs="0" name="version" type="xs:long"/>
         <xs:element maxOccurs="1" minOccurs="0" name="subjectInformation" type="subjectInformationType"/>
         <xs:element maxOccurs="1" minOccurs="0" name="studyInformation" type="studyInformationType"/>
         <xs:element maxOccurs="1" minOccurs="0" name="measurementInformation" type="measurementInformationType"/>
diff --git a/utilities/generate_cartesian_shepp_logan.cpp b/utilities/generate_cartesian_shepp_logan.cpp
index 42e19d8..ad4f5d3 100644
--- a/utilities/generate_cartesian_shepp_logan.cpp
+++ b/utilities/generate_cartesian_shepp_logan.cpp
@@ -151,6 +151,7 @@ int main(int argc, char** argv)
 
 	//Let's create a header, we will use the C++ classes in ismrmrd/xml.h
 	IsmrmrdHeader h;
+        h.version = 1;
 	h.experimentalConditions.H1resonanceFrequency_Hz = 63500000; //~1.5T        
 
 	AcquisitionSystemInformation sys;
diff --git a/utilities/recon_cartesian_2d.cpp b/utilities/recon_cartesian_2d.cpp
index 9dd7d79..c6a627d 100644
--- a/utilities/recon_cartesian_2d.cpp
+++ b/utilities/recon_cartesian_2d.cpp
@@ -54,6 +54,13 @@ int main(int argc, char** argv)
     ISMRMRD::deserialize(xml.c_str(),hdr);
 
     //Let's print some information from the header
+    if (hdr.version) {
+        std::cout << "XML Header version: " << hdr.version << std::endl;
+    }
+    else {
+        std::cout << "XML Header unspecified version." << std::endl;
+    }
+    
     if (hdr.encoding.size() != 1) {
         std::cout << "Number of encoding spaces: " << hdr.encoding.size() << std::endl;
         std::cout << "This simple reconstruction application only supports one encoding space" << std::endl;

-- 
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