ome / ome-model

OME model (specification, code generator, implementation)
Other
13 stars 25 forks source link

OriginalMetadata from 2003-FC lost in transform process #142

Closed dgault closed 3 years ago

dgault commented 3 years ago

Issue is a follow up to image.sc thread https://forum.image.sc/t/bio-formats-returns-all-metadata-except-ome-meta-data/52295/2

Using the sample file provided in the thread and correcting validation errors shows that the original metadata (stored in 2003-FC spec) gets lost when going through the transform update process. The particular transform the issue occurs with is 2008-09-to-2009-09.xsl

The data that gets lost is stored using the OriginalMetadata tag such as below (adding the CA namespace didn't resolve the issue):

<CustomAttributes>
<OriginalMetadata ID="OriginalMetadata:3" Name="Acquisition Parameters/Channel 2" Value="Fluorescence"/>
</CustomAttributes>

In the transform this should be handled by the following, transforming the metadata to an XMLAnnotation:

  <xsl:template match="CA:*">
    <xsl:element name="{name()}" namespace="{$newCANS}">
      <xsl:apply-templates select="@*|node()"/>
    </xsl:element>
  </xsl:template>

  <!-- Transform the CustomAttributes into XMLAnnotation -->
  <xsl:template match="CA:CustomAttributes">
    <xsl:if test="count(@*|node()) &gt; 0">
      <xsl:element name="StructuredAnnotations" namespace="{$newSANS}">
        <xsl:element name="XMLAnnotation" namespace="{$newSANS}">
          <xsl:attribute name="ID">Annotation:1</xsl:attribute>
          <xsl:element name="Value" namespace="{$newSANS}">
            <xsl:apply-templates select="@*|node()"/>
          </xsl:element>
        </xsl:element>
      </xsl:element>
    </xsl:if>
  </xsl:template>
imagesc-bot commented 3 years ago

This issue has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/bio-formats-returns-all-metadata-except-ome-meta-data/52295/11

dgault commented 3 years ago

As a follow up to this a PR has been opened which aims to resolve this bug (https://github.com/ome/ome-model/pull/144) along with some new unit tests showing the original failure (https://github.com/ome/bioformats/pull/3695).