R scripts with imageJ functions

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

R scripts with imageJ functions

alobolistas
Is it possible to use Bio7 to include imageJ operations within R scripts?
The equivalent to *.ijm macros but using R as syntax
Thanks
Reply | Threaded
Open this post in threaded view
|

Re: R scripts with imageJ functions

Bio7
Administrator
This post was updated on .
It is possible to call ImageJ from within R with the rJava package.

I started a while ago with a R package to do that with rJava and the ImageJ API. Not finished yet, see:

https://github.com/Bio7/RIJ1/blob/master/test/Rij1test.R

However, you can easily and fast transfer ImageJ data (image pixels, image selection coordinates, Results table) to the R workspace with available available Bio7 functions (and Java API ) and then postprocess the data in R, see:

https://bio7.org/documentation/Main.html#toc-Subsection-4.4.3

This has the advantage to use all ImageJ interface goodies and also create GUI elements (access to SWT and JavaFX to create interfaces, even within Bio7 with a custom GUI view or perspective).

All scripted languages (Groovy, JavaScript, Jython, BeanShell, Java) can access the new Bio7 API or Rserve R API directly (see the following scripts as an example):

https://github.com/Bio7/bio7/tree/master/com.eco.bio7/r_shell_scripts/GIS
https://github.com/Bio7/bio7_examples/tree/master/Bio7_Script_Examples/R_API_Snippets

By the way you an now also access selected R-Shell view variables from within R (a R character vector named '.r_shell_vars') when you want to create R plot scripts from selected variables in the R-Shell (e.g., to extend the scripts menu!)