Add a new information to metadata

14 views
Skip to first unread message

John leger

unread,
Jan 23, 2015, 5:11:10 AM1/23/15
to icy-so...@googlegroups.com
Hi,

I would like to add some informations used by my plugin inside bio-formats, as there is not a dedicated slot for me I thought to put it as a:


CommentAnnotationValue or ImageDescription


But when I set my value, Icy add a slot description with no information and nothing is saved in the xml file.

To set the information:

OMEXMLMetadataImpl newMetdat = OMEUtil.createOMEMetadata(sequence.getMetadata());
newMetdat
.setImageDescription("MyDescription", 0);
newSequence
.setMetaData(newMetdat);

Thanks for any answer.

Capture.png

Stephane

unread,
Jan 30, 2015, 6:16:05 AM1/30/15
to icy-so...@googlegroups.com
Hi John,

Actually the metadata value is correctly entered even if you don't see it in the Metadata view which only display "children nodes".
If you write :

value = sequence.getMetaData().getImageDescription(0);

You will recover your data :)
Note that you're actually modify the OME XML Metadata and not the Icy persistence metadata, it's why you don't get it in the attached xml file. The OME XML Metadata are directly saved into the image file and so if you want to save them you explicitly have to save the image (by using save command and choosing the tif format).
If you want to use the Icy XML persistent data, just use this piece of code instead :

node = sequence.getNode("description");
XMLUtil.setValue(node, "my value");

then to get value back :

node = sequence.getNode("description");
value
= XMLUtil.getValue(node, ""));

In this case, you don't have to save anything, Icy will automatically save it in the attached XML file when you will close the image.

Best,

- Stephane
Reply all
Reply to author
Forward
0 new messages