ImageJ command in MATLAB will launch an instance of Fiji from within MATLAB command window.
addpath '/Applications/Fiji.app/scripts' ImageJ
This will create an
net.imagej.matlab.ImageJMATLABCommands Java object named
IJM in MATLAB base workspace. And this
IJM offers verious useful tools for communication between MATLAB and ImageJ, for example
IJM.show(name) to show a MATLAB array as an image in ImageJ.
However, how can I use ImageJ from within a MATLAB function, rather than from base workspace?
For example, following code launches Fiji from within a function, but workspace of
test1 is empty, because
IJM is always created in base workspace. So, you cannot use
function test1() addpath '/Applications/Fiji.app/scripts' ImageJ w = who end
w = 0×0 empty cell array