paulscherrerinstitute / ch.psi.imagej.hdf5

ImageJ HDF5 Plugin
13 stars 5 forks source link

Installing in latest version of ImageJ (not Fiji) #5

Closed MarkRivers closed 4 years ago

MarkRivers commented 4 years ago

I am trying to install with the latest version of ImageJ, not Fiji.

I think I correctly installed it following the instructions on their Web site.

This is the listing of the directories at the top level of ImageJ

corvette:/usr/local/ImageJ>ls -l
total 2400
drwxrwxrwx  4 epics domain users      30 Apr 16 13:38 HDF5_Viewer-0.12.0
-rwxr-xr-x  1 epics epics          81005 Jul  2  2013 ImageJ
-rw-r--r--  1 root  root              47 Feb  1  2017 ImageJ.cfg
-rwxr-xr-x  1 root  root             341 Feb  1  2017 ImageJ.desktop
-rw-r--r--  1 root  root         2348096 Apr  6 17:15 ij.jar
drwxr-xr-x  2 root  root              21 Dec 27  2016 images
drwxr-xr-x  5 root  root            4096 Dec 27  2016 jre
drwxr-xr-x  2 root  root            4096 Dec 27  2016 luts
drwxr-xr-x  4 root  root            4096 Dec 27  2016 macros
drwxr-xr-x 14 root  root            4096 Apr 16 13:42 plugins

This is the HDF5_Viewer-0.12.0/ directory:

corvette:/usr/local/ImageJ>ls -l HDF5_Viewer-0.12.0/
total 0
drwxrwxrwx 4 epics domain users 32 Apr 16 13:38 lib
drwxrwxrwx 2 epics domain users 35 Apr 16 13:38 plugins

This is the plugins directory:

corvette:/usr/local/ImageJ>ls -l HDF5_Viewer-0.12.0/plugins/
total 248
-rwxrwxr-x 1 epics domain users 252486 Apr 16 13:35 HDF5_Viewer-0.12.0.jar

I think that when I open ImageJ and do File/Import I should see a choice for HDF5, but I don’t.

Can you tell me what I am doing wrong?

I also see that the lib directory only contains this:

corvette:/usr/local/ImageJ>ls -l HDF5_Viewer-0.12.0/lib/
total 8
drwxrwxrwx 2 epics domain users 4096 Apr 16 13:38 linux64
drwxrwxrwx 2 epics domain users 4096 Apr 16 13:38 mac64

I assume this means there is no support for Windows? How hard would it be to add, given that I have a working version of the 1.10 HDF5 library on Windows?

MarkRivers commented 4 years ago

I made progress on this problem. The installation instructions say to unzip into the top-level of Fiji. For ImageJ this does not work, I needed to copy the .jar file to the plugins/ directory and the lib/ folder to the top-level of ImageJ. Once I did that when I try to open a file I get the following traceback:

ImageJ 1.52u; Java 1.8.0_112 [64-bit]; Linux 3.10.0-862.14.4.el7.x86_64; 51MB of 43581MB (<1%)

java.lang.NoSuchMethodError: org.slf4j.Logger.trace(Ljava/lang/String;)V
    at ncsa.hdf.object.h5.H5ScalarDS.init(H5ScalarDS.java:364)
    at ch.psi.imagej.hdf5.HDF5Utilities.getDatasets(HDF5Utilities.java:161)
    at ch.psi.imagej.hdf5.HDF5Utilities.getDatasets(HDF5Utilities.java:164)
    at ch.psi.imagej.hdf5.HDF5Utilities.getDatasets(HDF5Utilities.java:145)
    at ch.psi.imagej.hdf5.HDF5Utilities.getDatasets(HDF5Utilities.java:134)
    at ch.psi.imagej.hdf5.HDF5Reader.open(HDF5Reader.java:86)
    at ch.psi.imagej.hdf5.HDF5Reader.open(HDF5Reader.java:51)
    at ch.psi.imagej.hdf5.HDF5Reader.run(HDF5Reader.java:36)
    at ij.IJ.runUserPlugIn(IJ.java:233)
    at ij.IJ.runPlugIn(IJ.java:196)
    at ij.Executer.runCommand(Executer.java:150)
    at ij.Executer.run(Executer.java:68)
    at java.lang.Thread.run(Thread.java:745)

It looks like I need to install the slf4j package. Is there a jar file available for that?

simongregorebner commented 4 years ago

Hello Mark

First of all regarding your Windows question, no right now Windows is not supported right now. Whats missing is the windows hdf precompiled binaries and a good amount of testing. But technically it would be possible.

Regarding the slf4j, actually the plugin jar contains the slf4j code so there should be no need to copy/download any other jar. However I suspect that the latest imageJ might come with a different version of slf4j and that there might be a conflict. I'm going to look into this

simongregorebner commented 4 years ago

Hey Mark I cannot reproduce your problem, i can install and use the plugin with ImageJ on a vanilla Linux machine. This is how I did the installation:

# 'Im in the users home directory
# download latest ImageJ
curl -O http://wsr.imagej.net/distros/linux/ij152-linux64-java8.zip
# Download lastest plugin release
curl -LO https://github.com/paulscherrerinstitute/ch.psi.imagej.hdf5/releases/download/0.12.0/HDF5_Viewer-0.12.0.zip

# Installing ImageJ 
unzip ij152-linux64-java8.zip

# Installing plugin
cd ImageJ/
unzip ~/HDF5_Viewer-0.12.0.zip

Then i can open ImageJ and are able to use Import to open HDF5 files

./ImageJ

Can you try this procedure on your side and let me know if things then work for you?

MarkRivers commented 4 years ago

@simongregorebner thanks very much!

Your recipe for installing on Linux was simple and worked fine. I think I was previously unzipping the Viewer in the wrong place and then trying to copy the files.

But I have more good news, the HDF5Reader actually works fine on Windows where I tested with Fiji!

This is from the ImageJ Console output:

Apr 22, 2020 2:30:42 PM ch.psi.imagej.hdf5.HDF5Reader open
INFO: Using manual selection
Apr 22, 2020 2:31:04 PM ch.psi.imagej.hdf5.HDF5Reader open
INFO: Reading dataset: data Dimensions: 3 Type: 16-bit unsigned integer
Apr 22, 2020 2:31:04 PM ch.psi.imagej.hdf5.HDF5Reader open
INFO: 3D Image
Apr 22, 2020 2:31:04 PM ch.psi.imagej.hdf5.HDF5Reader open
INFO: Use virtual stack
Apr 22, 2020 2:31:05 PM ch.psi.imagej.hdf5.ImagePlusHDF5 <init>
INFO: VirtualStackHDF5

I think this is working because I have installed HDFView (https://www.hdfgroup.org/downloads/hdfview/) on my machine, which puts this directory in the PATH.

C:\Program Files\HDF_Group\HDF5\1.10.5\bin\

That directory contains hdf5.dll.

So this is a simple procedure to recommend to people who want to use the HDF5Reader plugin in ImageJ on Windows.

simongregorebner commented 4 years ago

Hey @MarkRivers this sounds good. Regarding Windows, I will have a look to including the hdf5.dll from hdfview in the zip so that the Plugin would work out of the box. But I will also add the hint with hdfview to the readme. Thanks for sharing your findings!

simongregorebner commented 4 years ago

there is a short hint in the readme now until the Windows .dll files are distributed with the zip.