Skip to content

Conversation

imagejan
Copy link
Member

@imagejan imagejan commented Jul 3, 2018

I migrated the history of scripts/*.m in fiji/fiji to this repository, and then moved these scripts into src/main/resources/script_templates.

Should we consider any other location for these scripts?

//@kouichi-c-nakamura

Jacques Pecreaux and others added 30 commits July 3, 2018 16:54
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Sometimes, you only want to use parts of Fiji as a library, not start
the interactive ImageJ. To do this, start 'Miji(false)'.

By default, ImageJ will still be started (e.g. 'Miji' does the same as
'Miji(true)').

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
While at it, almost rewrite the thing to avoid unnecessary cd'ing.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jean-Yves Tinevez <jean-yves.tinevez@pasteur.fr>
Signed-off-by: Jean-Yves Tinevez <jeanyves.tinevez@gmail.com>
Signed-off-by: Jean-Yves Tinevez <jeanyves.tinevez@gmail.com>
Unfortunately, a restart is required if Java3D was not installed, but it
is as convenient now as we could make it, at least.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This file only contains comments, as it is meant to be published using
Matlab's publish() function.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jean-Yves Tinevez <jeanyves.tinevez@gmail.com>
Signed-off-by: Stephan Preibisch <stephan.preibisch@gmx.de>
We also have to ensure that the bin folder in the MATLAB jre path is
writable, otherwise it will confuse the user.

Reported by Peter Beemiller
Signed-off-by: Jean-Yves Tinevez <jeanyves.tinevez@gmail.com>
Now that Johannes fixed the surface plot mode of the 3D viewer, we can
put this demo back. It is a demo explainging how to get the MATLAB logo
rendered in 3D in Fiji 3D viewer.
Signed-off-by: Jean-Yves Tinevez <jean-yves.tinevez@pasteur.fr>
Apparently, the light was bluish, dunno whether we can do that, too :O)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jean-Yves Tinevez <jeanyves.tinevez@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
... also if the user asked the main window to be hidden...

Noticed and reported by Walter de Back.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
In Miji.m, there it a call to

 fiji.User_Plugins.installScripts();

Unfortunately, this causes a nasty bug with MATLAB: calling this
static method modifies the static MATLAB java path, which is
normally forbidden. The consequences of that are nasty: adding a
class to the dynamic class path can be refused, because it would be
falsy recorded in the static path. On top of that, the static
path is fsck in a weird way, with file separator from Unix, causing a
mess on Windows platform.
So we give it up as now.
Signed-off-by: Jean-Yves Tinevez <jeanyves.tinevez@gmail.com>
In the same vein as the previous commit...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Interoperability for the win.
Signed-off-by: Jean-Yves Tinevez <jean-yves.tinevez@pasteur.fr>
…rrayImg

Signed-off-by: Jean-Yves Tinevez <jean-yves.tinevez@pasteur.fr>
The Miji.m script adds Fiji.app/jars and Fiji.app/plugins to the MATLAB
classpath by explicitly iterating over *.jar in these directories. Thus
it was not recursing to subdirectories - notably /jars/bio-formats.

The script will now recurse through subdirectories to find jars.

Adapted from: http://stackoverflow.com/questions/2652630/
how-to-get-all-files-under-a-specific-directory-in-matlab
Instead of manually adding filesep let's let MATLAB decide how to make a
full file path.
This proposed change removes a bug I described on imagej-dev . Any other use of javaaddpath, say to develop one's other software, loses the instance of MIJ. This is because javaaddpath automatically calls clear java. By returning the MIJ instance as a workspace object, the MIJ instance will not be cleared. The only change for the user is to call:

MIJ = Miji;

instead of just

Miji;

Signed-off by: Mark Hiner
This changes all relevant scripts from javax.vecmath to
org.scijava.vecmath, since we now ship vecmath as a standard dependency!
Java 3D 1.6 now ships with Fiji. It does not need to be
(and cannot be!) installed separately.
bastelflp and others added 4 commits July 3, 2018 16:54
…pt spam of printing every artifact added to the classpath to the console. Related commit: 2633d12 - Remove `cd ..` to stay in the same directory while loading Miji - Only turn warnings off for: `MATLAB:javaclasspath:jarAlreadySpecified`
@imagejan imagejan changed the title Migrate matlab scripts Migrate MATLAB scripts Jul 3, 2018
@imagejan imagejan requested a review from ctrueden July 3, 2018 15:02
@kouichi-c-nakamura
Copy link
Contributor

Cool!

In the ImageJ side, it may be called scripts, but in MATLAB terminology, many of these files are MATLAB functions rather than scripts. Dialate.m is an ImageJ2-MATLAB script, so it makes sense that it lives in src/main/resources/script_templates. But for others, the name is a bit counterintuitive.

How about a folder named src/main/resources/mfunctions or src/main/resources/mfunctions instead?

Also how about adding a folder called src/main/resources/tests for test code?

bug fix for permute
 ImageJ.m src\scripts\update
@imagejan
Copy link
Member Author

How about a folder named src/main/resources/mfunctions or src/main/resources/mfunctions instead?

My reason for putting the files in src/main/resources/script_templates was for them to be automatically included into the Templates menu of the script editor. But that of course only makes sense for scripts that you'd run from ImageJ. @ctrueden: For those scripts/functions intended to be run from MATLAB, where would be a good place to put them to ensure they'll get uploaded to the update site in the future?

@imagejan
Copy link
Member Author

I now included the changes from #20 (#22) and #21 as well. @kouichi-c-nakamura let me know if any of your changes are missing in this branch, as I merged https://github.com/kouichi-c-nakamura/imagej-matlab/tree/ImageJ_split which hopefully reflects #20.

@kouichi-c-nakamura
Copy link
Contributor

Thank for merging.

With regard to ImageJ_javaaddpath.m, I wanted to have a discussion, but since it's already in this branch, I'll try it here again.

Do you guys agree that just adding Java class paths is equivalent of having a headless ImageJ instance? Or is it equivalent of Miji(false)?

If YES, then I'll get rid of ImageJ_javaaddpath.m and suggest to use ImageJ(false) instead.

If NO, then I'll change the ImageJ.m, so that ImageJ(false) will end up an error as before, while keeping ImageJ_javaaddpath.m.


As to the folder for MATLAB functions to be used from within MATLAB, I suggest to use imagej-matlab/src/scripts/update/, where ImageJ.m lives. ImageJ.m is to be called from within MATLAB, so it'll make perfecet sense.

Another folder to think about is for MATLAB test code. They can live in imagej-matlab/src/scripts/update/, but it might be a little confusing. How about imagej-matlab/src/scripts/update/test?

@ctrueden
Copy link
Member

Unfortunately, I continue to be too busy with other priorities to maintain imagej-matlab properly. However, @kouichi-c-nakamura and @imagejan, if you are both satisfied with the state of this PR, I will merge it as-is; let me know.

In good news, I will be working with @yuminguw to bring him up to speed on this codebase, so that he can start lending a hand with imagej-matlab support and maintenance. It will take some time, but hopefully we can get the project moving again relatively soon.

@ctrueden ctrueden merged commit 405e531 into master Feb 4, 2025
@ctrueden ctrueden deleted the migrate-matlab-scripts branch February 4, 2025 01:03
@ctrueden
Copy link
Member

ctrueden commented Feb 4, 2025

Better late than never...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants