You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Additional example scripts can be found the [examples] directory.
53
+
Note: if there is no image open a "No image" dialog will be shown and execution will be aborted
31
54
32
-
ImageJ Plugin Download
33
-
----------------------
55
+
Note: that the first thing the script does is to import ImageJ's object `IJ` from package `ij`. Object `IJ` contains
56
+
many
57
+
frequently used ImageJ methods, like:
58
+
59
+
*`getImage` - get current image
60
+
*`openImage` - load image from a file
61
+
*`run` - run a plugin or a command
62
+
*`save` - save current image
63
+
*`setSlice` - select slice in current image
64
+
*`showMessage` - display dialog with a message
65
+
66
+
Full list can be found here: https://imagej.nih.gov/ij/developer/api/ij/ij/IJ.html
67
+
68
+
Note: you can use methods contained in `IJ` directly, without prefixing with `IJ`. To do that import a specific method,
69
+
for instance, `import ij.IJ.getImage` or all the available methods `import ij.IJ.*`. Here is a shorted version of the
70
+
above example:
71
+
72
+
```scala
73
+
importij.IJ.*
74
+
75
+
println(getImage)
76
+
```
77
+
78
+
### Run a command "Median..." to process current image
79
+
80
+
You can execute any menu command using `IJ.run` method and providing command name. In simplest form you only provide command name, it will run on the current open image:
81
+
```scala
82
+
importij.IJ.*
83
+
84
+
run("Median...")
85
+
```
86
+
The command may open additional dialog asking for options. If you know what options you want to pass you can do that:
87
+
```scala
88
+
importij.IJ.*
89
+
90
+
run("Median...", "radius=4")
91
+
```
92
+
If you want to control on which image the command runs, you can do that too:
93
+
```scala
94
+
importij.IJ.*
95
+
96
+
valimp= getImage
97
+
run(imp, "Median...", "radius=4")
98
+
```
99
+
The options are listed in a single string using names of fields in the dialog. For boolean values, you use only filed name if value is true (checkbox is checked), you skip the field name of value is false.
100
+
101
+
Hint: You can use Macro Recorder (`Plugins` > `Macros` > `Record`) to record a command then copy it to your script.
102
+
103
+
Additional example scripts can be found the [examples] directory.
34
104
35
-
Binaries can be downloaded from the [releases] page. Extract the binaries to the ImageJ plugins directory. The plugin
0 commit comments