[ome-users] converting big ndpi-files
MEYENHOFER Felix
felix.meyenhofer at unifr.ch
Thu Oct 1 16:35:34 BST 2015
Hi Melissa
thanks for the help.
> On 28 Sep 2015, at 15:57 , Melissa Linkert <melissa at GLENCOESOFTWARE.COM> wrote:
>
> Hi Felix,
>
>> I looked around a bit more and tried
>> Metadata outMeta = service.createOMEXMLMetadata(inMeta.dumpXML());
>> This seems to do a deep copy of the metadata. But this also copies everything. So I tried to find a way to select the metadata of a single series. The way I came up with so far is to use the getter methods for the different attributes to retrieve the information and then use the setters on the output metadata.
>> However there are many attributes and soon we run into the trouble of having to figure out for instance the experimenter index before being able to retrieve the information.
>
> The easiest thing to do is to copy everything, and then remove what you
> don't want. An example of this starts here:
>
> https://github.com/openmicroscopy/bioformats/blob/develop/components/bio-formats-plugins/src/loci/plugins/out/Exporter.java#L344
>
> and more concisely would look something like:
>
> // ---
>
> OMEXMLMetadata outMeta = service.createOMEXMLMetadata(inMeta.dumpXML());
> OMEXMLMetadataRoot root = (OMEXMLMetadataRoot) outMeta.getRoot();
> int seriesToKeep = 0; // change this to however you're selecting the series
> List<Image> alLImages = root.copyImageList();
> for (int i=0; i<allImages.size(); i++) {
> if (i != seriesToKeep) {
> root.removeImage(allImages.get(i));
> }
> }
> outMeta.setRoot(root);
That is what I was looking for.
So re-parsing is the only way to create a new independent store?
Best,
Felix
More information about the ome-users
mailing list