Problem with "BoneJ Usage (Modern)" popup window when running from Matlab

Hi

I am using ImageJ.m to run BoneJ functions via Matlab scripts. Everything goes fine, the only problem is that the “BoneJ Usage (Modern)” window popups every time I execute my scripts. There is not problem when I use Fiji in standalone mode. In the standalone mode, the “BoneJ Usage (Modern)” window appeared the first time I used BoneJ and it has never done it again. So, I guess it has to be a Matlab issue.
Thank you!
Adrián

PS: I am using Matlab R2020b

Could you share your scripts here? None of our team uses Matlab so have little experience calling BoneJ from it, only what is reported here. Recently a user reported that the legacy plugins work but modern ones don’t so I am not sure what is going on. It would be worth your contacting the Matlab connector developers as well.

Thank you for your rapid response.
I simply do

grid0IJ = ij.IJ.openImage('model.tif')); % Load image stack
grid0IJ.show();                                    % Show figure
ij.IJ.run("Thickness","mapchoice=[Trabecular thickness] showmaps=true maskartefacts=true");
ij.IJ.selectWindow(strcat(modelo,'_Tb.Th'));

Before executing the “Thickness”, it popups the window
image

OK thanks @AdrianC. Is it possible to set batch mode or headless mode from Matlab, as a potential workaround?

In case the Matlab connector people check this thread, the calls in BoneJ that should not pop up a dialog are here:

and I think this is the bit that is getting triggered wrongly:

The dialog should be shown only if the user has not been asked before (permissionSought is false), regardless of their previous response (i.e. if they opted in or out). This is the behaviour in interactive and I believe other headless / scripting situations.

Paging @daniel.sage @dimiterpp @hinerm @ctrueden

@AdrianC apparently when ImageJ-MATLAB was first created there was a problem with the java.util.prefs.Preferences behavior when running inside MATLAB. It’s not clear what that problem was and it may be fixed now in more recent versions of MATLAB. The result at the time was the decision to disable preferences while running in MATLAB.

In any case, you can work around the issue in the short term by running this command in MATLAB:

>> net.imagej.matlab.ImageJMATLABPrefService.setEnabled(true)

I would be happy to turn preferences back on but would you mind trying the work-around for now and seeing if any other issues come up?

Thank you!

P.S. Sorry @mdoube - this is 100% not a problem with BoneJ.

1 Like

Thank you! It solved my problem!

1 Like