<?xml version = "1.0" encoding = "UTF-8"?>
<?xml-stylesheet href="documentationDisplay.xsl" type="text/xsl"?>
<!--
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #
    # Copyright (C) 2002-2008 Open Microscopy Environment
    #       Massachusetts Institute of Technology,
    #       National Institutes of Health,
    #       University of Dundee,
    #       University of Wisconsin at Madison
    #
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<!--
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # Written by: Ilya G. Goldberg, Andrew J Patterson
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<xsd:schema xmlns="http://www.openmicroscopy.org/Schemas/OME/2008-09" 
    targetNamespace="http://www.openmicroscopy.org/Schemas/OME/2008-09" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:AML="http://www.openmicroscopy.org/Schemas/AnalysisModule/2008-09" 
    xmlns:STD="http://www.openmicroscopy.org/Schemas/STD/2008-09" 
    xmlns:Bin="http://www.openmicroscopy.org/Schemas/BinaryFile/2008-09" 
    xmlns:CA="http://www.openmicroscopy.org/Schemas/CA/2008-09" 
    xmlns:SPW="http://www.openmicroscopy.org/Schemas/SPW/2008-09" 
    xmlns:SA="http://www.openmicroscopy.org/Schemas/SA/2008-09" 
    xmlns:xml="http://www.w3.org/XML/1998/namespace"
    version="1" 
    elementFormDefault="qualified">
    <xsd:import namespace="http://www.openmicroscopy.org/Schemas/AnalysisModule/2008-09" schemaLocation="http://www.openmicroscopy.org/Schemas/AnalysisModule/2008-09/AnalysisModule.xsd"/>
    <xsd:import namespace="http://www.openmicroscopy.org/Schemas/STD/2008-09" schemaLocation="http://www.openmicroscopy.org/Schemas/STD/2008-09/STD.xsd"/>
    <xsd:import namespace="http://www.openmicroscopy.org/Schemas/BinaryFile/2008-09" schemaLocation="http://www.openmicroscopy.org/Schemas/BinaryFile/2008-09/BinaryFile.xsd"/>
    <xsd:import namespace="http://www.openmicroscopy.org/Schemas/CA/2008-09" schemaLocation="http://www.openmicroscopy.org/Schemas/CA/2008-09/CA.xsd"/>
    <xsd:import namespace="http://www.openmicroscopy.org/Schemas/SPW/2008-09" schemaLocation="http://www.openmicroscopy.org/Schemas/SPW/2008-09/SPW.xsd"/>
    <xsd:import namespace="http://www.openmicroscopy.org/Schemas/SA/2008-09" schemaLocation="http://www.openmicroscopy.org/Schemas/SA/2008-09/SA.xsd"/>

    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>

    
    <xsd:annotation>
        <xsd:documentation>
            Open Microscopy Environment
            OME XML Schema September 2008
            Author:  Ilya G. Goldberg, Andrew J Patterson
            Copyright 2002 - 2008 OME. All rights reserved.
        </xsd:documentation>
    </xsd:annotation>
    <xsd:element name="OME"> <!-- top level definition -->
        <xsd:annotation>

            <xsd:documentation>
                The OME element is a container for all information objects accessible by OME.  These information objects include descriptions of the imaging experiments
                and the people who perform them, descriptions of the microscope, the resulting images and how they were acquired, the analyses performed on those images,
                and the analysis results themselves.
                An OME file may contain any or all of this information.
            </xsd:documentation>

        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="Project" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="Dataset" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="Experiment" minOccurs="0" maxOccurs="unbounded"/>

                <xsd:element ref="SPW:Plate" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="SPW:Screen" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="Experimenter" minOccurs="0" maxOccurs="unbounded"/>

                <xsd:element ref="Group" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="Instrument" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="Image" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="STD:SemanticTypeDefinitions" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="AML:AnalysisModuleLibrary" minOccurs="0" maxOccurs="1"/>

                <xsd:element ref="CA:CustomAttributes" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="SA:StructuredAnnotations" minOccurs="0" maxOccurs="1"/>
            </xsd:sequence>
            <xsd:attribute name="UUID" type="UniversallyUniqueIdentifier" use="optional"/>

        </xsd:complexType>
    </xsd:element>
    <xsd:element name="Image"> <!-- top level definition -->
        <xsd:annotation>

            <xsd:documentation>
                This element describes the actual image and its meta-data.
                The elements that are references (ending in Ref) refer to elements defined outside of the Image element.
                If any of the required Image attributes are missing, its guaranteed to be an invalid document.
                The required elements are CreationDate and Pixels.
                ExperimenterRef is required for all Images with well formed LSIDs.
                ImageType is a vendor-specific designation of the type of image this is.
                Examples of ImageType include 'STK', 'SoftWorx', etc.
                The Name attributes are in all cases the name of the element instance. In this case, the name of the image,
                not necessarily the filename.
                PixelSize* is in microns.
                TimeIncrement is used for time series that have a global timing specification instead of per-timepoint timing info.
                For example in a video stream.  The unit is seconds.
                Similarly, WaveStart and WaveIncrement are used in spectral images like FTIR.  These are both positive integers.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>

            <xsd:sequence>
                <xsd:element ref="CreationDate" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ExperimenterRef" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="Description" minOccurs="0" maxOccurs="1"/>

                <xsd:element ref="ExperimentRef" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="GroupRef" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="DatasetRef" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="InstrumentRef" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ObjectiveRef" minOccurs="0" maxOccurs="1"/>

                <xsd:element ref="ImagingEnvironment" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="Thumbnail" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="LogicalChannel" minOccurs="0" maxOccurs="unbounded"/>

                <xsd:element ref="DisplayOptions" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="StageLabel" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="Pixels" minOccurs="1" maxOccurs="unbounded"/>
                <xsd:element ref="Region" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="CA:CustomAttributes" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ROI" minOccurs="0" maxOccurs="unbounded"/>

                <xsd:element ref="MicrobeamManipulation" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>

            <xsd:attribute name="ID" use="required" type="ImageID"/>
            <xsd:attribute name="Name" use="optional" type="xsd:string"/>
            <xsd:attribute name="DefaultPixels" use="required" type="PixelsID">
                <xsd:annotation>
                    <xsd:documentation>
                        More than one Pixels element may be associated with an Image. 
                        An Image will however have one "primary" set of Pixels specified with this attribute.
                    </xsd:documentation>

                </xsd:annotation>
            </xsd:attribute>

            <xsd:attribute name="AcquiredPixels" use="optional" type="PixelsID">
                <xsd:annotation>
                    <xsd:documentation>
                        Optional. 
                        More than one Pixels element may be associated with an Image. 
                        This attribute indicates the original acquired pixels.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>

        </xsd:complexType>
    </xsd:element>

    <xsd:element name="CreationDate" type="xsd:dateTime"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>
                The creation date of the Image - when the Image was acquired.
                The element contains a string in the ISO 8601 dateTime format (i.e. 1988-04-07T18:39:09)
            </xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:element name="Pixels"> <!-- top level definition -->

        <xsd:annotation>
            <xsd:documentation>
                The Image will be unreadable if any of the required Pixel attributes are missing.
                The Pixels themselves are stored within the file compressed by plane, and encoded in Base64.
                The Pixels element must contain a list of BinData, each containing a single plane of pixels.
                These Pixels elements, when read in document order, must produce a 5-D pixel array
                of the size specified in this element, and in the dimension order specified by 'DimensionOrder'.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
                <xsd:choice minOccurs="1" maxOccurs="1">

                    <xsd:element ref="Bin:BinData" minOccurs="1" maxOccurs="unbounded"/>

                    <xsd:element ref="TiffData" minOccurs="1" maxOccurs="unbounded"/>
                </xsd:choice>
                <xsd:element ref="Plane" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="ID" use="required" type="PixelsID"/>
            <xsd:attribute name="DimensionOrder" use="required">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">

                        <xsd:enumeration value="XYZCT"/>
                        <xsd:enumeration value="XYZTC"/>
                        <xsd:enumeration value="XYCTZ"/>
                        <xsd:enumeration value="XYCZT"/>
                        <xsd:enumeration value="XYTCZ"/>
                        <xsd:enumeration value="XYTZC"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>

            <xsd:attribute name="PixelType" use="required" type="PixelTypes"/>
            <xsd:attribute name="BigEndian" use="required" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>This is true if the pixel data was written in BigEndian order. This is dependent on the system architecture of the machine that wrote the pixels. True for essentially all modern CPUs other than Intel and Alpha. All pixel data must be written in the same endian order.</xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="SizeX" use="required" type="xsd:positiveInteger">
                <xsd:annotation>

                    <xsd:documentation>Dimensional size of pixel data array</xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="SizeY" use="required" type="xsd:positiveInteger">
                <xsd:annotation>
                    <xsd:documentation>Dimensional size of pixel data array</xsd:documentation>
                </xsd:annotation>

            </xsd:attribute>

            <xsd:attribute name="SizeZ" use="required" type="xsd:positiveInteger">
                <xsd:annotation>
                    <xsd:documentation>Dimensional size of pixel data array</xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="SizeC" use="required" type="xsd:positiveInteger">
                <xsd:annotation>

                    <xsd:documentation>Dimensional size of pixel data array</xsd:documentation>

                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="SizeT" use="required" type="xsd:positiveInteger">
                <xsd:annotation>
                    <xsd:documentation>Dimensional size of pixel data array</xsd:documentation>
                </xsd:annotation>

            </xsd:attribute>
            <xsd:attribute name="PhysicalSizeX" use="optional">

                <xsd:annotation>
                    <xsd:documentation>Physical size of a pixel. Units are um. Expected range: 0.01 - 10</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                    <xsd:restriction base="xsd:float">
                        <xsd:minInclusive value="0.01"/>
                        <xsd:maxInclusive value="10"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="PhysicalSizeY" use="optional">
                <xsd:annotation>

                    <xsd:documentation>Physical size of a pixel. Units are um. Expected range: 0.01 - 10</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                    <xsd:restriction base="xsd:float">
                        <xsd:minInclusive value="0.01"/>
                        <xsd:maxInclusive value="10"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="PhysicalSizeZ" use="optional">
                <xsd:annotation>
                    <xsd:documentation>Physical size of a pixel. Units are um. Expected range: 0.05 - 10</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                    <xsd:restriction base="xsd:float">
                        <xsd:minInclusive value="0.05"/>
                        <xsd:maxInclusive value="10"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="TimeIncrement" use="optional" >
                <xsd:annotation>
                    <xsd:documentation>
                        TimeIncrement is used for time series that have a global timing specification instead of per-timepoint timing info.
                        For example in a video stream.  The unit is seconds. Expected range: 0.001 - 3600 (1 hour)
                    </xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                    <xsd:restriction base="xsd:float">
                        <xsd:minInclusive value="0.001"/>
                        <xsd:maxInclusive value="3600"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="WaveStart" use="optional">

                <xsd:annotation>
                    <xsd:documentation>
                        WaveStart is used in spectral images like FTIR. Units are nm. Expected range: 200 - 800 nm.
                    </xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                    <xsd:restriction base="xsd:positiveInteger">
                        <xsd:minInclusive value="200"/>
                        <xsd:maxInclusive value="800"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="WaveIncrement" use="optional">
                <xsd:annotation>
                    <xsd:documentation>

                        WaveIncrement is used in spectral images like FTIR. Units are nm. Expected range: 1 - 50 nm.
                    </xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                    <xsd:restriction base="xsd:positiveInteger">
                        <xsd:minInclusive value="1"/>
                        <xsd:maxInclusive value="50"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="TiffData"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>

                This described the location of the pixel data in a tiff file.
            </xsd:documentation>
        </xsd:annotation>

        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="UUID" minOccurs="0" maxOccurs="1">
                    <xsd:annotation>
                        <xsd:documentation>
                            This must be used when the IFDs are located in another file.
                            Note: It is permissible for this to be self referential.
                        </xsd:documentation>

                    </xsd:annotation>
                    <xsd:complexType>

                        <xsd:simpleContent>
                            <xsd:extension base = "UniversallyUniqueIdentifier">
                                <xsd:attribute name="FileName" use="optional" type="xsd:string">
                                    <xsd:annotation>
                                        <xsd:documentation>
                                            This can be used when the IFDs are located in another file.
                                            The / (forward slash) is used as the path separator.
                                            A relative path is recommended. However an absolute path can be specified.
                                            Default is to use the file the ome-xml data has been pulled from.
                                            Note: It is permissible for this to be self referential. The file image1.tiff
                                            may contain ome-xml data that has FilePath="image1.tiff" or "./image1.tiff"
                                        </xsd:documentation>

                                    </xsd:annotation>
                                </xsd:attribute>

                            </xsd:extension>
                        </xsd:simpleContent>
                    </xsd:complexType>
                </xsd:element>
            </xsd:sequence>
            <xsd:attribute name="IFD" type="xsd:integer" default="0" use="optional">

                <xsd:annotation>
                    <xsd:documentation>
                        Gives the IFD(s) for which this element is applicable. Indexed from 0. 
                        Default is 0 (the first IFD).
                    </xsd:documentation>

                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="FirstZ" type="xsd:integer" default="0" use="optional">
                <xsd:annotation>
                    <xsd:documentation>

                        Gives the Z position of the image plane at the specified IFD. Indexed from 0. 
                        Default is 0 (the first Z position).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>

            <xsd:attribute name="FirstT" type="xsd:integer" default="0" use="optional">
                <xsd:annotation>
                    <xsd:documentation>
                        Gives the T position of the image plane at the specified IFD. Indexed from 0.
                        Default is 0 (the first T position).
                    </xsd:documentation>

                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="FirstC" type="xsd:integer" default="0" use="optional">
                <xsd:annotation>

                    <xsd:documentation>
                        Gives the C position of the image plane at the specified IFD. Indexed from 0. 
                        Default is 0 (the first C position).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>

            <xsd:attribute name="NumPlanes" use="optional" type="xsd:integer">
                <xsd:annotation>
                    <xsd:documentation>
                        Gives the number of IFDs affected. Dimension order of IFDs is given by the enclosing
                        Pixels element's DimensionOrder attribute. Default is the number of IFDs in the TIFF
                        file, unless an IFD is specified, in which case the default is 1.    
                    </xsd:documentation>

                </xsd:annotation>
            </xsd:attribute>
        </xsd:complexType>
    </xsd:element>

    
    <xsd:element name="Plane"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>
            </xsd:documentation>

        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="PlaneTiming" type="PlaneTiming" minOccurs="0" maxOccurs="1"/>

                <xsd:element name="StagePosition" type="StagePosition" minOccurs="0" maxOccurs="1"/>
                <xsd:choice minOccurs="0" maxOccurs="1">
                    <xsd:annotation>
                        <xsd:documentation>
                            This optional element is a hash of the plane's image data. 
                            It is a choice between all the support hash types.
                            Currently the only method supported is SHA1.
                        </xsd:documentation>

                    </xsd:annotation>
                    <xsd:element name="HashSHA1" type="Hex40" minOccurs="1" maxOccurs="1"/>
                </xsd:choice>

            </xsd:sequence>
            <xsd:attribute name="TheZ" use="required" type="xsd:integer"/>
            <xsd:attribute name="TheT" use="required" type="xsd:integer"/>
            <xsd:attribute name="TheC" use="required" type="xsd:integer"/>
        </xsd:complexType>
    </xsd:element>

    <xsd:complexType name="PlaneTiming">
        <xsd:attribute name="DeltaT" use="optional">

            <xsd:annotation>
                <xsd:documentation>
                    Units are seconds since the beginning of the experiment. Expected Range 0 - 2592000 (30 days)
                </xsd:documentation>
            </xsd:annotation>
            <xsd:simpleType>
                <xsd:restriction base="xsd:float">
                    <xsd:minInclusive value="0"/>
                    <xsd:maxInclusive value="2592000"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:attribute>
        <xsd:attribute name="ExposureTime" use="optional">

            <xsd:annotation>
                <xsd:documentation>

                    Units are seconds. Expected Range 0.001 - 60.
                </xsd:documentation>
            </xsd:annotation>
            <xsd:simpleType>
                <xsd:restriction base="xsd:float">
                    <xsd:minInclusive value="0.001"/>
                    <xsd:maxInclusive value="60"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:attribute>
    </xsd:complexType>
    
    <xsd:complexType name="StagePosition">
        <xsd:annotation>

            <xsd:documentation>
                All units are in the microscope reference frame
            </xsd:documentation>

        </xsd:annotation>
        <xsd:attribute name="PositionX" use="optional" type="xsd:float"/>
        <xsd:attribute name="PositionY" use="optional" type="xsd:float"/>
        <xsd:attribute name="PositionZ" use="optional" type="xsd:float"/>
    </xsd:complexType>
    
    <xsd:element name="Experiment"> <!-- top level definition -->

        <xsd:annotation>
            <xsd:documentation>

                This element describes the type of experiment.  The required Type attribute must contain one or more entries from the following list:
                FP FRET Time-lapse 4-D+ Screen Immunocytochemistry FISH Electrophysiology  Ion-Imaging Colocalization PGI/Documentation
                FRAP Photoablation Optical-Trapping Photoactivation Fluorescence-Lifetime Spectral-Imaging Other
                FP refers to fluorescent proteins, PGI/Docuemntation is not a 'data' image.
                The optional Description element may contain free text to further describe the experiment.
                Added Type Photobleaching - ajp
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="Description" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ExperimenterRef" minOccurs="0" maxOccurs="1">

                    <xsd:annotation>
                        <xsd:documentation>

                        This is a link to the Experimenter who conducted the experiment - ajp
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element ref="MicrobeamManipulationRef" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="Type" use="required">

                <xsd:simpleType>
                    <xsd:list>

                        <xsd:simpleType>
                            <xsd:restriction base="xsd:string">
                                <xsd:enumeration value="FP"/>
                                <xsd:enumeration value="FRET"/>
                                <xsd:enumeration value="TimeLapse"/>
                                <xsd:enumeration value="FourDPlus"/>
                                <xsd:enumeration value="Screen"/>

                                <xsd:enumeration value="Immunocytochemistry"/>

                                <xsd:enumeration value="Immunofluorescence"/>
                                <xsd:enumeration value="FISH"/>
                                <xsd:enumeration value="Electrophysiology"/>
                                <xsd:enumeration value="IonImaging"/>
                                <xsd:enumeration value="Colocalization"/>
                                <xsd:enumeration value="PGIDocumentation"/>
                                <xsd:enumeration value="FluorescenceLifetime"/>
                                <xsd:enumeration value="SpectralImaging"/>

                                <xsd:enumeration value="Photobleaching"/>
                                <xsd:enumeration value="Other"/>
                            </xsd:restriction>
                        </xsd:simpleType>
                    </xsd:list>
                </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="ID" use="required" type="ExperimentID"/>
        </xsd:complexType>

    </xsd:element>
    <xsd:element name="ExperimentRef"> <!-- top level definition -->
        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="Reference">
                    <xsd:attribute name="ID" use="required" type="ExperimentID"/>
                </xsd:extension>
            </xsd:complexContent>

        </xsd:complexType>
    </xsd:element>

    <xsd:element name="MicrobeamManipulation"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>
                Defines a microbeam operation type and the region of the image it was applied to.
                The LightSourceRef element is a reference to a LightSource specified in the Instrument element which was used for a technique other than illumination for
                the purpose of imaging.  For example, a laser used for photobleaching.
                
            </xsd:documentation>
        </xsd:annotation>

        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="ROIRef" minOccurs="1" maxOccurs="unbounded"/>
                <xsd:element ref="ExperimenterRef" minOccurs="1" maxOccurs="1"/>
                <xsd:element ref="LightSourceRef" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="ID" use="required" type="MicrobeamManipulationID"/>
            <xsd:attribute name="Type" use="required">

                <xsd:simpleType>

                    <xsd:list>
                        <xsd:simpleType>
                            <xsd:restriction base="xsd:string">
                                <xsd:enumeration value="FRAP"/>
                                <xsd:enumeration value="Photoablation"/>
                                <xsd:enumeration value="Photoactivation"/>
                                <xsd:enumeration value="Uncaging"/>

                                <xsd:enumeration value="OpticalTrapping"/>
                                <xsd:enumeration value="Other"/>

                            </xsd:restriction>
                        </xsd:simpleType>
                    </xsd:list>
                </xsd:simpleType>
            </xsd:attribute>
        </xsd:complexType>

    </xsd:element>
    
    <xsd:element name="MicrobeamManipulationRef"> <!-- top level definition -->

        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="Reference">
                    <xsd:attribute name="ID" use="required" type="MicrobeamManipulationID"/>
                </xsd:extension>
            </xsd:complexContent>

        </xsd:complexType>
    </xsd:element>    
    <xsd:element name="LogicalChannel"> <!-- top level definition -->

        <xsd:annotation>
            <xsd:documentation>
                There must be one per channel in the Image, even for a single-plane image.  In OME, Channels (e.g. 'FITC', 'Texas Red', etc) are specified as Logical Channels,
                And information about how each of them was acquired is stored in the various optional *Ref elements.  Each Logical Channel is composed of one or more
                ChannelComponents.  For example, an entire spectrum in an FTIR experiment may be stored in a single Logical Channel with each discrete wavenumber of the spectrum
                constituting a ChannelComponent of the FTIR Logical Channel.  An RGB image where the Red, Green and Blue components do not reflect discrete probes but are
                instead the output of a color camera would be treated similarly - one Logical channel with three ChannelComponents in this case.
                The total number of ChannelComponents for a set of pixels must equal SizeC.
                The SamplesPerPixel attribute is the number of channel components in the logical channel.
                The IlluminationType attribute is a string enumeration which may be set to 'Transmitted', 'Epifluorescence', 'Oblique', or 'NonLinear'.
                The optional PinholeSize attribute allows specifying adjustable pin hole diameters for confocal microscopes.
                The PhotometricInterpretation attribute is used to describe how to display a multi-component channel.  This attribute may be set to:
                'monochrome', 'RGB', 'ARGB', 'CMYK', 'HSV'.  The default for single-component channels is 'monochrome'.
                The Mode attribute describes the type of microscopy performed for each channel.  This may be set to:
                'Wide-field','Wide-field','Laser Scanning Microscopy','Laser Scanning Confocal','Spinning Disk Confocal','Slit Scan Confocal','Multi-Photon Microscopy',
                'Structured Illumination','Single Molecule Imaging','Total Internal Reflection','Fluorescence-Lifetime','Spectral Imaging',
                'Fluorescence Correlation Spectroscopy','Near Field Scanning Optical Microscopy','Second Harmonic Generation Imaging'.
                The ContrastMethod attribute may be set to 'Brightfield','Phase','DIC','Hoffman Modulation','Oblique Illumination','Polarized Light','Darkfield','Fluorescence'.
                The ExWave, EmWave and Fluor attributes allow specifying the nominal excitation and emission wavelengths and the type of fluor being imaged in a particular channel.
                The Fluor attribute is used for fluorescence images, while the Name attribute is used to name channels that are not imaged using fluorescence techniques.
                The user interface logic for labeling a given channel for the user should use the first existing attribute in the following sequence:
                Name -> Fluor -> EmWave -> ChannelComponent/Index.
                The NDfilter attribute is used to specify (in O.D. units) the combined effect of any neutral density filters used.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>

            <xsd:sequence>
                <xsd:element ref="LightSourceRef" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="OTFRef" minOccurs="0" maxOccurs="1"/>

                <xsd:element ref="DetectorRef" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="FilterSetRef" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ChannelComponent" minOccurs="1" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="ID" use="required" type="LogicalChannelID"/>

            <xsd:attribute name="Name" use="optional" type="xsd:string"/>
            <xsd:attribute name="SamplesPerPixel" use="optional" type="xsd:integer"/>
            <xsd:attribute name="SecondaryEmissionFilter" use="optional" type="FilterID"/>
            <xsd:attribute name="SecondaryExcitationFilter" use="optional" type="FilterID"/>

            <xsd:attribute name="IlluminationType" use="optional">
                <xsd:annotation><xsd:documentation>
                    Attribute is called Illumination in EA diagram - ajp
                    Added NonLinear - ajp
                </xsd:documentation></xsd:annotation>
                <xsd:simpleType>

                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="Transmitted"/>
                        <xsd:enumeration value="Epifluorescence"/>
                        <xsd:enumeration value="Oblique"/>

                        <xsd:enumeration value="NonLinear"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>

            <xsd:attribute name="PinholeSize" use="optional" type="xsd:float">
                <xsd:annotation>
                    <xsd:documentation>
                        The optional PinholeSize attribute allows specifying adjustable pin hole diameters for confocal microscopes. Units are Airy disks? or um? (insight displays as um) TODO: RESTRICTION NOT READY
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="PhotometricInterpretation" default="Monochrome" use="optional">
                <xsd:annotation>

                    <xsd:documentation>
                        To Do - Add more documentation - ajp
                        Added ColorMap - ajp
                    </xsd:documentation>

                </xsd:annotation>
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="Monochrome"/>
                        <xsd:enumeration value="RGB"/>
                        <xsd:enumeration value="ARGB"/>

                        <xsd:enumeration value="CMYK"/>
                        <xsd:enumeration value="HSV"/>
                        <xsd:enumeration value="ColorMap"/>

                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="Mode" use="optional">
                <xsd:simpleType>

                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="WideField"/>
                        <xsd:enumeration value="LaserScanningMicroscopy"/>
                        <xsd:enumeration value="LaserScanningConfocal"/>

                        <xsd:enumeration value="SpinningDiskConfocal"/>
                        <xsd:enumeration value="SlitScanConfocal"/>
                        <xsd:enumeration value="MultiPhotonMicroscopy"/>
                        <xsd:enumeration value="StructuredIllumination"/>

                        <xsd:enumeration value="SingleMoleculeImaging"/>
                        <xsd:enumeration value="TotalInternalReflection"/>
                        <xsd:enumeration value="FluorescenceLifetime"/>
                        <xsd:enumeration value="SpectralImaging"/>
                        <xsd:enumeration value="FluorescenceCorrelationSpectroscopy"/>

                        <xsd:enumeration value="NearFieldScanningOpticalMicroscopy"/>
                        <xsd:enumeration value="SecondHarmonicGenerationImaging"/>
                        <xsd:enumeration value="Other"/>

                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="ContrastMethod" use="optional">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">

                        <xsd:enumeration value="Brightfield"/>
                        <xsd:enumeration value="Phase"/>

                        <xsd:enumeration value="DIC"/>
                        <xsd:enumeration value="HoffmanModulation"/>
                        <xsd:enumeration value="ObliqueIllumination"/>
                        <xsd:enumeration value="PolarizedLight"/>
                        <xsd:enumeration value="Darkfield"/>
                        <xsd:enumeration value="Fluorescence"/>
                    </xsd:restriction>

                </xsd:simpleType>

            </xsd:attribute>
            <xsd:attribute name="ExWave" use="optional">
                <xsd:annotation>
                    <xsd:documentation>
                        Excitation wavelength of excitation for a particular channel, in nm.
                        Expected range 200 - 1200    
                    </xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                    <xsd:restriction base="xsd:positiveInteger">
                        <xsd:minInclusive value="200"/>
                        <xsd:maxInclusive value="1200"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="EmWave" use="optional">

                <xsd:annotation>
                    <xsd:documentation>
                        Emission wavelength of excitation for a particular channel, in nm.
                        Expected range 200 - 800
                    </xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                    <xsd:restriction base="xsd:positiveInteger">
                        <xsd:minInclusive value="200"/>
                        <xsd:maxInclusive value="800"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="Fluor" use="optional" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>

                        Type of fluor for a particular channel.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="NdFilter" use="optional" type="xsd:float"/>    
            <xsd:attribute name="PockelCellSetting" use="optional" type="xsd:integer"/>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="LogicalChannelRef"> <!-- top level definition -->

        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="Reference">
                    <xsd:attribute name="ID" use="required" type="LogicalChannelID"/>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>

    </xsd:element>

    <xsd:element name="DisplayOptions"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>
                There is optionally one of these per Image. They provide support for the Origional OME Perl server.
                This specifies mapping of image channel components to RGB or greyscale colorspace with one byte per pixel per RGB channel.
                RedChannel, GreenChannel, BlueChannel, and GreyChannel specify the scaling of pixel values to 8-bit colorspace values.
                Display indicates to display the image as Greyscale or RGB.
                The Projection element specifies that the display is a maximum intensity projection.
                The range of Z-sections for the projection is specified with the ZStart and ZStop attributes.
                The Time element restricts the range of timepoints displayed.
                The range of timepoints to display is specified by the TStart and TStop attributes.
                The MIME type of the desired video format is specified by Movie's MIMEtype attribute.
                The ROI element originally describes a 3-D region of interest. It now use the new ROI 
                model. It is up to the loader to convert the new ROI structure to the old format if 
                it is required.  It is up to the viewer to either display the ROI only, or to simply
                mark it somehow.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>

                <xsd:element ref="RedChannel" minOccurs="1" maxOccurs="1"/>
                <xsd:element ref="GreenChannel" minOccurs="1" maxOccurs="1"/>
                <xsd:element ref="BlueChannel" minOccurs="1" maxOccurs="1"/>
                <xsd:element ref="GreyChannel" minOccurs="1" maxOccurs="1"/>
                <xsd:element ref="Projection" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="Time" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ROI" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="Zoom" use="optional" type="xsd:float"/>

            <xsd:attribute name="ID" use="required" type="DisplayOptionsID"/>
            <xsd:attribute name="Display" use="required">
                <xsd:annotation>
                    <xsd:documentation>Specifies to display the image as greyscale or RGB</xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="RGB"/>

                        <xsd:enumeration value="Grey"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="RedChannel" type="ChannelSpecType"> <!-- top level definition -->
        <xsd:annotation>

            <xsd:documentation>
                The wave number, black level, white level and optional gamma for the red channel of an RGB image.
                Pixel values between BlackLevel and WhiteLevel will be assigned values 0-255, respectively.  
                Values below BlackLevel or above WhiteLevel will be assigned 0 and 255 respectively.
            </xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    <xsd:element name="GreenChannel" type="ChannelSpecType"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>

                The wave number, black level, white level and optional gamma for the green channel of an RGB image.
                Pixel values between BlackLevel and WhiteLevel will be assigned values 0-255, respectively.  
                Values below BlackLevel or above WhiteLevel will be assigned 0 and 255 respectively.
            </xsd:documentation>

        </xsd:annotation>
    </xsd:element>
    <xsd:element name="BlueChannel" type="ChannelSpecType"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>
                The wave number, black level, white level and optional gamma for the blue channel of an RGB image.
                Pixel values between BlackLevel and WhiteLevel will be assigned values 0-255, respectively.  
                Values below BlackLevel or above WhiteLevel will be assigned 0 and 255 respectively.
            </xsd:documentation>

        </xsd:annotation>
    </xsd:element>

    <xsd:element name="GreyChannel"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>
                The wave number, black level, white level and optional gamma for a greyscale image.
                The GreyChannel element may contain an optional ColorMap attribute, which can be set to 'Greyscale', 'Spectrum' or 'Blackbody'
                Pixel values between BlackLevel and WhiteLevel will be assigned values 0-255, inclusive.  
                Values below BlackLevel or above WhiteLevel will be assigned 0 and 255 respectively.
            </xsd:documentation>
        </xsd:annotation>

        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="ChannelSpecType">

                    <xsd:attribute name="ColorMap" use="optional" default="Greyscale">
                        <xsd:simpleType>
                            <xsd:restriction base="xsd:string">
                                <xsd:enumeration value="Greyscale"/>
                                <xsd:enumeration value="Spectrum"/>

                                <xsd:enumeration value="Blackbody"/>
                            </xsd:restriction>
                        </xsd:simpleType>
                    </xsd:attribute>

                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="Projection"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>
                The presence of this element indicates the user wants to view the Image as a maximum intensity projection.
                The ZStart and ZStop attributes are optional.  If they are not specified, then the entire Z stack will be pro
                 z values are index from 0 to maxZ - 1
            </xsd:documentation>

        </xsd:annotation>
        <xsd:complexType>
            <xsd:attribute name="ZStart" use="optional" type="xsd:integer"/>

            <xsd:attribute name="ZStop" use="optional" type="xsd:integer"/>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="Time"> <!-- top level definition -->
        <xsd:annotation>

            <xsd:documentation>
                The time range the user is interested in the initial viewer display.  A range of timepoints indicates a movie
                If they are not specified, the movie is to include all timepoints.
                If the Time attributes point to a single time-point, that is the timepoint to be initially displayed.
                If the entire element is missing, the first time-point  will be displayed
                t values are index from 0 to maxT - 1
            </xsd:documentation>

        </xsd:annotation>
        <xsd:complexType>
            <xsd:attribute name="TStart" use="optional" type="xsd:integer"/>
            <xsd:attribute name="TStop" use="optional" type="xsd:integer"/>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="Instrument"> <!-- top level definition -->
        <xsd:annotation>

            <xsd:documentation>
                This element describes the instrument used to capture the Image.
                It is primarily a container for manufacturer's model and catalog numbers for the
                Microscope, LightSource, Detector, Objective and Filters components.
                Additionally, one or more OTF elements may be specified, describing the optical transfer function under different conditions.
                The Objective element contains the additional elements LensNA and Magnification.
                The Filters element can be composed either of separate excitation, emission filters and a dichroic mirror
                or a single filter set.  Within the Image itself, a reference is made to this one Filter element.
                The OTF element contains an optical transfer function.
                The same OTF can be used for all wavelengths, or there may be one per wavelength.
                There may be multiple light sources, detectors, objectives and filters on a microscope.
                Each of these has their own ID attribute, which can be referred to from LogicalChannel.
                It is understood that the light path configuration can be different for each channel,
                but cannot be different for each timepoint or each plane of an XYZ stack.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="Microscope" minOccurs="0" maxOccurs="1"/>

                <xsd:element ref="LightSource" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="Detector" minOccurs="0" maxOccurs="unbounded"/>

                <xsd:element ref="Objective" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="FilterSet" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="Filter" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="Dichroic" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="OTF" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="ID" use="required" type="InstrumentID"/>

        </xsd:complexType>

    </xsd:element>
    <xsd:element name="StageLabel"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>
                The StageLabel is used to specify a name and position for a stage position in the microscope's reference frame.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>

            <xsd:attribute name="Name" use="required" type="xsd:string"/>
            <xsd:attribute name="X" use="optional" type="xsd:float"/>
            <xsd:attribute name="Y" use="optional" type="xsd:float"/>
            <xsd:attribute name="Z" use="optional" type="xsd:float"/>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="Experimenter"> <!-- top level definition -->
        <xsd:annotation>

            <xsd:documentation>
                This element describes a person who performed an imaging experiment.
                This person may also be a user of the OME system, in which case the OMEName element contains their login name.
                Experimenters may belong to one or more groups which are specified using one or more GroupRef elements.
                Note while FirstName, LastName, Email and OMEName are all optional to be valid an Experimenter must have AT LEAST ONE present
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
                <xsd:choice minOccurs="1" maxOccurs="1">
                    <xsd:annotation>
                        <xsd:documentation>

                            At lease one of (FirstName, LastName, Email, OMEName)
                        </xsd:documentation>
                    </xsd:annotation>
                    <xsd:sequence>
                        <xsd:element ref="FirstName" minOccurs="1" maxOccurs="1"/>
                        <xsd:element ref="LastName" minOccurs="0" maxOccurs="1"/>
                        <xsd:element ref="Email" minOccurs="0" maxOccurs="1"/>
                        <xsd:element ref="Institution" minOccurs="0" maxOccurs="1"/>
                        <xsd:element ref="OMEName" minOccurs="0" maxOccurs="1"/>

                    </xsd:sequence>
                    <xsd:sequence>
                        <xsd:element ref="LastName" minOccurs="1" maxOccurs="1"/>
                        <xsd:element ref="Email" minOccurs="0" maxOccurs="1"/>
                        <xsd:element ref="Institution" minOccurs="0" maxOccurs="1"/>
                        <xsd:element ref="OMEName" minOccurs="0" maxOccurs="1"/>
                    </xsd:sequence>
                    <xsd:sequence>

                        <xsd:element ref="Email" minOccurs="1" maxOccurs="1"/>

                        <xsd:element ref="Institution" minOccurs="0" maxOccurs="1"/>
                        <xsd:element ref="OMEName" minOccurs="0" maxOccurs="1"/>
                    </xsd:sequence>
                    <xsd:sequence>
                        <xsd:element ref="Institution" minOccurs="0" maxOccurs="1"/>
                        <xsd:element ref="OMEName" minOccurs="1" maxOccurs="1"/>
                    </xsd:sequence>

                </xsd:choice>
                <xsd:element ref="GroupRef" minOccurs="0" maxOccurs="unbounded"/>

            </xsd:sequence>
            <xsd:attribute name="ID" use="required" type="ExperimenterID"/>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="OMEName" type="xsd:string"> <!-- top level definition -->
        <xsd:annotation>

            <xsd:documentation>This is the username of the experimenter (in a 'unix' or 'database' sense).</xsd:documentation>
        </xsd:annotation>

    </xsd:element>
    <xsd:element name="FirstName" type="xsd:string"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>First name, optionally containing a middle initial.</xsd:documentation>
        </xsd:annotation>

    </xsd:element>
    <xsd:element name="LastName" type="xsd:string"> <!-- top level definition -->

        <xsd:annotation>
            <xsd:documentation>A person's last or surname.</xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    <xsd:element name="Email" type="xsd:string"> <!-- top level definition -->

        <xsd:annotation>
            <xsd:documentation>A person's  email address.</xsd:documentation>

        </xsd:annotation>
    </xsd:element>
    <xsd:element name="Objective"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>

                A description of the microscope's objective lens.
                Required elements include the lens numerical aperture, 
                and the magnification, both of which a floating 
                point (real) numbers.
                The values are those that are fixed for a particular 
                objective: either because it has been manufactured to 
                this specification or the value has been measured on 
                this particular objective.
                Correction: This is the type of correction coating applied to this lens.
                Immersion: This is the types of immersion medium the lens is designed to
                work with. It is not the same as 'Medium' in ObjectiveRef (a 
                single type) as here Immersion can have compound values like 'Multi'.
                LensNA: The numerical aperture of the lens (as a float)
                NominalMagnification: The specified magnification e.g. x10
                CalibratedMagnification: The measured magnification e.g. x10.3
                WorkingDistance: WorkingDistance of the lense. The Units are um.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>

            <xsd:complexContent>
                <xsd:extension base="ManufactSpec">
                    <xsd:sequence>
                        <xsd:sequence>
                            <xsd:element ref="Correction" minOccurs="1" maxOccurs="1"/>

                            <xsd:element ref="Immersion" minOccurs="1" maxOccurs="1"/>
                            <xsd:element ref="LensNA" minOccurs="0" maxOccurs="1"/>
                            <xsd:element ref="NominalMagnification" minOccurs="0" maxOccurs="1"/>
                            <xsd:element ref="CalibratedMagnification" minOccurs="0" maxOccurs="1"/>

                            <xsd:element ref="WorkingDistance" minOccurs="0" maxOccurs="1"/>
                        </xsd:sequence>
                    </xsd:sequence>
                    <xsd:attribute name="ID" use="required" type="ObjectiveID"/>

                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>
    <xsd:simpleType name="Medium"> <!-- top level definition -->

        <xsd:annotation>
            <xsd:documentation>
                A description of a Medium used for the lens.
            </xsd:documentation>

        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="Air"/>
            <xsd:enumeration value="Oil"/>
            <xsd:enumeration value="Water"/>

            <xsd:enumeration value="Glycerol"/>
        </xsd:restriction>
    </xsd:simpleType>

    
    <xsd:element name="Filter"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>
                A filter is either an excitation or emission filters.
                There should be one filter element specified per wavelength in the image.  
                The channel number associated with a filter set is specified in LogicalChannel's required ChannelComponent element and its Index attribute.
                It is based on the FilterSpec type, so has the required attributes Manufacturer, Model, and LotNumber.
                It may also contain a Type attribute which may be set to
                'LongPass', 'ShortPass', 'BandPass', or 'MultiPass'.
                It can be associated with an optional FilterWheel - Note: this is not the same as a FilterSet
            </xsd:documentation>
        </xsd:annotation>

        <xsd:complexType>
            <xsd:complexContent>

                <xsd:extension base="FilterSpec">
                <xsd:sequence>
                    <xsd:element ref="TransmittanceRange" minOccurs="0" maxOccurs="1"/>
                </xsd:sequence>
                    <xsd:attribute name="Type" use="optional">
                        <xsd:simpleType>
                            <xsd:restriction base="xsd:string">

                                <xsd:enumeration value="LongPass"/>

                                <xsd:enumeration value="ShortPass"/>
                                <xsd:enumeration value="BandPass"/>
                                <xsd:enumeration value="MultiPass"/>
                            </xsd:restriction>
                        </xsd:simpleType>
                    </xsd:attribute>
                    <xsd:attribute name="FilterWheel" use="optional" type="xsd:string" >
                    <xsd:annotation>

                        <xsd:documentation>
                            A filter 'wheel' in OME can refer to any arrangement of filters in a filter holder of any shape. It could, for example, be a filter slider.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
                <xsd:attribute name="ID" use="required" type="FilterID"/>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>

    </xsd:element>
    <xsd:element name="TransmittanceRange"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>
                CutIn Units: nm,
                CutOut Units: nm,
                CutInTolerance Units: nm,
                CutOutTolerance Units: nm,
                Transmittance Units: PercentFraction
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>

            <xsd:attribute name="CutIn" use="optional">
                <xsd:annotation>
                    <xsd:documentation>
                        CutIn is the wavelength below which there is less than 50% transmittance for a filter. Units: nm. Expected range 200 - 800 
                    </xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                    <xsd:restriction base="xsd:integer">
                        <xsd:minInclusive value="200"/>
                        <xsd:maxInclusive value="800"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="CutOut" use="optional">
                <xsd:annotation>

                    <xsd:documentation>
                        CutOut is the wavelength above which there is less than 50% transmittance for a filter. Units: nm. Expected range 200 - 800 
                    </xsd:documentation>
                </xsd:annotation>
                <xsd:simpleType>
                    <xsd:restriction base="xsd:integer">
                        <xsd:minInclusive value="200"/>
                        <xsd:maxInclusive value="800"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="CutInTolerance" use="optional" type="xsd:integer" />
            <xsd:attribute name="CutOutTolerance" use="optional" type="xsd:integer" />
            <xsd:attribute name="Transmittance" use="optional" type="PercentFraction" />
        </xsd:complexType>

    </xsd:element>
    
    <xsd:element name="NominalMagnification"> <!-- top level definition -->
            <xsd:annotation>

            <xsd:documentation>
                The magnification of the lens as specified by the manufacturer - i.e. '60' is a 60X lens. 
                Expected range 1 - 150        
            </xsd:documentation>
        </xsd:annotation>
        <xsd:simpleType>
            <xsd:restriction base="xsd:integer">
                <xsd:minInclusive value="1"/>
                <xsd:maxInclusive value="150"/>
            </xsd:restriction>
        </xsd:simpleType>
    </xsd:element>

    <xsd:element name="CalibratedMagnification"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>The magnification of the lens as measured by a calibration process- i.e. '59.987' for a 60X lens.
                Expected range 0.5 - 150    
            </xsd:documentation>
        </xsd:annotation>
        <xsd:simpleType>
            <xsd:restriction base="xsd:float">
                <xsd:minInclusive value="0.5"/>
                <xsd:maxInclusive value="150"/>
            </xsd:restriction>
        </xsd:simpleType>
    </xsd:element>
    <xsd:element name="Correction"> <!-- top level definition -->
        <xsd:annotation>

            <xsd:documentation>The coating applied to the lens</xsd:documentation>
        </xsd:annotation>
        <xsd:simpleType>
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="UV"/>

                <xsd:enumeration value="PlanApo"/>
                <xsd:enumeration value="PlanFluor"/>
                <xsd:enumeration value="SuperFluor"/>

                <xsd:enumeration value="VioletCorrected"/>
                <xsd:enumeration value="Unknown"/>
            </xsd:restriction>
        </xsd:simpleType>
    </xsd:element>
    <xsd:element name="Immersion"> <!-- top level definition -->

        <xsd:annotation>
            <xsd:documentation>The immersion medium the lens is designed for</xsd:documentation>

        </xsd:annotation>
        <xsd:simpleType>
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="Oil"/>
                <xsd:enumeration value="Water"/>
                <xsd:enumeration value="WaterDipping"/>

                <xsd:enumeration value="Air"/>
                <xsd:enumeration value="Multi"/>

                <xsd:enumeration value="Glycerol"/>
                <xsd:enumeration value="Other"/>
                <xsd:enumeration value="Unknown"/>
            </xsd:restriction>
        </xsd:simpleType>    
    </xsd:element>
    <xsd:element name="WorkingDistance"> <!-- top level definition -->

        <xsd:annotation>

            <xsd:documentation>The working distance of the lens expressed as a floating point (real) number. Units are um.
                Expected range 10 - 50000 (50mm)
                </xsd:documentation>
        </xsd:annotation>
        <xsd:simpleType>
            <xsd:restriction base="xsd:float">
                <xsd:minInclusive value="10"/>
                <xsd:maxInclusive value="50000"/>
            </xsd:restriction>
        </xsd:simpleType>
    </xsd:element>
    <xsd:element name="LensNA"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>
                The numerical aperture of the lens expressed as a floating point (real) number.
                Expected range 0.02 - 1.5
            </xsd:documentation>            
        </xsd:annotation>        
        <xsd:simpleType>
            <xsd:restriction base="xsd:float">
                <xsd:minInclusive value="0.02"/>
                <xsd:maxInclusive value="1.5"/>
            </xsd:restriction>
        </xsd:simpleType>
    </xsd:element>
    <xsd:element name="FilterSet"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>Filter set manufacturer specification</xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>

            <xsd:complexContent>

                <xsd:extension base="FilterSpec">
                    <xsd:attribute name="ExFilterRef" use="optional" type="FilterID" />
                    <xsd:attribute name="DichroicRef" use="optional" type="DichroicID"/>
                    <xsd:attribute name="EmFilterRef" use="optional" type="FilterID"/>
                    <xsd:attribute name="ID" use="required" type="FilterSetID"/>
                </xsd:extension>
            </xsd:complexContent>

        </xsd:complexType>
    </xsd:element>

    <xsd:element name="Detector"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>
                The type of detector used to capture the image.
                The Detector ID can be used as a reference within the LogicalChannel element in the Image element.
                The Type attribute can be set to 'CCD','Intensified-CCD','Analog-Video','PMT','Photodiode','Spectroscopy','Life-time-Imaging','Correlation-Spectroscopy','FTIR'.
                Added new types EM-CCD, APD, and CMOS - ajp
                Added new optional attributes AmplificationGain and Zoom - ajp
            </xsd:documentation>
        </xsd:annotation>

        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="ManufactSpec">

                    <xsd:attribute name="Gain" use="optional" type="xsd:float">
                        <xsd:annotation>
                            <xsd:documentation>
                                Gain is the fold increase in sensitivity? E.g. The readout from a single photon. Different devices have different inherent gain (e.g. PMT has a large inherent gain, whereas CCD has none).
                            </xsd:documentation>
                        </xsd:annotation>

                    </xsd:attribute>
                    <xsd:attribute name="Voltage" use="optional" type="xsd:float">
                        <xsd:annotation>
                            <xsd:documentation>
                                Voltage of the detector (PMT only?). Units are volts? 
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="Offset" use="optional" type="xsd:float"/>

                    <xsd:attribute name="Zoom" use="optional" type="xsd:float">
                        <xsd:annotation>
                            <xsd:documentation>
                                Added new optional attributes AmplificationGain and Zoom - ajp
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="AmplificationGain" use="optional" type="xsd:float">
                        <xsd:annotation>

                            <xsd:documentation>
                                This is the electronic gain (as apposed to the inherent gain) that is set for the detector. 
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="ID" use="required" type="DetectorID"/>
                    <xsd:attribute name="Type" use="required">
                        <xsd:simpleType>
                            <xsd:restriction base="xsd:string">

                                <xsd:enumeration value="CCD"/>
                                <xsd:enumeration value="IntensifiedCCD"/>
                                <xsd:enumeration value="AnalogVideo"/>
                                <xsd:enumeration value="PMT"/>
                                <xsd:enumeration value="Photodiode"/>
                                <xsd:enumeration value="Spectroscopy"/>
                                <xsd:enumeration value="LifetimeImaging"/>
                                <xsd:enumeration value="CorrelationSpectroscopy"/>

                                <xsd:enumeration value="FTIR"/>

                                <xsd:enumeration value="EM-CCD"/>
                                <xsd:enumeration value="APD"/>
                                <xsd:enumeration value="CMOS"/>
                                <xsd:enumeration value="Unknown"/>
                            </xsd:restriction>
                        </xsd:simpleType>
                    </xsd:attribute>

                </xsd:extension>
            </xsd:complexContent>

        </xsd:complexType>
    </xsd:element>
    <xsd:element name = "Description"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>
                Just some free-form text to describe Images, Screens and Projects.
                The content model is now String.
                This is no longer the correct place for an XML sub-document
                Either 
                - use CustomAttributes instead
                Or
                - define your own xml tree outside the OME node and link to the OME objects using references to the IDs
            </xsd:documentation>

        </xsd:annotation>
        <xsd:complexType>

            <xsd:simpleContent>
                <xsd:extension base = "xsd:string">
                    <xsd:attribute ref = "xml:lang" default = "en" use="optional"/>
                </xsd:extension>
            </xsd:simpleContent>
        </xsd:complexType>

    </xsd:element>
    <xsd:element name="Microscope"> <!-- top level definition -->

        <xsd:annotation>
            <xsd:documentation>The microscope's manufacturer specification.</xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:complexContent>

                <xsd:extension base="ManufactSpec">
                    <xsd:attribute name="Type" use="required">
                        <xsd:simpleType>

                            <xsd:restriction base="xsd:string">
                                <xsd:enumeration value="Upright"/>
                                <xsd:enumeration value="Inverted"/>
                                <xsd:enumeration value="Dissection"/>
                                <xsd:enumeration value="Electrophysiology"/>

                                <xsd:enumeration value="Unknown"/>
                            </xsd:restriction>
                        </xsd:simpleType>
                    </xsd:attribute>

                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>

    <xsd:complexType name="ManufactSpec">
        <xsd:attribute name="Manufacturer" use="optional" type="xsd:string"/>
        <xsd:attribute name="Model" use="optional" type="xsd:string"/>
        <xsd:attribute name="SerialNumber" use="optional" type="xsd:string"/>
    </xsd:complexType>

    <xsd:element name="Thumbnail"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>

                The thumbnail may be an external URI reference specified by the href attribute, or it may contain an SVG sub-document
                (denoted by the #wildCard 'element').
                The MIMEtype is a required attribute, and must be set to 'SVG' if the tag's contents are an SVG document.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
                <xsd:any namespace="http://www.w3.org/2000/svg" processContents="strict" minOccurs="0"/>

            </xsd:sequence>
            <xsd:attribute name="href" use="optional" type="xsd:anyURI"/>
            <xsd:attribute name="MIMEtype" use="required" type="MIMEtype"/>

        </xsd:complexType>
    </xsd:element>
    <xsd:element name="Project"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>

                The Project ID and Name attributes are required.
                Datasets can be grouped into projects using a many-to-many relationship.
                A Dataset may belong to one or more Projects by including one or more ProjectRef elements which refer to Project IDs.
                Projects do not directly contain images - only by virtue of containing datasets, which themselves contain images.
            </xsd:documentation>
        </xsd:annotation>

        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="Description" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ExperimenterRef" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="GroupRef" minOccurs="0" maxOccurs="1"/>
            </xsd:sequence>

            <xsd:attribute name="Name" use="optional" type="xsd:string"/>
            <xsd:attribute name="ID" use="required" type="ProjectID"/>

        </xsd:complexType>
    </xsd:element>
    <xsd:simpleType name="MIMEtype">
        <xsd:restriction base="xsd:string"/>
    </xsd:simpleType>
    <xsd:simpleType name="Hex40">
        <xsd:restriction base="xsd:hexBinary">

            <xsd:length value="20"/>

        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="MetalVaporLaserMedia">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="Cu"/>
            <xsd:enumeration value="Ag"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="ExcimerLaserMedia">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="ArFl"/>
            <xsd:enumeration value="ArCl"/>
            <xsd:enumeration value="KrFl"/>
            <xsd:enumeration value="KrCl"/>
            <xsd:enumeration value="XeFl"/>
            <xsd:enumeration value="XeCl"/>
            <xsd:enumeration value="XeBr"/>

        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="GasLaserMedia">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="N"/>
            <xsd:enumeration value="Ar"/>
            <xsd:enumeration value="Kr"/>
            <xsd:enumeration value="Xe"/>

            <xsd:enumeration value="HeNe"/>

            <xsd:enumeration value="HeCd"/>
            <xsd:enumeration value="CO"/>
            <xsd:enumeration value="CO2"/>
            <xsd:enumeration value="H2O"/>
            <xsd:enumeration value="HFl"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="SolidStateLaserMedia">
        <xsd:restriction base="xsd:string">

            <xsd:enumeration value="NdGlass"/>
            <xsd:enumeration value="NdYAG"/>
            <xsd:enumeration value="ErGlass"/>
            <xsd:enumeration value="ErYAG"/>
            <xsd:enumeration value="HoYLF"/>
            <xsd:enumeration value="HoYAG"/>

            <xsd:enumeration value="Ruby"/>
            <xsd:enumeration value="TiSapphire"/>
            <xsd:enumeration value="Alexandrite"/>

        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="DyeLaserMedia">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="Rhodamine6G"/>

            <xsd:enumeration value="CoumarinC30"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="SemiconductorLaserMedia">

        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="GaAs"/>
            <xsd:enumeration value="GaAlAs"/>
        </xsd:restriction>

    </xsd:simpleType>
    <xsd:simpleType name="FreeElectronLaserMedia">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="EMinus"/>
        </xsd:restriction>

    </xsd:simpleType>
    <xsd:simpleType name="UnknownLaserMedia">
        <xsd:restriction base="xsd:string">

            <xsd:enumeration value="Unknown"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="LaserMedia">
        <xsd:union memberTypes="MetalVaporLaserMedia ExcimerLaserMedia GasLaserMedia SolidStateLaserMedia DyeLaserMedia SemiconductorLaserMedia FreeElectronLaserMedia UnknownLaserMedia"/>
    </xsd:simpleType>

    <xsd:simpleType name="PercentFraction">
        <xsd:restriction base="xsd:float">

            <xsd:maxInclusive value="1.0"/>
            <xsd:minInclusive value="0.0"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="LSID">
        <xsd:annotation>
            <xsd:documentation>

                Either LSID or internal consistent IDs for the file - ajp
                To Do - Put in some samples of valid lsid and internal ID - ajp
            </xsd:documentation>

        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:\S+:\S+)|(\S+:\S+)"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="UniversallyUniqueIdentifier">
        <xsd:annotation>

            <xsd:documentation>

                This is a unique ID for the file but does not conform to the ID pattern used in the rest of the file.
                The rest of the IDs are either an full LSID or an internal ID which is a string that is simply unique in this file.
                As the UniversallyUniqueIdentifier is used from outside this file to identify it having the same ID in another file could cause problems.
                A UUID is 32 hexadecimal digits, in 5 groups, 8-4-4-4-12, separated by hyphens
                e.g. urn:uuid:3e450fae-b8f2-4d35-aa54-702168b2487f
                There are methods to generate these in most modern languages.
                http://www.ietf.org/rfc/rfc4122.txt
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:anyURI">
            <xsd:pattern value="(urn:uuid:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="ProjectID">

        <xsd:restriction base="LSID">

            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:Project:\S+)|(Project:\S+)"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="DatasetID">
        <xsd:restriction base="LSID">
            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:Dataset:\S+)|(Dataset:\S+)"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="ImageID">
        <xsd:restriction base="LSID">
            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:Image:\S+)|(Image:\S+)"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="RegionID">
        <xsd:restriction base="LSID">
            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:Region:\S+)|(Region:\S+)"/>
        </xsd:restriction>

    </xsd:simpleType>
    <xsd:simpleType name="ExperimenterID">
        <xsd:restriction base="LSID">
            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:Experimenter:\S+)|(Experimenter:\S+)"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="GroupID">
        <xsd:restriction base="LSID">

            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:Group:\S+)|(Group:\S+)"/>

        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="ExperimentID">
        <xsd:restriction base="LSID">
            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:Experiment:\S+)|(Experiment:\S+)"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="MicrobeamManipulationID">
        <xsd:restriction base="LSID">

            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:MicrobeamManipulation:\S+)|(MicrobeamManipulation:\S+)"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="ROIID">
        <xsd:restriction base="LSID">
            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:ROI:\S+)|(ROI:\S+)"/>

        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="ShapeID">

        <xsd:restriction base="LSID">
            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:ROI:\S+)|(Shape:\S+)"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="InstrumentID">

        <xsd:restriction base="LSID">
            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:Instrument:\S+)|(Instrument:\S+)"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="ObjectiveID">
        <xsd:restriction base="LSID">
            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:Objective:\S+)|(Objective:\S+)"/>
        </xsd:restriction>

    </xsd:simpleType>
    <xsd:simpleType name="LightSourceID">
        <xsd:restriction base="LSID">
            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:LightSource:\S+)|(LightSource:\S+)"/>
        </xsd:restriction>

    </xsd:simpleType>
    <xsd:simpleType name="DichroicID">
        <xsd:restriction base="LSID">

            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:Dichroic:\S+)|(Dichroic:\S+)"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="FilterID">
        <xsd:restriction base="LSID">
            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:Filter:\S+)|(Filter:\S+)"/>

        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="FilterSetID">
        <xsd:restriction base="LSID">
            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:FilterSet:\S+)|(FilterSet:\S+)"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="OTFID">
        <xsd:restriction base="LSID">

            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:OTF:\S+)|(OTF:\S+)"/>

        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="DetectorID">
        <xsd:restriction base="LSID">
            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:Detector:\S+)|(Detector:\S+)"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="PixelsID">

        <xsd:restriction base="LSID">
            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:Pixels:\S+)|(Pixels:\S+)"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="DisplayOptionsID">
        <xsd:restriction base="LSID">
            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:DisplayOptions:\S+)|(DisplayOptions:\S+)"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="LogicalChannelID">
        <xsd:restriction base="LSID">
            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:LogicalChannel:\S+)|(LogicalChannel:\S+)"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="PixelTypes">
        <xsd:restriction base="xsd:string">
                <xsd:enumeration value = "int8"/>

                <xsd:enumeration value = "int16"/>

                <xsd:enumeration value = "int32"/>
                <xsd:enumeration value = "uint8"/>
                <xsd:enumeration value = "uint16"/>
                <xsd:enumeration value = "uint32"/>
                <xsd:enumeration value = "float"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="ExtendedPixelTypes">
        <xsd:union memberTypes="PixelTypes">

            <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                    <xsd:enumeration value = "bit"/>
                    <xsd:enumeration value = "double"/>
                    <xsd:enumeration value = "complex"/>
                    <xsd:enumeration value = "double-complex"/>

                </xsd:restriction>
            </xsd:simpleType>
        </xsd:union>

    </xsd:simpleType>
    <xsd:simpleType name="ModuleID">
        <xsd:restriction base="LSID">
            <xsd:pattern value="(urn:lsid:([\w\-\.]+\.[\w\-\.]+)+:Module:\S+)|(Module:\S+)"/>
        </xsd:restriction>

    </xsd:simpleType>
    <xsd:element name="ProjectRef"> <!-- top level definition -->
        <xsd:annotation>

            <xsd:documentation>
                There may be one or more of these in a Dataset.
                This empty element has a required Project ID attribute that refers to Projects defined within the OME element.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>

            <xsd:complexContent>
                <xsd:extension base="Reference">
                    <xsd:attribute name="ID" use="required" type="ProjectID"/>
                </xsd:extension>

            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="ExperimenterRef"> <!-- top level definition -->

        <xsd:annotation>
            <xsd:documentation>
                This empty element has a required Experimenter ID and an optional DocumentID attribute which refers to one of the Experimenters defined within OME.
            </xsd:documentation>
        </xsd:annotation>

        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="Reference">
                    <xsd:attribute name="ID" use="required" type="ExperimenterID"/>

                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="Group"> <!-- top level definition -->

        <xsd:annotation>
            <xsd:documentation>
                The Group ID and Name attributes are required.
                Contact information should be specified for the leader of the group and a contact person.
                The Leader and/or Contact are themselves experimenters defined in OME, but they need not have OMENames.
            </xsd:documentation>

        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="Leader" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="Contact" minOccurs="0" maxOccurs="1"/>

            </xsd:sequence>
            <xsd:attribute name="Name" use="optional" type="xsd:string"/>
            <xsd:attribute name="ID" use="required" type="GroupID"/>

        </xsd:complexType>
    </xsd:element>
    <xsd:element name="Leader"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>

                Contact information for a Group leader specified using a reference to an Experimenter element defined elsewhere in the document.
            </xsd:documentation>
        </xsd:annotation>

        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="Reference">
                    <xsd:attribute name="ID" use="required" type="ExperimenterID"/>
                </xsd:extension>
            </xsd:complexContent>

        </xsd:complexType>
    </xsd:element>

    <xsd:element name="Contact"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>
                The Contact element describes the contact person for a group of experimenters - typically a project leader or lab manager.
                This person is specified as a reference to an OME experimenter.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>

            <xsd:complexContent>

                <xsd:extension base="Reference">
                    <xsd:attribute name="ID" use="required" type="ExperimenterID"/>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="GroupRef"> <!-- top level definition -->

        <xsd:annotation>

            <xsd:documentation>This empty element has a reference (the Group ID attribute) to a Group defined within OME.</xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="Reference">
                    <xsd:attribute name="ID" use="required" type="GroupID"/>
                </xsd:extension>

            </xsd:complexContent>

        </xsd:complexType>
    </xsd:element>
    <xsd:element name="InstrumentRef"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>
                This empty element can be used (via the required Instrument ID attribute) to refer to an Instrument defined within OME.
            </xsd:documentation>
        </xsd:annotation>

        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="Reference">
                    <xsd:attribute name="ID" use="required" type="InstrumentID"/>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="Institution" type="xsd:string"> <!-- top level definition -->

        <xsd:annotation>
            <xsd:documentation>
                The organizing structure that people belong to other than groups.  A university, or company, etc.
                We do not specify a department element, and do not mean for Institution to be used in this way.
                We simply wish to say XXX at YYY.  Where YYY has a better chance of being tied to a geographically fixed location
                and of being more recognizable than a group of experimenters. 
            </xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    <xsd:element name="Dichroic"> <!-- top level definition -->
        <xsd:annotation>

            <xsd:documentation>The dichromatic beamsplitter or dichroic mirror used for this filter combination.</xsd:documentation>

        </xsd:annotation>
        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="FilterSpec">
                    <xsd:attribute name="ID" use="required" type="DichroicID"/>
                </xsd:extension>
            </xsd:complexContent>

        </xsd:complexType>
    </xsd:element>

    <xsd:element name="ROI"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>
                A four dimensional 'Region of Interest'.  The Z and T coordinates are optional.
                If they are not used, and the Image has more than one plane,
                the entire set of planes is assumed to be included in the ROI.
                Multiple ROIs may be specified.
                Added ID - ajp
            </xsd:documentation>
        </xsd:annotation>

        <xsd:complexType>
            <xsd:choice minOccurs="1" maxOccurs="1">
                <xsd:element name="Union" minOccurs="1" maxOccurs="1">

                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element ref="Shape" minOccurs="1" maxOccurs="unbounded"/>
                        </xsd:sequence>
                    </xsd:complexType>

                </xsd:element>
            </xsd:choice>
            <xsd:attribute name="ID" use="required" type="ROIID"/>
        </xsd:complexType>

    </xsd:element>
    <xsd:element name="Shape"> <!-- top level definition -->
        <xsd:complexType>
            <xsd:sequence>

                <xsd:element name="Channels" minOccurs="0" maxOccurs="1">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element ref="LogicalChannelRef" minOccurs="1" maxOccurs="unbounded"></xsd:element>

                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:choice minOccurs="1" maxOccurs="1">

                    <xsd:element ref="Rect" minOccurs="1" maxOccurs="1"/>
                    <xsd:element ref="Mask" minOccurs="1" maxOccurs="1"/>
                    <xsd:element ref="Ellipse" minOccurs="1" maxOccurs="1"/>
                    <xsd:element ref="Circle" minOccurs="1" maxOccurs="1"/>
                    <xsd:element ref="Point" minOccurs="1" maxOccurs="1"/>

                    <xsd:element ref="Polygon" minOccurs="1" maxOccurs="1"/>
                    <xsd:element ref="Polyline" minOccurs="1" maxOccurs="1"/>
                    <xsd:element ref="Line" minOccurs="1" maxOccurs="1"/>

                </xsd:choice>
            </xsd:sequence>
            <xsd:attribute name="ID" use="required" type="ShapeID"/>
            <xsd:attribute name="theZ" use="optional" type="xsd:integer"/>
            <xsd:attribute name="theT" use="optional" type="xsd:integer"/>
        </xsd:complexType>

    </xsd:element>
    <xsd:complexType name="BasicSvgShape">

        <xsd:attribute name="transform" use="optional"/>
    </xsd:complexType>
    <xsd:element name="Rect"> <!-- top level definition -->
        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="BasicSvgShape">

                    <xsd:attribute name="x" use="optional" type="xsd:string"/>
                    <xsd:attribute name="y" use="optional" type="xsd:string"/>

                    <xsd:attribute name="width" use="optional" type="xsd:string"/>
                    <xsd:attribute name="height" use="optional" type="xsd:string"/>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>
    
    <xsd:element name="Mask"> <!-- top level definition -->

        <xsd:complexType>

            <xsd:complexContent>
                <xsd:extension base="BasicSvgShape">
                    <xsd:sequence>
                        <xsd:element ref="MaskPixels" minOccurs="1" maxOccurs="1"/>
                    </xsd:sequence>
                    <xsd:attribute name="x" use="optional" type="xsd:string"/>
                    <xsd:attribute name="y" use="optional" type="xsd:string"/>
                    <xsd:attribute name="width" use="optional" type="xsd:string"/>

                    <xsd:attribute name="height" use="optional" type="xsd:string"/>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="MaskPixels"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>

            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
                <xsd:choice minOccurs="1" maxOccurs="1">
                    <xsd:element ref="Bin:BinData" minOccurs="1" maxOccurs="unbounded"/>
                    <xsd:element ref="TiffData" minOccurs="1" maxOccurs="unbounded"/>
                </xsd:choice>

            </xsd:sequence>

                <xsd:attribute name="ExtendedPixelType" use="required" type="ExtendedPixelTypes"/>
            <xsd:attribute name="BigEndian" use="required" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>This is true if the pixel data was written in BigEndian order. This is dependent on the system architecture of the machine that wrote the pixels. True for essentially all modern CPUs other than Intel and Alpha. All pixel data must be written in the same endian order.</xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="SizeX" use="required" type="xsd:positiveInteger">

                <xsd:annotation>

                    <xsd:documentation>Dimensional size of pixel data array</xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="SizeY" use="required" type="xsd:positiveInteger">
                <xsd:annotation>
                    <xsd:documentation>Dimensional size of pixel data array</xsd:documentation>

                </xsd:annotation>
            </xsd:attribute>

        </xsd:complexType>
    </xsd:element>
    
    <xsd:element name="Circle"> <!-- top level definition -->
        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="BasicSvgShape">

                    <xsd:attribute name="cx" use="optional" type="xsd:string"/>
                    <xsd:attribute name="cy" use="optional" type="xsd:string"/>

                    <xsd:attribute name="r" use="optional" type="xsd:string"/>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>
    
    <xsd:element name="Point"> <!-- top level definition -->

        <xsd:complexType>
            <xsd:complexContent>

                <xsd:extension base="BasicSvgShape">
                    <xsd:attribute name="cx" use="optional" type="xsd:string"/>
                    <xsd:attribute name="cy" use="optional" type="xsd:string"/>
                    <xsd:attribute name="r" use="optional" type="xsd:string"/>
                </xsd:extension>
            </xsd:complexContent>

        </xsd:complexType>
    </xsd:element>
    
    <xsd:element name="Ellipse"> <!-- top level definition -->

        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="BasicSvgShape">
                    <xsd:attribute name="cx" use="optional" type="xsd:string"/>
                    <xsd:attribute name="cy" use="optional" type="xsd:string"/>

                    <xsd:attribute name="rx" use="optional" type="xsd:string"/>
                    <xsd:attribute name="ry" use="optional" type="xsd:string"/>
                </xsd:extension>
            </xsd:complexContent>

        </xsd:complexType>
    </xsd:element>
    
    <xsd:element name="Line"> <!-- top level definition -->
        <xsd:complexType>

            <xsd:complexContent>
                <xsd:extension base="BasicSvgShape">
                    <xsd:attribute name="x1" use="optional" type="xsd:string"/>
                    <xsd:attribute name="y1" use="optional" type="xsd:string"/>

                    <xsd:attribute name="x2" use="optional" type="xsd:string"/>
                    <xsd:attribute name="y2" use="optional" type="xsd:string"/>
                </xsd:extension>
            </xsd:complexContent>

        </xsd:complexType>
    </xsd:element>
    
    <xsd:element name="Polyline"> <!-- top level definition -->
        <xsd:complexType>

            <xsd:complexContent>
                <xsd:extension base="BasicSvgShape">
                    <xsd:attribute name="points" use="optional" type="xsd:string"/>
                </xsd:extension>

            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>
    
    <xsd:element name="Polygon"> <!-- top level definition -->

        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="BasicSvgShape">
                    <xsd:attribute name="points" use="optional" type="xsd:string"/>

                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>
    
    <xsd:element name="ROIRef"> <!-- top level definition -->

        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="Reference">

                    <xsd:attribute name="ID" use="required" type="ROIID"/>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>
    
    <xsd:complexType name="FilterSpec">

        <xsd:annotation>
            <xsd:documentation>

                An element type specifying a filter specification.
                Unlike the ManufactSpec, filters are referred to by lot number rather than serial number.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:attribute name="Manufacturer" use="optional" type="xsd:string"/>
        <xsd:attribute name="Model" use="optional" type="xsd:string"/>
        <xsd:attribute name="LotNumber" use="optional" type="xsd:string"/>
    </xsd:complexType>

    <xsd:element name="LightSource"> <!-- top level definition -->

        <xsd:annotation>
            <xsd:documentation>
                The lightsource for the instrument.  An instrument may have several light sources.
                The type of lightsource is specified by one of the child-elements which are 'Laser', 'Filament', 'Arc' or 'LightEmittingDiode'.
                Each of the light source types has its own Type attribute to further differentiate the light source
                (eg, Nd-YAG for Laser or Hg for Arc).
                A LightSource ID must be specified for each light source,
                and the individual light sources can be referred to by their LightSource IDs (eg from LogicalChannel).
                Lasers may have a Pump sub-element which refers to another LightSource used as a laser pump.
                Moved Power into LightSource from Laser - ajp
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="ManufactSpec">

                    <xsd:choice minOccurs="1" maxOccurs="1">

                        <xsd:element ref="Laser" minOccurs="1" maxOccurs="1"/>
                        <xsd:element ref="Filament" minOccurs="1" maxOccurs="1"/>
                        <xsd:element ref="Arc" minOccurs="1" maxOccurs="1"/>
                        <xsd:element ref="LightEmittingDiode" minOccurs="1" maxOccurs="1"/>
                    </xsd:choice>
                    <xsd:attribute name="ID" use="required" type="LightSourceID"/>
                    <xsd:attribute name="Power" use="optional" type="xsd:float"/>
                </xsd:extension>

            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="OTF"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>
                The optical transfer function. FilterSetRef refers to the set of filters used in computing the OTF.
                BitsPerPixel is an integer '1', '8', '16'.
                The OpticalAxisAveraged is a boolean specifying whether or not optical axis averaging was done.
                SizeX, SizeY specify the width and height of the OTF.
                This element must contain a BinData element containing the Base64-encoded OTF.
                Both of these work the same way as they do for the Data element within Image.
            </xsd:documentation>
        </xsd:annotation>

        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="ObjectiveRef" minOccurs="1" maxOccurs="1"/>
                <xsd:element ref="FilterSetRef" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="Bin:BinaryFile" minOccurs="1" maxOccurs="1"/>
            </xsd:sequence>
            <xsd:attribute name="ID" use="required" type="OTFID"/>
            <xsd:attribute name="PixelType" use="required" type="ExtendedPixelTypes"/>

            <xsd:attribute name="OpticalAxisAveraged" use="required" type="xsd:boolean"/>

            <xsd:attribute name="SizeX" use="required" type="xsd:positiveInteger"/>
            <xsd:attribute name="SizeY" use="required" type="xsd:positiveInteger"/>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="Dataset"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>

                An element specifying a collection of images that are always processed together.
                Images can belong to more than one Dataset, and a Dataset may contain more than one Image.
                Images contain one or more DatasetRef elements to specify what datasets they belong to.
                Once a Dataset has been processed in any way, its collection of images cannot be altered.
                Whether or not the list of Images in this dataset can be altered is specified by the Locked attribute.
                The ExperimenterRef and GroupRef elements specify the person and group this Dataset belongs to.
                Projects may contain one or more Datasets, and Datasets may belong to one or more Projects.
                This relationship is specified by listing ProjectRef elements within the Dataset element.
            </xsd:documentation>

        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="Description" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ExperimenterRef" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="GroupRef" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ProjectRef" minOccurs="0" maxOccurs="unbounded"/>

                <xsd:element ref="CA:CustomAttributes" minOccurs="0" maxOccurs="1"/>
            </xsd:sequence>

            <xsd:attribute name="Name" use="optional" type="xsd:string"/>
            <xsd:attribute name="ID" use="required" type="DatasetID"/>
            <xsd:attribute name="Locked" default="false" use="optional" type="xsd:boolean"/>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="DatasetRef"> <!-- top level definition -->

        <xsd:annotation>
            <xsd:documentation>

                The DatasetRef element refers to a Dataset by specifying the Dataset ID attribute.
                One or more DatasetRef elements may be listed within the Image element to specify what Datasets
                the Image belongs to.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="Reference">
                    <xsd:attribute name="ID" use="required" type="DatasetID"/>

                </xsd:extension>
            </xsd:complexContent>

        </xsd:complexType>
    </xsd:element>
    <xsd:element name="ImagingEnvironment"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>The Temperature is in Celsius, AirPressure is in millibars, Humidity and CO2Percent are percent-fractions from 0.0 to 1.0.</xsd:documentation>

        </xsd:annotation>
        <xsd:complexType>
            <xsd:attribute name="Temperature" use="optional" type="xsd:float"/>

            <xsd:attribute name="AirPressure" use="optional" type="xsd:float"/>
            <xsd:attribute name="Humidity" use="optional" type="PercentFraction"/>
            <xsd:attribute name="CO2Percent" use="optional" type="PercentFraction"/>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="ChannelComponent"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>

                Logical Channels are composed of ChannelComponents.  The Index attribute is an index into the channel dimension of the 5-D pixel array.
                If the Logical Channel specified by LogicalChannel has a PhotometricInterpretation attribute, then the ColorDomain attribute specifies which color channel
                this ChannelComponent belongs to.  For example 'R' for an 'RGB' PhotometricInterpretation.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:attribute name="Pixels" use="required" type="PixelsID"/>

            <xsd:attribute name="ColorDomain" use="optional" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Specifies which component of Photometric Interpretation to map a channel component to. i.e. w/ RGB this could be 'R', 'G', 'B'
                        This can be null if a channel maps to a logical channel but is not included in the photometric interpretation.
                        If this was null then the channel specified would normally be ignored.
                    </xsd:documentation>

                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="Index" use="required" type="xsd:nonNegativeInteger">
                <xsd:annotation>

                    <xsd:documentation>An index into the channel dimension of the 5-D pixel array</xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
        </xsd:complexType>

    </xsd:element>
    <xsd:element name="Region"> <!-- top level definition -->
        <xsd:complexType>

            <xsd:sequence>
                <xsd:element ref="Region" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="CA:CustomAttributes" minOccurs="0" maxOccurs="1"/>
            </xsd:sequence>
            <xsd:attribute name="Tag" use="required" type="xsd:string"/>

            <xsd:attribute name="Name" use="optional" type="xsd:string"/>
            <xsd:attribute name="ID" use="required" type="RegionID"/>
        </xsd:complexType>

    </xsd:element>
    <xsd:complexType name="Reference">
        <xsd:annotation>
            <xsd:documentation>
                Reference is an empty complex type that is contained and extended by all the *Ref elements
                Each *Ref element defines an attribute named ID of simple type *ID and any other information that is needed
                Each simple type *ID is restricted to the base type LSID with an appropriate pattern
                -- ajp
            </xsd:documentation>

        </xsd:annotation>
    </xsd:complexType>
    <xsd:element name="Laser"> <!-- top level definition -->

        <xsd:annotation>
            <xsd:documentation>
                Laser types are specified using two attributes - the Type and the lasing medium (Medium).  Type is a string which may be set to:
                'Excimer','Gas','Metal Vapor','Solid State','Dye','Semiconductor', or 'Free Electron'.  The Medium attribute specifies the actual lasing medium
                for a given laser type (for example, 'Nd-YAG').  Additionally, the Wavelength (in nm), whether or not the laser is Tuneable, and any FrequencyMultiplication that may be specified.
                The Pulse attribute can be set to 'CW' (Continuous Wave),','Single','Q-Switched','Repetitive','Mode-Locked'.
                The Power attribute specifies the nominal laser power in watts.
                The Laser element may contain a Pump sub-element which refers to a LightSource used as a laser pump.
                Removed Power - ajp
                Added RepetitionRate - The is the rate in Hz at which the laser pulses. ajp
                Added PockelCell attribute - ajp
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>

            <xsd:sequence>
                <xsd:element ref="Pump" minOccurs="0" maxOccurs="1"/>
            </xsd:sequence>

            <xsd:attribute name="Type" use="required">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="Excimer"/>
                        <xsd:enumeration value="Gas"/>
                        <xsd:enumeration value="MetalVapor"/>

                        <xsd:enumeration value="SolidState"/>
                        <xsd:enumeration value="Dye"/>

                        <xsd:enumeration value="Semiconductor"/>
                        <xsd:enumeration value="FreeElectron"/>
                        <xsd:enumeration value="Unknown"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="LaserMedium" use="required" type="LaserMedia"/>

            <xsd:attribute name="Wavelength" use="optional" type="xsd:positiveInteger"/>

            <xsd:attribute name="FrequencyMultiplication" use="optional" type="xsd:positiveInteger"/>
            <xsd:attribute name="Tuneable" use="optional" type="xsd:boolean"/>
            <xsd:attribute name="Pulse" use="optional">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="CW"/>
                        <xsd:enumeration value="Single"/>
                        <xsd:enumeration value="QSwitched"/>

                        <xsd:enumeration value="Repetitive"/> 
                        <xsd:enumeration value="ModeLocked"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="PockelCell" use="optional" type="xsd:boolean"/>
            <xsd:attribute name="RepetitionRate" use="optional" type="xsd:float">
                <xsd:annotation>
                    <xsd:documentation>The is the rate in Hz at which the laser pulses if the Pulse type is 'Repetitive'
                    </xsd:documentation>

                </xsd:annotation>
            </xsd:attribute>
        </xsd:complexType>
    </xsd:element>
    
    <xsd:element name="Arc"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation>
                The Arc element is used to describe various kinds of Arc lamps - Hg, Xe, HgXe.
                The Power of the Arc is now stored in the LightSource.
            </xsd:documentation>

        </xsd:annotation>
        <xsd:complexType>
            <xsd:attribute name="Type" use="required">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="Hg"/>
                        <xsd:enumeration value="Xe"/>
                        <xsd:enumeration value="HgXe"/>

                        <xsd:enumeration value="Unknown"/>

                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="Filament"> <!-- top level definition -->
        <xsd:annotation>

            <xsd:documentation>

                The Filament element is used to describe various kinds of filament bulbs such as Incadescent or Halogen.
                The Power of the Filament is now stored in the LightSource.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:attribute name="Type" use="required">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="Incandescent"/>

                        <xsd:enumeration value="Halogen"/>

                        <xsd:enumeration value="Unknown"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="LightEmittingDiode"> <!-- top level definition -->

        <xsd:annotation>

            <xsd:documentation>
                The LightEmittingDiode element is used to describe
                various kinds of LED lamps.
            </xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    <xsd:element name="LightSourceRef"> <!-- top level definition -->
        <xsd:complexType>

            <xsd:complexContent>
                <xsd:extension base="Reference">

                    <xsd:attribute name="ID" use="required" type="LightSourceID"/>
                    <xsd:attribute name="Attenuation" use="optional" type="PercentFraction"/>
                    <xsd:attribute name="Wavelength" use="optional" type="xsd:positiveInteger"/>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>

    </xsd:element>
    <xsd:element name="FilterSetRef"> <!-- top level definition -->

        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="Reference">
                    <xsd:attribute name="ID" use="required" type="FilterSetID"/>
                </xsd:extension>
            </xsd:complexContent>

        </xsd:complexType>
    </xsd:element>
    <xsd:element name="OTFRef"> <!-- top level definition -->

        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="Reference">
                    <xsd:attribute name="ID" use="required" type="OTFID"/>
                </xsd:extension>

            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="DetectorRef"> <!-- top level definition -->

        <xsd:annotation>
            <xsd:documentation>
                Added Voltage - ajp
                Added ReadOutRate units of MHz - ajp
            </xsd:documentation>

        </xsd:annotation>
        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="Reference">
                    <xsd:attribute name="ID" use="required" type="DetectorID"/>

                    <xsd:attribute name="Offset" use="optional" type="xsd:float"/>
                    <xsd:attribute name="Gain" use="optional" type="xsd:float"/>
                    <xsd:attribute name="Voltage" use="optional" type="xsd:float"/>

                    <xsd:attribute name="ReadOutRate" use="optional" type="xsd:float">
                        <xsd:annotation><xsd:documentation>The speed at which the detector can count pixels. Units of ReadOutRate is MHz. This is the bytes per second that can be read from the detector (like a baud rate). </xsd:documentation></xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="Binning" use="optional" type="Binning">
                        <xsd:annotation><xsd:documentation>Represents the number of pixels that are combined to form larger pixels.</xsd:documentation></xsd:annotation>

                    </xsd:attribute>
                </xsd:extension>

            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>
    <xsd:simpleType name="Binning">
        <xsd:annotation>
            <xsd:documentation>
                Predefined list of values for the number of pixels that can be combined to form larger pixels.
            </xsd:documentation>

        </xsd:annotation>

        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="1x1"/>
            <xsd:enumeration value="2x2"/>
            <xsd:enumeration value="4x4"/>
            <xsd:enumeration value="8x8"/>
        </xsd:restriction>
    </xsd:simpleType>    
    <xsd:element name="Pump"> <!-- top level definition -->

        <xsd:annotation>
            <xsd:documentation>
                The Pump element is a reference to a LightSource.  It is used within the Laser element to specify the light source for the laser's pump (if any).
            </xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="Reference">
                    <xsd:attribute name="ID" use="required" type="LightSourceID"/>

                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="ObjectiveRef"> <!-- top level definition -->
        <xsd:annotation>
            <xsd:documentation> 
                This holds the setting applied to an objective as well as a
                reference to the objective. 
                The ID is the objective used in this case.
                The CorrectionCollar is it normal an adjustable ring on the 
                objective. Each has an arbitrary scale on it so the values 
                is unit-less.
                The Medium is the actual immersion medium used in this case.
                The RefractiveIndex is that of the immersion medium. This is
                a ratio so it also unit-less.
            </xsd:documentation>

        </xsd:annotation>
        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="Reference">
                    <xsd:attribute name="ID" use="required" type="ObjectiveID"/>
                    <xsd:attribute name="CorrectionCollar" use="optional" type="xsd:float"/>
                    <xsd:attribute name="Medium" use="optional" type="Medium"/>
                    <xsd:attribute name="RefractiveIndex" use="optional" type="xsd:float">

                        <xsd:annotation><xsd:documentation>This is unit-less, it is a ratio.</xsd:documentation></xsd:annotation>

                    </xsd:attribute>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>
    <xsd:complexType name="ChannelSpecType">
        <xsd:attribute name="ChannelNumber" use="required" type="xsd:integer">

            <xsd:annotation>
                <xsd:documentation>Specifies the channel number in the pixel dump.  Channels are numbered from 0.</xsd:documentation>

            </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="BlackLevel" use="required" type="xsd:float">
            <xsd:annotation>
                <xsd:documentation>The black level is used to scale pixel values to an 8 bit colorspace for display. For example, a 16 bit pixel value must be downscaled to fit an 8 bit display. 
Any pixel value below the black value will be set to the minimum value of the scale range (0). 
Because the file schema offers support for non-integer pixel types, this is stored as a floating point number to offer maximum generality. Specifying a decimal value for an integer pixel type is ill defined.
Valid range of values for black level is less than the white level and within the data range for the pixel type.
                </xsd:documentation>

            </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="WhiteLevel" use="required" type="xsd:float">

            <xsd:annotation>
                <xsd:documentation>The white level is used  to scale pixel values to an 8 bit colorspace for display. For example, a 16 bit pixel value must be downscaled to fit an 8 bit display. 
Any pixel value above the white value will be set to the maximum value of the scale range (255). 
Because the file schema offers support for non-integer pixel types, this is stored as a floating point number to offer maximum generality. Specifying a decimal value for an integer pixel type is ill defined.
The valid range for white level is greater than the black level and within the data range for the pixel type.
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="Gamma" use="optional" type="xsd:float"/>

        <xsd:attribute name="isOn" use="optional" type="xsd:boolean"/>
    </xsd:complexType>
</xsd:schema>
