ROI on multiple slices and importing to matlab

I recently tested the Matlab/ImageJ connection via mij/ij utility provided by http://bigwww.epfl.ch/sage/soft/mij/

I use MIJ.createImage(image3D); to pass the 3D image matrix from Matlab to ImageJ. and xyPointsM = MIJ.getRoi(0); to get the x,y ROI points out of ImageJ. However, I am having trouble creating an ROI on multiple slices and then passing the ROI coordinates on multiple slices back to Matlab.

Any help is much appreciated.

Hi @adityaapte,
do you have problem in general to get the Roi in Matlab or do you have problem only in multiple slices?
Have a nice day,
Emanuele

I have problem creating ROIs on multiple slices. Since I am unable to create ROI on multiple slices, I haven’t tested their import to Matlab. Creating and importing ROI on single slice works fine.

Note that there is a newer and more sophisticated version of MATLAB-ImageJ connectivity available from the MATLAB update site. Of course, this assumes you are using ImageJ2, rather than plain ImageJ 1.x.

1 Like

@ctrueden I downloaded Fiji and used the update site for matlab. However, I get an error while running the InstallJava3D.m that’s provided under \Fiji.app\scripts.

Testing if Java3D is already installed...
Java3D is not installed.
Let us try to install it.

Determining the target JVM ext folder...
Undefined variable "ij3d" or class "ij3d.Install_J3D.getFirstExtDir".
Error in InstallJava3D (line 46)
ext_path =  char(ij3d.Install_J3D.getFirstExtDir());

This script is obsolete; a new version of Java 3D now ships with the latest distribution of Fiji. See also:

I removed the old Java 3D installation scripts to avoid confusion.

Unfortunately, it seems that MATLAB (at least on OS X) ships with Java 7 instead of Java 8. And the current version of Fiji requires Java 8. So you may need to do some surgery on your MATLAB to switch it over to Java 8.

Alternately, you can download a Life-Line version of Fiji and then run the updater, which will update it to the latest Java-6-compatible version. If you do that, you will need to install Java 3D into your MATLAB like before.

The latest Matlab version (2015b) is incompatible with Java 8. It has to have Java 7. Does that mean that there is no way to use Fiji (atleast the GUI components that use Java 3d) with Matlab anymore?

As @ctrueden pointed out, you can run Fiji (with Java3D) on Java 6 (and 7) by

  • downloading a Life-Line version of Fiji,
  • running the updater (without activating the Java-8 update site), and
  • installing Java 3D into your MATLAB.

If you want to have the latest updates for Fiji (served by the Java-8 update site) in MATLAB, you should ask MATLAB to support the newest Java.

1 Like