Run ImageJ plugin OrientationJ using MIJI from Matlab

4 ビュー (過去 30 日間)
Malte Wallmeier
Malte Wallmeier 2019 年 9 月 16 日
コメント済み: Ondrej Kucera 2020 年 7 月 21 日
Hi community,
I am trying to run the ImageJ plugin "OrientationJ Vector Field" out of Matlab and import the results table back to analyze the data automatically. My code currently looks like this:
javaaddpath('C:\Program Files\MATLAB\R2018b\java\jar\ij.jar');
javaaddpath('C:\Program Files\MATLAB\R2018b\java\jar\mij.jar');
Miji;
MIJ.run('Open...', 'path=[E:\Example_Image.tif]');
MIJ.run('OrientationJ Vector Field');
MIJ.run('OrientationJ Vector Field', 'tensor=2.0 gradient=0 radian=on vectorgrid=10 vectorscale=80.0 vectortype=0 vectoroverlay=on vectortable=on ');
res = MIJ.getResultsTable;
MIJ.closeAllWindows();
I currently have 2 problems:
  1. MIJ.run('OrientationJ Vector Field',.... does not execute the plugin completely. A windows is opened where I need to click "run".
  2. MIJ.getResultsTable won’t import results unless I rename it manually to "Results"
Are there ways around those problems?
Malte
  1 件のコメント
Ondrej Kucera
Ondrej Kucera 2020 年 7 月 21 日
After running the plugin, you may try to rename the result table:
IJ=ij.IJ();
IJ.renameResults("Results");
res = MIJ.getResultsTable;
That should make results accessible to the getResultsTable method.

サインインしてコメントする。

回答 (1 件)

Guillaume
Guillaume 2019 年 9 月 16 日
編集済み: Guillaume 2019 年 9 月 16 日
For 1), unfortunately, it's a problem with your plugin which clearly has not been designed to run non-interactively. Unless the plugin has an option to truly run non-interactively you'll struggle to bypass that input window. It is theoretically possible to use matlab to simulate a click on a button by delegating to the OS but the method will vary from OS to OS and depending on how that button is rendered may involve a lot of code.
For 2), you can use matlab to rename the file before calling getResultsTable:
movefile('E:\Whateverthenameis', 'E:\Results.txt');
Another option would be to rewrite whatever that plugin does in matlab.

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by