Page 2 of 3

Re: Upload/Download OME-Tiff

PostPosted: Tue Jan 17, 2012 9:18 am
by JakeNewman
Thanks for replying. I have loaded my omero_client.jar into Netbeans and the ome.formats package is definitely not there. I could be using the wrong version, I suppose.

Re: Upload/Download OME-Tiff

PostPosted: Tue Jan 17, 2012 9:32 am
by cxallan
Where did you get the JAR and which version of OMERO are you attempting to use?

Re: Upload/Download OME-Tiff

PostPosted: Tue Jan 17, 2012 10:52 am
by JakeNewman
I had to import omero_client.jar and jar_0.jar to get it to find the class.

Our Omero server is version 4.2.2. I get an error about the XML now - Doesn't look like it can be read it. The version of it appears to be 2011-06. I'm looking into this, but any help would be greatly appreciated. I'm wondering if my jar_0.jar is the correct version. I'm quite certain I've got the right version of omero_client.jar and loci_tools.jar, but I just took the jar_0.jar from the only place I could find it (A directory on my computer).

Thanks again.

Code: Select all
2012-01-17 09:57:02,615 0          [      main] WARN        loci.formats.services.OMEXMLService  - Could not transform version  OME-XML.

??? Java exception occurred:
java.lang.AbstractMethodError: ome.formats.OMEROMetadataStoreClient.setImageAcquiredDate(Ljava/lang/String;I)V
   at loci.formats.meta.FilterMetadata.setImageAcquiredDate(FilterMetadata.java:1223)
   at loci.formats.MetadataTools.setDefaultCreationDate(MetadataTools.java:317)
   at loci.formats.MetadataTools.populateMetadata(MetadataTools.java:191)
   at loci.formats.MetadataTools.populatePixels(MetadataTools.java:121)
   at loci.formats.MetadataTools.populatePixels(MetadataTools.java:85)
   at loci.formats.in.BaseTiffReader.initMetadataStore(BaseTiffReader.java:392)
   at loci.formats.in.TiffReader.initMetadataStore(TiffReader.java:210)
   at loci.formats.in.BaseTiffReader.initMetadata(BaseTiffReader.java:84)
   at loci.formats.in.BaseTiffReader.initFile(BaseTiffReader.java:502)
   at loci.formats.FormatReader.setId(FormatReader.java:1072)
   at loci.formats.ImageReader.setId(ImageReader.java:677)
   at loci.formats.ReaderWrapper.setId(ReaderWrapper.java:488)
   at loci.formats.ChannelFiller.setId(ChannelFiller.java:249)
   at loci.formats.ReaderWrapper.setId(ReaderWrapper.java:488)
   at loci.formats.ChannelSeparator.setId(ChannelSeparator.java:257)
   at loci.formats.ReaderWrapper.setId(ReaderWrapper.java:488)
   at ome.formats.importer.ImportLibrary.open(ImportLibrary.java:189)
   at ome.formats.importer.ImportLibrary.importImage(ImportLibrary.java:313)

Re: Upload/Download OME-Tiff

PostPosted: Tue Jan 17, 2012 11:15 am
by JakeNewman
(And I've successfully imported the same OME-TIFF into Omero using the importer app, and the XML is intact)

Re: Upload/Download OME-Tiff

PostPosted: Tue Jan 17, 2012 11:19 am
by cxallan
You now have inconsistencies between the Bio-Formats and OMERO JARs. If you want to use the OMERO.importer infrastructure, you must use the version of Bio-Formats that matches, which in your case would be getting the OmeroImporter.jar from:

http://cvs.openmicroscopy.org.uk/snapsh ... .linux.zip

and then latest 4.2.x version of Bio-Formats with dependencies (loci_tools.jar) from:

http://hudson.openmicroscopy.org.uk/vie ... S-Beta4.2/

Re: Upload/Download OME-Tiff

PostPosted: Tue Jan 17, 2012 11:51 am
by JakeNewman
Ok, I've done that. And so the OMEWrapper class now asks for an ImportConfig object. Is there anyway I could use the CommandLineImporter.java to do what I want? Is it *just* a case of setting up an ImportConfig and giving it the required paths?

Jake

Re: Upload/Download OME-Tiff

PostPosted: Tue Jan 17, 2012 2:19 pm
by cxallan
JakeNewman wrote:Ok, I've done that. And so the OMEWrapper class now asks for an ImportConfig object. Is there anyway I could use the CommandLineImporter.java to do what I want? Is it *just* a case of setting up an ImportConfig and giving it the required paths?


Pretty much. I'll see if I can whip up a quick example that does that here this afternoon.

Re: Upload/Download OME-Tiff

PostPosted: Tue Jan 17, 2012 2:42 pm
by JakeNewman
Thank you so much. I'll keep hacking away for the fun of it.

Re: Upload/Download OME-Tiff

PostPosted: Wed Jan 18, 2012 11:35 am
by JakeNewman
Well I've knocked up something in Java which does what I want (just about). It uploads a tiff to our Omero server. It doesn't upload the XML, and it isn't putting it into the right dataset. I'll keep playing.

Jake

Code: Select all
import ome.formats.importer.ImportConfig;
import ome.formats.importer.cli.*;
import org.apache.commons.logging.*;
import org.apache.log4j.*;
import org.ini4j.*;
import loci.formats.in.*;

public class JavaApplication2 {
   
    public static void main(String[] args) throws Exception {
        ImportConfig config = new ImportConfig();
        config.email.set("");
        config.sendFiles.set(true);
        config.sendReport.set(false);
        config.contOnError.set(false);
        config.debug.set(false);
        config.hostname.set("omero.institution.ac.uk");
        config.username.set("user");
        config.password.set("pass");
        config.port.set(Integer.parseInt("4064"));
        config.targetId.set(Long.parseLong("908"));
        CommandLineImporter c = null;
        String[] inputImg = new String[1];
        inputImg[0] = "/Users/jacobnewman/Desktop/newIMGwithXML";
        c = new CommandLineImporter(config, inputImg, false);
        int rc = c.start();
        c.cleanup();

Re: Upload/Download OME-Tiff

PostPosted: Mon Jan 23, 2012 12:10 pm
by JakeNewman
When I use the CommandLineImporter, it reports:

Depth: 4 Metadata Level: MINIMUM

and then proceeds to only upload minimal metadata. Is there a way to change the metadata level? I'm using 4.2.2.

And for some reason I'm able to set X,Y,C and T using the .setPixelSizeX,Y,C, and T methods on a omexmlservice object, but not Z. So when I upload my image, it always has the same number of Z channels as the source image. Basically, I'm taking a source Tiff, extracting its metadata, attaching it to a new tiff, and uploading it. I'm getting nowhere with setting the Z size so I was thinking of just writing a simple XML parser to adjust it *manually*.

Any ideas?

Jake