We're Hiring!

Display Cellomics Image (c01) on a webpage

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.

Display Cellomics Image (c01) on a webpage

Postby alexC » Fri Dec 02, 2011 5:53 pm

Hi there,

This may not be the place to ask but I am trying to display c01 images on a webpage. I found a Java class called CellomicsReader but I havent found anywhere any information on how to use it. Can I get pointers to where I should start?

Thanks,

Alex
alexC
 
Posts: 8
Joined: Fri Dec 02, 2011 2:27 pm

Re: Display Cellomics Image (c01) on a webpage

Postby mlinkert » Sat Dec 03, 2011 12:19 am

Hi Alex,

This may not be the place to ask but I am trying to display c01 images on a webpage. I found a Java class called CellomicsReader but I havent found anywhere any information on how to use it. Can I get pointers to where I should start?


This page:

http://loci.wisc.edu/bio-formats/bio-fo ... va-library

provides information on how to use Bio-Formats (the library that contains CellomicsReader) within your own code. In particular, you might want to look at this code which demonstrates how to read images from a file:

http://trac.openmicroscopy.org.uk/ome/b ... eInfo.java

Regards,
-Melissa
User avatar
mlinkert
Team Member
 
Posts: 353
Joined: Fri May 29, 2009 2:12 pm
Location: Southwest Wisconsin

Re: Display Cellomics Image (c01) on a webpage

Postby alexC » Mon Dec 05, 2011 3:53 pm

Thanks for the help. I downloaded the bio-formats.jar file and tried to use it as a standalone so see if I get anything:

java -jar ./bio-formats.jar
Exception in thread "main" java.lang.NoClassDefFoundError: loci/common/services/ServiceException
Caused by: java.lang.ClassNotFoundException: loci.common.services.ServiceException
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: loci.formats.gui.ImageViewer. Program will exit.

Am I doing something wrong?
alexC
 
Posts: 8
Joined: Fri Dec 02, 2011 2:27 pm

Re: Display Cellomics Image (c01) on a webpage

Postby mlinkert » Mon Dec 05, 2011 4:03 pm

Hi Alex,

Thanks for the help. I downloaded the bio-formats.jar file and tried to use it as a standalone so see if I get anything:

java -jar ./bio-formats.jar
Exception in thread "main" java.lang.NoClassDefFoundError: loci/common/services/ServiceException
Caused by: java.lang.ClassNotFoundException: loci.common.services.ServiceException
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: loci.formats.gui.ImageViewer. Program will exit.

Am I doing something wrong?


bio-formats.jar has multiple dependencies, so you must either download all of those dependencies or use loci_tools.jar (a single JAR which contains bio-formats.jar and everything else that you need). The download page has links to all of the JARs that you will need:

http://loci.wisc.edu/bio-formats/downloads

If you decide not to use loci_tools.jar, note that you should have at minimum bio-formats.jar, loci-common.jar, and ome-xml.jar (plus scifio.jar, if you are using trunk or daily builds). The other JARs listed in the "Bio-Formats component builds" section are technically optional, though some functionality will be missing if they are not present.

Some more information on when to use which JARs is available at the bottom of this page:

http://loci.wisc.edu/bio-formats/bio-fo ... va-library

-Melissa
User avatar
mlinkert
Team Member
 
Posts: 353
Joined: Fri May 29, 2009 2:12 pm
Location: Southwest Wisconsin

Re: Display Cellomics Image (c01) on a webpage

Postby alexC » Mon Dec 05, 2011 5:52 pm

I tried to download the other jar files and place them in the same directory as the other, that didnt work. I also tried to set a CLASSPATH environment variable, that didnt work either. I still get the same error message.
alexC
 
Posts: 8
Joined: Fri Dec 02, 2011 2:27 pm

Re: Display Cellomics Image (c01) on a webpage

Postby alexC » Tue Dec 06, 2011 2:03 pm

Update: I managed to use the jar file by adding a few more dependencies (jar files) in my directory. Now I can open png files but I still have issues with .c01 files, the image seem to appear in the preview but I just get a black screen when I open it. Here is a sample of the output I get from the command line:

$ java -jar ./bio-formats.jar
log4j:WARN No appenders could be found for logger (loci.common.services.ServiceFactory).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "ImageViewer-Opener" java.lang.NullPointerException
at loci.formats.DimensionSwapper.getSizeZ(DimensionSwapper.java:189)
at loci.formats.FileStitcher.computeIndices(FileStitcher.java:1067)
at loci.formats.FileStitcher.openBytes(FileStitcher.java:454)
at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:304)
at loci.formats.ChannelMerger.openBytes(ChannelMerger.java:151)
at loci.formats.ChannelMerger.openBytes(ChannelMerger.java:143)
at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:292)
at loci.formats.gui.BufferedImageReader.openImage(BufferedImageReader.java:81)
at loci.formats.gui.BufferedImageReader.openImage(BufferedImageReader.java:64)
at loci.formats.gui.ImageViewer.open(ImageViewer.java:334)
at loci.formats.gui.ImageViewer$1.run(ImageViewer.java:785)
alexC
 
Posts: 8
Joined: Fri Dec 02, 2011 2:27 pm

Re: Display Cellomics Image (c01) on a webpage

Postby alexC » Mon Dec 12, 2011 7:18 pm

I am still stuck on this... so bump.
alexC
 
Posts: 8
Joined: Fri Dec 02, 2011 2:27 pm

Re: Display Cellomics Image (c01) on a webpage

Postby alexC » Tue Dec 13, 2011 7:22 pm

I tried a different approach, I am now trying to simply convert an c01 file to a png or so:
Code: Select all
$ javac FileConvert.java
$ java FileConvert cellomics_100223120001_b02f18d2.c01 cellomics_100223120001_b02f18d2.png
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
   at loci.common.services.ServiceFactory.<clinit>(ServiceFactory.java:48)
   at FileConvert.initialize(FileConvert.java:76)
   at FileConvert.convert(FileConvert.java:52)
   at FileConvert.main(FileConvert.java:168)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
   at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
   ... 4 more
alexC
 
Posts: 8
Joined: Fri Dec 02, 2011 2:27 pm

Re: Display Cellomics Image (c01) on a webpage

Postby cxallan » Thu Dec 15, 2011 8:55 am

Unless you have a deep understanding of the JAR dependencies of Bio-Formats I'd strongly suggest that you follow Melissa's advice and place only loci_tools.jar on your CLASSPATH. It has all the classes required.
cxallan
Site Admin
 
Posts: 509
Joined: Fri May 01, 2009 8:07 am

Re: Display Cellomics Image (c01) on a webpage

Postby alexC » Thu Dec 15, 2011 2:18 pm

I finally figured out how to use class libraries in Jar files... anyway, you were right, I got ImageInfo to work with all the other packages but loci_tools was all I needed. The images were still black with default settings but I got something better with the options:
java loci.formats.tools.ImageInfo -series 1 -fast -autoscale ../cellomics_110804170001_b02f00o2.c01

It's still not what I expect though, I just get part of the image and I cannot control the scale. I think other parts of the image are in different series and I would need to combine them. The image look like there is a white filter on top of it, or the B&W colors are reversed. I tried to use -nofilter but that didnt change anything.

Update: I think the problem is that the image is in a 12bit/pixel format and ImageInfo assumes a 16bits format, is there a way to change that?

Update2: I am uploading 2 images to show the problem I am talking about. One image is exported directly from cellomics software, the other is what I get on the screen from ImageInfo.
Attachments
CELLOMICS_110804170001_B02f10d1.png
From Cellomics export feature.
CELLOMICS_110804170001_B02f10d1.png (186.92 KiB) Viewed 5598 times
Screenshot-2.png
ImageInfo result.
Screenshot-2.png (160.12 KiB) Viewed 5598 times
alexC
 
Posts: 8
Joined: Fri Dec 02, 2011 2:27 pm

Next

Return to Developer Discussion

Who is online

Users browsing this forum: Google [Bot] and 1 guest