These are chat archives for fiji/fiji
newto invoke a java constructor from matlab (ran into this for some backdoor clojure<->matlab interfacing sometime back)
IJM.show()and do operations on it with the Ops stuff.
I should also note that what I actually want is interfacing ImageJ not with MATLAB but with Mathematica. However, Mathematica’s Java interface does not seem to be powerful enough to allow this. The workaround: control MATLAB from Mathematica (I wrote a package for this), and control ImageJ from MATLAB. This solution looks very promising.
However, if there might be an easier and still flexible way to control ImageJ from another system (e.g. if there are command line tools), that might be a better approach. If not, going through MATLAB looks to be the best.
addpath /Applications/Fiji.app/scripts/ ImageJ load durer im = X/128; imshow(im)
ij = net.imagej.ImageJ(IJM.context()); ijIm = copytoImg(im) neighborhood = net.imglib2.algorithm.neighborhood.HyperSphereShape(4) median = ij.op().run('create.img', ijIm)
ij = net.imagej.ImageJ(IJM.context());, which fails with "No method 'run' with matching signature found for class 'net.imagej.ops.DefaultOpService'." This is trying to be the MATLAB-syntax equivalent of the line
ij.op().run("filter.median", median, eyes32, neighborhood)from the tutorial.
topHat = ij.op().morphology().topHat(eyes, [neighborhood]), but I can't figure out how to put
neighborhoodin a "list" in MATLAB. What MATLAB data structure converts to a "list"? A cell array doesn't seem to.
No method 'run' with matching signature found for class 'net.imagej.ops.DefaultOpService'.
I think you are running into a MATLAB limitation regarding calling Java methods with varargs syntax.
runmethod of ops is
run(String opName, Object... args). Which is the same thing as
run(String opName, Object args)signature-wise, except that Java allows you to list a variable number of arguments and then smooshes them into an
Object(array) under the hood. But I guess MATLAB is not smart enough to do that.
args = javaArray('java.lang.Object',3); args(1)= median; args(2)= eyes32; args(3)= neighborhood; median = ij.op().run('create.img', args)