Graphic STI
logo EPFL
text EPFL
english only
Biomedical Imaging Group
BIG > Download Algorithms > Daniel Sage > MIJ

BIG Home page






Download Algorithms


Student Projects


ImageJ Distribution
Fiji Distribution

Matlab Central Distribution
Open Comments


A Java package for running ImageJ and Fiji within Matlab

Daniel Sage, Biomedical Image Group, EPFL, Switzerland

Dimiter Prodanov, Bio-Nano Electronics Department, Imec, Leuven, Belgium

Carlos Ortiz, Department of Physics, North Carolina State University, Raleigh, NC, USA

Jean-Yves Tinevez, Imagopole, Institut Pasteur, Paris, France


MIJ offers the missing link between two imaging software: ImageJ/Fiji and Matlab. The goal of the package mij.jar is to provide static methods to exchange images and volumes. MIJ allows also to access to all built-in functions of ImageJ and to third-part plugins of ImageJ. MIJ is integrated in Fiji with a super-easy script to use it.

Thanks to the Fiji team, MIJ is now super-easy to use using a Matlab script Miji.m which is integrated in Fiji. ImageJ/Fiji becomes a image-processing librairie of Matlab.


Daniel Sage, Dimiter Prodanov, Jean-Yves Tinevez and Johannes Schindelin, MIJ: Making Interoperability Between ImageJ and Matlab Possible ImageJ User & Developer Conference, 24-26 October 2012, Luxembourg. Poster [PDF, 1.9 Mb]

splash image


Some interesting features

Matlab prerequirements

The package requires a proper installation of ImageJ and Matlab. The package was tested since Matlab 7.9.0 (R2009b) on different plateforms a Windows XP, Mac OSX 10.6, and Linux Ubuntu.

Download and install

Download mij.jar and place it into the java directory of Matlab (e.g for Window Machine 'C:\Program Files\MATLAB\R2009b\java\'). Copy also the ij.jar of ImageJ in the java directory of Matlab.

Set up the path (with a ImageJ already installed and configured):

Set up the paths (without any ImageJ yet installed):

Set up the memory:

Source Code and Documentation

Supported methods in the version 1.3.9

MIJ.closeAllWindowsClose all windows
MIJ.createColorexports RGB image
MIJ.createImageexports other images
MIJ.errordisplay a error message in a dialog box
MIJ.exitexists MIJ
MIJ.getCurrentImagereturns a 2D array representing the current image
MIJ.getImagereturns a 2D array representing the image specified by the title
MIJ.getColumnimports column of the ResultsTable
MIJ.getCurrentTitleimports the title of the current image
MIJ.getHistogramimports the histogram of the current image
MIJ.getLogreturns the contents of the window log of ImageJ
MIJ.getListImagesreturns the list of opened images
MIJ.getListColumnsreturns the list of columns currently used in the ResultsTable
MIJ.getResultsTableimports the ResultsTable
MIJ.getRoiimports the current ROI
MIJ.helpgives a brief description of the MIJ methods
MIJ.logprint a message in the window console of ImageJ
MIJ.selectWindowselect a window
MIJ.setRoiexports the current ROI
MIJ.setColumnexports contents to a column in the ResultsTable
MIJ.setSliceset the slice of a stack of image
MIJ.setThresholdsets the threshods of the image
MIJ.setupExtpoints to the folder containing ij.jar and plugins and macros folder
MIJ.showStatusdisplay a message in the status bar of ImageJ
MIJ.startstarts MIJ
MIJ.runruns command or macro
MIJ.versionreturn the MIJ version

Mapping the Matlab numeric type to ImageJ type

MatlabImageJ image type
uint8Grayscale 8-bit
int8Grayscale 8-bit
uint16Grayscale 16-bit
int16Grayscale 16-bit
uint32Grayscale 16-bit (Possible loss of precision)
int32Grayscale 16-bit (Possible loss of precision)
uint64Not allowed
int64Not allowed
singleGrayscale 32-bit
doubleGrayscale 32-bit (Possible loss of precision)

Script examples


Using fast Matlab routines and display resulting images on ImageJ


Reading image files using Bio-Formats on Matlab


Image-analysis on ImageJ, statistics on Matlab


Conditions of use

You'll be free to use this software for research purposes, but you must not transmit and distribute it without our consent. In addition, you undertake to include a citation whenever you present or publish results that are based on it. EPFL makes no warranties of any kind on this software and shall in no event be liable for damages of any kind in connection with the use and exploitation of this technology. • 09.11.2018