Page 1 of 1

Problem adding ChannelAnnotationRef

PostPosted: Thu Oct 30, 2014 12:59 pm
by gyellen
hi -
I can setImageAnnotationRef's fine, but using the same type of code, if I setChannelAnnotationRef to a legal DoubleAnnotation, it does not show up in the XML.

This is using Bio-Formats from MATLAB to write an OME-TIFF (using Bio-Formats for the XML and MATLAB's Tiff() class for the Tiff writing itself). Otherwise, my export is now working and with no xmlvalid errors; it gets imported fine into both ImageJ2 and OMERO.

Thanks,
Gary

Re: Problem adding ChannelAnnotationRef

PostPosted: Fri Oct 31, 2014 9:20 am
by sbesson
Hi Gary,

thanks for the feedback. Would it be possible for you to share either the code or write a minimal test showing us the failure?

Best,
Sebastien

Re: Problem adding ChannelAnnotationRef

PostPosted: Fri Oct 31, 2014 1:41 pm
by sbesson
Hi Gary,

as an example, the following code should create an image with 2 channels and one of them annotated with a double annotation.

Code: Select all
java.lang.System.setProperty('javax.xml.transform.TransformerFactory', 'com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl');
output = '/tmp/test.ome.tiff';
delete(output);

I=zeros(100,100,1,2,1);
% Create a metadata object with a double annotation linked to the first channel
m=createMinimalOMEXMLMetadata(I);
m.setDoubleAnnotationID('Annotation:0', 0);
m.setDoubleAnnotationValue(java.lang.Double(100), 0);
m.setChannelAnnotationRef('Annotation:0', 0, 0, 0);

bfsave(I, output, 'metadata', m);

% Check the xml comment and run the validator
comment = loci.formats.tiff.TiffParser(output).getComment();
xmlValidate = loci.formats.tools.XMLValidate();
xmlValidate.process(output, java.io.BufferedReader(java.io.StringReader(comment)));


The annotation definitely shows up in the XML comment in this case.

Best,
Sebastien