<?xml version = "1.0" ?>
 
<xsd:schema  
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">

            <!-- documentation of schema file --> 
  <xsd:annotation> 
    <xsd:documentation xml:lang="en"> 
      This is an SNARK05 prjfil schema file.
      See PRJFIL.xml for an instance file of this type,
      it will clear up how such a file should look.
      Version:  $Revision: 1.6 $ 
      Last Updated:  $Date: 2006/03/22 14:14:14 $
    </xsd:documentation> 
  </xsd:annotation> 
 
  <xsd:element name="DIG_DATA">
    <xsd:complexType> 
      <xsd:sequence> 
        <xsd:element name="main_header"> 
          <xsd:complexType>
            <xsd:sequence> 
              <xsd:element name="comments" type="xsd:string" minOccurs="0"/>
              <xsd:element name="dimensions">
                <xsd:complexType>  <!-- dimension is the vector (USRAYS, 1, 1) -->
                  <xsd:attribute name="x" type="oddPositiveInteger" use="required"/> 
                  <xsd:attribute name="y" type="xsd:positiveInteger" fixed="1"/> 
                  <xsd:attribute name="z" type="xsd:positiveInteger" fixed="1"/> 
                </xsd:complexType> 
              </xsd:element>  <!-- dimensions -->  
              <xsd:element name="sampling_rate_x">
                <xsd:complexType>  <!-- sampling_rate_x is the vector (PINC, 0, 0) --> 
                  <xsd:attribute name="x" type="positiveReal" use="required"/> 
                  <xsd:attribute name="y" type="nonNegativeReal" fixed="0.0"/> 
                  <xsd:attribute name="z" type="nonNegativeReal" fixed="0.0"/> 
                </xsd:complexType> 
              </xsd:element>  <!-- sample_rate_x -->
              <xsd:element name="sampling_rate_y">
                <xsd:complexType>  <!-- sampling_rate_y is the vector (0, 0, 0) -->
                  <xsd:attribute name="x" type="nonNegativeReal" fixed="0.0"/> 
                  <xsd:attribute name="y" type="nonNegativeReal" fixed="0.0"/> 
                  <xsd:attribute name="z" type="nonNegativeReal" fixed="0.0"/> 
                </xsd:complexType> 
              </xsd:element>  <!-- sampling_rate_y -->
              <xsd:element name="sampling_rate_z">
                <xsd:complexType>  <!-- sampling_rate_z it the vector (0, 0, 0) -->
                  <xsd:attribute name="x" type="nonNegativeReal" fixed="0.0"/> 
                  <xsd:attribute name="y" type="nonNegativeReal" fixed="0.0"/> 
                  <xsd:attribute name="z" type="nonNegativeReal" fixed="0.0"/> 
                </xsd:complexType> 
              </xsd:element>  <!-- sampling_rate_z -->
            </xsd:sequence> 
            <xsd:attribute name="type" use="required"> 
              <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                  <xsd:pattern value="SNARK05 prjfil"/>
                </xsd:restriction>
              </xsd:simpleType>
            </xsd:attribute>  <!-- type -->
            <xsd:attribute name="title" type="xsd:string" use="required"/> 
            <xsd:attribute name="channels" use="required"> 
              <xsd:simpleType>
                <xsd:restriction base="xsd:positiveInteger">
                  <xsd:pattern value="1"/>
                </xsd:restriction>
              </xsd:simpleType>
            </xsd:attribute>  <!-- channels -->
            <xsd:attribute name="number_of_arrays" type="xsd:positiveInteger" use="required"/> 
            <xsd:attribute name="number_of_array_sets" type="xsd:positiveInteger" use="required"/> 
            <xsd:attribute name="endian" use="required">
              <xsd:simpleType>
                <xsd:restriction base="xsd:string"> 
                  <xsd:pattern value="little|big"/>
                </xsd:restriction> 
              </xsd:simpleType> 
            </xsd:attribute>  <!-- endian -->
            <xsd:attribute name="value_type" use="required">
              <xsd:simpleType> 
                <xsd:restriction base="xsd:string"> 
                  <xsd:pattern value="real"/> 
                </xsd:restriction> 
              </xsd:simpleType> 
            </xsd:attribute>  <!-- value_type -->
            <xsd:attribute name="data_type" use="required">
              <xsd:simpleType> 
                <xsd:restriction base="xsd:string"> 
                  <xsd:pattern value="double"/> 
                </xsd:restriction> 
              </xsd:simpleType> 
            </xsd:attribute>  <!-- data_type -->
            <xsd:attribute name="data_format" use="required">
              <xsd:simpleType>
                <xsd:restriction base="xsd:string"> 
                  <xsd:pattern value="binary"/> 
                </xsd:restriction> 
              </xsd:simpleType> 
            </xsd:attribute>  <!-- data_format -->
            <xsd:attribute name="grid_type" use="required">
              <xsd:simpleType>
                <xsd:restriction base="xsd:string"> 
                  <xsd:pattern value="SC"/> 
                </xsd:restriction> 
              </xsd:simpleType> 
            </xsd:attribute>  <!-- grid_type -->
            <xsd:attribute name="basis_function" use="required">
              <xsd:simpleType> 
                <xsd:restriction base="xsd:string"> 
                  <xsd:pattern value="voronoi"/> 
                </xsd:restriction> 
              </xsd:simpleType> 
            </xsd:attribute>  <!-- basis_function -->
            <xsd:attribute name="unit" use="required">
              <xsd:simpleType>
                <xsd:restriction base="xsd:string"> 
                  <xsd:pattern value="unspecified"/> 
                </xsd:restriction> 
              </xsd:simpleType> 
            </xsd:attribute>  <!-- unit -->
            <xsd:attribute name="other_unit" type="xsd:string" use="optional"/>
          </xsd:complexType> 
        </xsd:element>  <!-- main_header --> 
        <xsd:element name="application_header">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="comments" type="xsd:string" minOccurs="0"/>
              <xsd:element name="geometric_header">
                <xsd:complexType>
                  <xsd:choice>
                    <xsd:element name="divergent">
                      <xsd:complexType>
                        <xsd:sequence>
                          <xsd:element name="detector_type">
                            <xsd:simpleType>
                              <xsd:restriction base="xsd:string">
                                <xsd:pattern value="tangent|arc"/>
                              </xsd:restriction>
                            </xsd:simpleType>
                          </xsd:element>  <!-- detector_type -->
                        </xsd:sequence>
                        <xsd:attribute name="radius" type="positiveReal" use="required"/>  <!-- value of RADIUS -->
                        <xsd:attribute name="source_detector_distance" type="positiveReal" use="required"/>  <!-- value of STOD -->
                      </xsd:complexType>
                    </xsd:element>  <!-- divergent -->
                    <xsd:element name="parallel">
                      <xsd:complexType>
                        <xsd:sequence>
                          <xsd:element name="detector_type">
                            <xsd:simpleType>
                              <xsd:restriction base="xsd:string">
                                <xsd:pattern value="uniform|variable"/>
                              </xsd:restriction>
                            </xsd:simpleType>
                          </xsd:element>  <!-- detector_type -->
                          <xsd:element name="projection_type">
                            <xsd:simpleType>
                              <xsd:restriction base="xsd:string">
                                <xsd:pattern value="strip|line"/>
                              </xsd:restriction>
                            </xsd:simpleType>
                          </xsd:element>  <!-- projection_type -->
                        </xsd:sequence>
                      </xsd:complexType>
                    </xsd:element>  <!-- parallel -->
                  </xsd:choice>
                </xsd:complexType>
              </xsd:element>   <!-- geometric_header -->
              <xsd:element name="noise_header">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element name="quantum" minOccurs="0" maxOccurs="1">
                      <xsd:complexType>
                        <xsd:attribute name="mean" type="xsd:decimal" use="required"/>  <!-- value of QUANMN -->
                        <xsd:attribute name="calibration_measurement" type="xsd:decimal" use="required"/>  <!-- value of QUANCM -->
                        <xsd:attribute name="gantry_arrangement" use="required">  <!-- value of QUANIN -->
                          <xsd:simpleType>
                            <xsd:restriction base="xsd:integer">
                              <xsd:pattern value="[1-4]"/>
                            </xsd:restriction>
                          </xsd:simpleType>
                        </xsd:attribute>   <!-- gantry_arrangement -->
                      </xsd:complexType>
                    </xsd:element>      <!--quantum -->
                    <xsd:element name="scatter" minOccurs="0" maxOccurs="1">
                      <xsd:complexType>
                        <xsd:attribute name="peak" type="positiveReal" use="required"/>  <!-- value of SCTNPK -->
                        <xsd:attribute name="width" type="positiveReal" use="required"/>  <!-- value of SCTNWD -->
                      </xsd:complexType>
                    </xsd:element>   <!-- scatter -->
                    <xsd:element name="additive" minOccurs="0" maxOccurs="1">
                      <xsd:complexType>
                        <xsd:attribute name="mean" type="xsd:decimal" use="required"/>  <!-- value of ADDNMN -->
                        <xsd:attribute name="standard_deviation" type="xsd:decimal" use="required"/>  <!-- value of ADDNSD -->
                      </xsd:complexType>
                    </xsd:element>   <!-- additive -->
                    <xsd:element name="multiplicative" minOccurs="0" maxOccurs="1">
                      <xsd:complexType>
                        <xsd:attribute name="mean" type="xsd:decimal" use="required"/>  <!-- value of MULTNMN != 0 -->
                        <xsd:attribute name="standard_deviation" type="xsd:decimal" use="required"/>  <!-- value of MULTNSD -->
                      </xsd:complexType>
                    </xsd:element>   <!-- multiplicative -->
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>   <!-- noise_header -->
              <xsd:element name="spectrum_header">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element name="energy_level" minOccurs="1" maxOccurs="7">
                      <xsd:complexType>  <!-- should occur number_of_energy times -->
                        <xsd:attribute name="energy" type="xsd:integer" use="required"/>  <!-- values of -->
                        <xsd:attribute name="ratio" type="nonNegativeReal" use="required"/>  <!-- values of PERCENT/100 -->
                        <xsd:attribute name="background" type="xsd:decimal" use="required"/>  <!-- values of backgr -->
                      </xsd:complexType>
                    </xsd:element>   <!-- energy_level -->
                  </xsd:sequence>
                  <xsd:attribute name="number_of_energies" use="required">
                    <xsd:simpleType>  <!-- value of NERGY -->
                      <xsd:restriction base="xsd:integer">
                        <xsd:pattern value="[1-7]"/>
                      </xsd:restriction>
                    </xsd:simpleType>
                  </xsd:attribute>   <!-- number_of_energies -->
                </xsd:complexType>
              </xsd:element>   <!-- spectrum_header -->
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>  <!-- application_header -->
        <xsd:element name="array_set_header" minOccurs="1" maxOccurs="unbounded"> 
          <xsd:complexType>
            <xsd:sequence> 
              <xsd:element name="comments" type="xsd:string" minOccurs="0"/>
              <xsd:element name="parameters" type="xsd:decimal"/>  <!-- angle in radians -->
              <xsd:element name="array_header" minOccurs="1" maxOccurs="unbounded"> 
                <xsd:complexType>
                  <xsd:sequence>
		              <xsd:element name="comments" type="xsd:string" minOccurs="0"/>
                  </xsd:sequence>
                  <xsd:attribute name="enumeration_number" type="xsd:nonNegativeInteger" use="required"/> 
                </xsd:complexType>
              </xsd:element>  <!-- array_header -->
            </xsd:sequence> 
            <xsd:attribute name="type" use="required"> 
              <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                  <xsd:pattern value="projection"/>
                </xsd:restriction>
              </xsd:simpleType>
            </xsd:attribute>  <!-- type -->
            <xsd:attribute name="title" type="nonNegativeInteger" use="required"/>
          </xsd:complexType> 
        </xsd:element>  <!-- array_set_header -->
      </xsd:sequence> 
    </xsd:complexType>
  </xsd:element>  <!-- DIG_DATA -->

             <!-- type definitions for PRJFIL schema -->
  <xsd:simpleType name="nonNegativeReal"> 
    <xsd:restriction base="xsd:decimal"> 
      <xsd:minInclusive value="0.0"/> 
    </xsd:restriction> 
  </xsd:simpleType>  

  <xsd:simpleType name="positiveReal">
    <xsd:restriction base="xsd:decimal">
      <xsd:minExclusive value="0"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="nonNegativeInteger">
    <xsd:restriction base="xsd:integer">
      <xsd:minInclusive value="0"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="oddPositiveInteger">
    <xsd:restriction base="xsd:integer">
      <xsd:pattern value="[0-9]*[13579]"/>
    </xsd:restriction>
  </xsd:simpleType>  
  
</xsd:schema>

