We're Hiring!

Upload/Download OME-Tiff

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

Re: Upload/Download OME-Tiff

Postby JakeNewman » Tue Jan 17, 2012 9:18 am

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.
JakeNewman
 
Posts: 12
Joined: Mon Jan 16, 2012 12:11 pm

Re: Upload/Download OME-Tiff

Postby cxallan » Tue Jan 17, 2012 9:32 am

Where did you get the JAR and which version of OMERO are you attempting to use?
cxallan
Site Admin
 
Posts: 509
Joined: Fri May 01, 2009 8:07 am

Re: Upload/Download OME-Tiff

Postby JakeNewman » Tue Jan 17, 2012 10:52 am

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)
JakeNewman
 
Posts: 12
Joined: Mon Jan 16, 2012 12:11 pm

Re: Upload/Download OME-Tiff

Postby JakeNewman » Tue Jan 17, 2012 11:15 am

(And I've successfully imported the same OME-TIFF into Omero using the importer app, and the XML is intact)
JakeNewman
 
Posts: 12
Joined: Mon Jan 16, 2012 12:11 pm

Re: Upload/Download OME-Tiff

Postby cxallan » Tue Jan 17, 2012 11:19 am

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/
cxallan
Site Admin
 
Posts: 509
Joined: Fri May 01, 2009 8:07 am

Re: Upload/Download OME-Tiff

Postby JakeNewman » Tue Jan 17, 2012 11:51 am

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
JakeNewman
 
Posts: 12
Joined: Mon Jan 16, 2012 12:11 pm

Re: Upload/Download OME-Tiff

Postby cxallan » Tue Jan 17, 2012 2:19 pm

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.
cxallan
Site Admin
 
Posts: 509
Joined: Fri May 01, 2009 8:07 am

Re: Upload/Download OME-Tiff

Postby JakeNewman » Tue Jan 17, 2012 2:42 pm

Thank you so much. I'll keep hacking away for the fun of it.
JakeNewman
 
Posts: 12
Joined: Mon Jan 16, 2012 12:11 pm

Re: Upload/Download OME-Tiff

Postby JakeNewman » Wed Jan 18, 2012 11:35 am

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();
JakeNewman
 
Posts: 12
Joined: Mon Jan 16, 2012 12:11 pm

Re: Upload/Download OME-Tiff

Postby JakeNewman » Mon Jan 23, 2012 12:10 pm

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
JakeNewman
 
Posts: 12
Joined: Mon Jan 16, 2012 12:11 pm

PreviousNext

Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 0 guests