We're Hiring!

Problem adding ChannelAnnotationRef

Historical discussions about the Bio-Formats library. Please look for and ask new questions at https://forum.image.sc/tags/bio-formats
Please note:
Historical discussions about the Bio-Formats library. Please look for and ask new questions at https://forum.image.sc/tags/bio-formats

If you are having trouble with image files, there is information about reporting bugs in the Bio-Formats documentation. Please send us the data and let us know what version of Bio-Formats you are using. For issues with your code, please provide a link to a public repository, ideally GitHub.

Problem adding ChannelAnnotationRef

Postby gyellen » Thu Oct 30, 2014 12:59 pm

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
gyellen
 
Posts: 24
Joined: Fri Oct 24, 2014 1:19 am

Re: Problem adding ChannelAnnotationRef

Postby sbesson » Fri Oct 31, 2014 9:20 am

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
User avatar
sbesson
Team Member
 
Posts: 421
Joined: Tue Feb 28, 2012 7:20 pm

Re: Problem adding ChannelAnnotationRef

Postby sbesson » Fri Oct 31, 2014 1:41 pm

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
User avatar
sbesson
Team Member
 
Posts: 421
Joined: Tue Feb 28, 2012 7:20 pm


Return to User Discussion [Legacy]

Who is online

Users browsing this forum: Google [Bot] and 1 guest