Class MIJ

java.lang.Object
  extended by MIJ

public class MIJ
extends java.lang.Object

Matlab to ImageJ interface.

Version:
1.3.9 (17 March 2014).
Author:
See Also:

More information: http ://bigwww.epfl.ch/sage/soft/mij/

Important note for the installation:

To use this class, copy mij.jar to your ImageJ folder and tell Matlab where the files are by:
javaaddpath '\ij.jar'
javaaddpath '\mij.jar'

This class was tested:

Conditions of use:
You'll be free to use this software for research purposes, but you should not redistribute it without our consent. In addition, we expect you to include a citation or acknowledgment whenever you present or publish results that are based on it.


Field Summary
static ImageJ imagej
           
 
Constructor Summary
MIJ()
          Class constructor.
 
Method Summary
static void closeAllWindows()
          Closes all windows.
static ImagePlus createColor(byte[][][][] is, boolean showImage)
          Create a new 3D color image in ImageJ from a Matlab variable.
static ImagePlus createColor(byte[][][] is, boolean showImage)
          Create a new color image in ImageJ from a Matlab variable.
static ImagePlus createColor(java.lang.String title, byte[][][][] is, boolean showImage)
          Create a new 3D color image in ImageJ from a Matlab variable with a specified title.
static ImagePlus createColor(java.lang.String title, byte[][][] is, boolean showImage)
          Create a new color image in ImageJ from a Matlab variable with a specified title.
static void createImage(java.lang.Object object)
          Create a new image in ImageJ from a Matlab variable.
static ImagePlus createImage(java.lang.String title, java.lang.Object object, boolean showImage)
          Create a new image in ImageJ from a Matlab variable with a specified title.
static void error(java.lang.String msg)
          Displays a error message in a dialog box titled "ImageJ".
static void error(java.lang.String title, java.lang.String msg)
          Displays a error message in a dialog box specified title.
static void exit()
          Exits ImageJ.imagej instance
static java.lang.Object getColumn(java.lang.String heading)
          Returns a specifying column the current instance of ResultsTable.
static java.lang.Object getCurrentImage()
          Returns the current (selected) image from ImageJ.
static java.lang.String getCurrentTitle()
          Returns the title of the current image window.
static java.lang.Object getHistogram()
          Returns the histogram of the current image.
static java.lang.Object getImage(java.lang.String title)
          Returns the specifying image from ImageJ.
static java.lang.String[] getListColumns()
          Returns the list of columns currently used in the ResultsTable.
static java.lang.String[] getListImages()
          Gives the list of the open images in the ImageJ instance.
static java.lang.String getLog()
          Returns the contents of the Log window or null if the Log window is not open.
static java.lang.Object getResultsTable()
          Returns the instance of the ResultsTable.
static java.lang.Object getRoi(int option)
          Get a region of interest (ROI) of the current image with or without calibration.
static java.lang.String help()
          Give a brief description of the methods.
static void log(java.lang.String s)
          Displays a message in the log window of ImageJ.
static void main(java.lang.String[] args)
          Starts new instance of ImageJ.
static void run(java.lang.String command)
          Run a ImageJ command without arguments.
static void run(java.lang.String command, java.lang.String options)
          Run a ImageJ command with specified arguments.
static void selectWindow(java.lang.String title)
          Select a window.
static void setColumn(java.lang.String heading, java.lang.Object object)
          Set a specifying column into the current instance ResultsTable.
static void setRoi(double[][] roiarray, int type)
          Set a region of interest (ROI) in the current image.
static void setSlice(int slice)
          Switches to the specified stack slice, where 1<='slice'<=stack-size.
static void setThreshold(double lowerThreshold, double upperThresold)
          Set the threshold values of the current image.
static void setupExt(java.lang.String IJpath)
          Setup the IJPath.
static void showStatus(java.lang.String s)
          Displays a message in the ImageJ status bar.
static void start()
          Starts new instance of ImageJ from Matlab.
static void start(boolean v)
          Starts new instance of ImageJ from Matlab with or without verbose mode.
static void start(java.lang.String IJpath)
          Starts new instance of ImageJ specifying the plugins directory and macros directory.
static void start(java.lang.String args, java.lang.String IJpath)
          Starts new instance of ImageJ specifying the command-line options .
static void start(java.lang.String homeDir, java.lang.String IJpath, boolean v)
          Starts new instance of ImageJ specifying the plugins directory and macros directory.
static java.lang.String version()
          Get the version of the MIJ class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imagej

public static ImageJ imagej
Constructor Detail

MIJ

public MIJ()
Class constructor.

Method Detail

version

public static java.lang.String version()
Get the version of the MIJ class.

Returns:
Returns the version number.

help

public static java.lang.String help()
Give a brief description of the methods.

Returns:
Returns a brief description of the methods.

start

public static void start()
Starts new instance of ImageJ from Matlab.


start

public static void start(boolean v)
Starts new instance of ImageJ from Matlab with or without verbose mode.

Parameters:
v - indicate the verbose mode

start

public static void start(java.lang.String IJpath)
Starts new instance of ImageJ specifying the plugins directory and macros directory.

Parameters:
IJpath - String that points to the folder containing ij.jar and plugins and macros folder
verbose - indicate the verbose mode

start

public static void start(java.lang.String homeDir,
                         java.lang.String IJpath,
                         boolean v)
Starts new instance of ImageJ specifying the plugins directory and macros directory. For this to work correctly, DO NOT end homeDir with plugins and DO NOT leave homeDir null. See setupPluginsAndMacrosPaths() in Menus.java and note that Menus.updateImageJMenus() is the only public function that has access to setupPluginsAndMacrosPaths().

Parameters:
homeDir - Location of the user's homeDir E.g. /home/user (ImageJ preferences will be saved here. It also means that if you already have preferences, opening ImageJ via Matlab will use those preferences)
IJpath - String that points to the folder containing ij.jar and plugins and macros folder
verbose - indicate the verbose mode

setupExt

public static void setupExt(java.lang.String IJpath)
Setup the IJPath.

Parameters:
IJpath - String that points to the folder containing ij.jar and plugins and macros folder

start

public static void start(java.lang.String args,
                         java.lang.String IJpath)
Starts new instance of ImageJ specifying the command-line options .

Parameters:
args - String of the same format as ImageJ commandline e.g. "-debug -ijpath /opt/ImageJ/plugins"
IJpath - String that points to the folder containing ij.jar and plugins and macros folder

main

public static void main(java.lang.String[] args)
Starts new instance of ImageJ.

Parameters:
args - Start up arguments for MIJ

exit

public static void exit()
Exits ImageJ.imagej instance


getListImages

public static java.lang.String[] getListImages()
Gives the list of the open images in the ImageJ instance.

Returns:
List of open images

getCurrentTitle

public static java.lang.String getCurrentTitle()
Returns the title of the current image window.

Returns:
Title of the current image window

setRoi

public static void setRoi(double[][] roiarray,
                          int type)
Set a region of interest (ROI) in the current image.

Parameters:
roiarray - give coordinates or positions of the ROI depending of the ROI type
type - supported types: Roi.LINE, Roi.RECTANGLE, Roi.POINT, Roi.OVAL, Roi.POLYLINE, Roi.POLYGON, Roi.ANGLE

getRoi

public static java.lang.Object getRoi(int option)
Get a region of interest (ROI) of the current image with or without calibration.

Parameters:
option - CAL for using calibration or NOCAL for no calibration
Returns:
Object

getCurrentImage

public static java.lang.Object getCurrentImage()
Returns the current (selected) image from ImageJ.

Returns:
Current image

getImage

public static java.lang.Object getImage(java.lang.String title)
Returns the specifying image from ImageJ.

Parameters:
title - title of image
Returns:
Object

getHistogram

public static java.lang.Object getHistogram()
Returns the histogram of the current image.

Returns:
histogram

getListColumns

public static java.lang.String[] getListColumns()
Returns the list of columns currently used in the ResultsTable.

Returns:
list of columns

getResultsTable

public static java.lang.Object getResultsTable()
Returns the instance of the ResultsTable.

Returns:
Instance of the ResultsTable

getColumn

public static java.lang.Object getColumn(java.lang.String heading)
Returns a specifying column the current instance of ResultsTable.

Parameters:
heading - heading of a column
Returns:
column specified by its heading

setColumn

public static void setColumn(java.lang.String heading,
                             java.lang.Object object)
Set a specifying column into the current instance ResultsTable.

Parameters:
heading - heading of a column
object -

createImage

public static void createImage(java.lang.Object object)
Create a new image in ImageJ from a Matlab variable. This method try to create a image (ImagePlus of ImageJ) from a Matlab's variable which should be an 2D or 3D array The recognize type are byte, short, int, float and double. The dimensionality of the 2 (image) or 3 (stack of images)

Parameters:
object - Matlab variable

createImage

public static ImagePlus createImage(java.lang.String title,
                                    java.lang.Object object,
                                    boolean showImage)
Create a new image in ImageJ from a Matlab variable with a specified title. This method try to create a image (ImagePlus of ImageJ) from a Matlab's variable which should be an 2D or 3D array The recognize type are byte, short, int, float and double. The dimensionality of the 2 (image) or 3 (stack of images)

Parameters:
title - title of the new image
object - Matlab variable
showImage - Whether to display the newly created image or not
Returns:
the resulting ImagePlus instance

createColor

public static ImagePlus createColor(byte[][][] is,
                                    boolean showImage)
Create a new color image in ImageJ from a Matlab variable. The last index of the array is the color channel index (3 channels) in the follwing order Red-Green-Blue.

Parameters:
is - Matlab variable

createColor

public static ImagePlus createColor(java.lang.String title,
                                    byte[][][] is,
                                    boolean showImage)
Create a new color image in ImageJ from a Matlab variable with a specified title.

Parameters:
title - title of the new image
is - Matlab variable

createColor

public static ImagePlus createColor(byte[][][][] is,
                                    boolean showImage)
Create a new 3D color image in ImageJ from a Matlab variable.

Parameters:
is - Matlab variable

createColor

public static ImagePlus createColor(java.lang.String title,
                                    byte[][][][] is,
                                    boolean showImage)
Create a new 3D color image in ImageJ from a Matlab variable with a specified title.

Parameters:
title - title of the new image
is - Matlab variable

run

public static void run(java.lang.String command)
Run a ImageJ command without arguments. This method call the run method of ImageJ without any options.

Parameters:
command - command to run

run

public static void run(java.lang.String command,
                       java.lang.String options)
Run a ImageJ command with specified arguments. This method call the run method of ImageJ with specified options.

Parameters:
command - command in ImageJ
options - options for the command

setThreshold

public static void setThreshold(double lowerThreshold,
                                double upperThresold)
Set the threshold values of the current image.

Parameters:
lowerThreshold -
upperThresold -

error

public static void error(java.lang.String msg)
Displays a error message in a dialog box titled "ImageJ".

Parameters:
msg -

error

public static void error(java.lang.String title,
                         java.lang.String msg)
Displays a error message in a dialog box specified title.

Parameters:
title -
msg -

log

public static void log(java.lang.String s)
Displays a message in the log window of ImageJ.

Parameters:
s -

getLog

public static java.lang.String getLog()
Returns the contents of the Log window or null if the Log window is not open.


showStatus

public static void showStatus(java.lang.String s)
Displays a message in the ImageJ status bar.


closeAllWindows

public static void closeAllWindows()
Closes all windows.


selectWindow

public static void selectWindow(java.lang.String title)
Select a window.


setSlice

public static void setSlice(int slice)
Switches to the specified stack slice, where 1<='slice'<=stack-size.

Parameters:
slice -