Page 1 of 1

saving the Global Metadata

PostPosted: Mon Jun 07, 2010 3:31 pm
by bhcho
Hi All,

Is there any API method that can save the original Global Metadata from TIFF file, when I conver a TIFF image to OME-TIFF?

Thanks in advance.

BK

Re: saving the Global Metadata

PostPosted: Wed Jun 09, 2010 8:11 pm
by mlinkert
Is there any API method that can save the original Global Metadata from TIFF file, when I conver a TIFF image to OME-TIFF?


Try something like this:

Code: Select all
  IFormatReader reader = new ImageReader();
  IMetadata metadata = MetadataTools.createOMEXMLMetadata();
  reader.setOriginalMetadataPopulated(true);
  reader.setMetadataStore(metadata);
  reader.setId("/path/to/input/file");

  IFormatWriter writer = new ImageWriter();
  writer.setMetadataRetrieve(metadata);
  // calls to writer.saveBytes go here...

Re: saving the Global Metadata

PostPosted: Thu Jun 10, 2010 2:11 pm
by bhcho
The only difference with my code is
reader.setOriginalMetadataPopulated(true);


But even if I include that code, It still does not work.
(Anyway, createOMEXMLMetadata() in loci.formats.MetadataTools has been deprecated. So I just used OMEXMLService instead of MetadataTools).