-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathPython06.py
39 lines (29 loc) · 1.12 KB
/
Python06.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#@ImagePlus img
#@Double(label="X radius",value=2.0) xradius
#@Double(label="Y radius",value=2.0) yradius
#@Double(label="Z radius",value=2.0) zradius
# Python06.py
# IJ BAR: https://github.com/tferr/Scripts#scripts
####################################################
# 6. Further examples
####################################################
# This snippet performs a filtering operation on the active image and
# exemplifies how to create a generic, reusable script based on the
# IJ1 API[1]. Input parameters are retrieved using @Parameters[2]
#
# [1] http://javadoc.imagej.net
# [2] https://imagej.net/Script_Parameters
from ij.plugin import Filters3D
from ij import ImagePlus
# Get the image stack within the ImagePlus of img
stack = img.getStack()
# Instantiate ij.plugin.Filters3D
f3d = Filters3D()
# Retrieve filtered stack
newStack = f3d.filter(stack, f3d.MEDIAN, xradius, yradius, zradius)
# Construct a new ImagePlus from the stack
fImg = ImagePlus("Filtered_"+img.getTitle(), newStack);
# Other processing could go here (...)
#IJ.run(fImg, "Shen-Castan Edge Detector", "coefficient=0.50");
# Display result
fImg.show()