PyImageJ
In [1]:
Copied!
import imagej
ij = imagej.init(mode='headless')
print(f"ImageJ2 version: {ij.getVersion()}")
import imagej ij = imagej.init(mode='headless') print(f"ImageJ2 version: {ij.getVersion()}")
[ERROR] Cannot create plugin: org.scijava.plugins.scripting.javascript.JavaScriptScriptLanguage
ImageJ2 version: 2.9.0/1.53t
In [2]:
Copied!
import imagej
from scyjava import jimport
# initialize ImageJ
ij = imagej.init()
print(f"ImageJ version: {ij.getVersion()}")
import imagej from scyjava import jimport # initialize ImageJ ij = imagej.init() print(f"ImageJ version: {ij.getVersion()}")
In [3]:
Copied!
ij = imagej.init('sc.fiji:fiji:2.5.0')
print(f"ImageJ version: {ij.getVersion()}")
ij = imagej.init('sc.fiji:fiji:2.5.0') print(f"ImageJ version: {ij.getVersion()}")
In [4]:
Copied!
web_image = ij.io().open('https://wsr.imagej.net/images/Cell_Colony.jpg')
ij.py.show(web_image)
web_image = ij.io().open('https://wsr.imagej.net/images/Cell_Colony.jpg') ij.py.show(web_image)
[java.lang.Enum.toString] [INFO] Populating metadata [java.lang.Enum.toString] [INFO] Populating metadata [java.lang.Enum.toString] [INFO] Populating metadata
In [5]:
Copied!
HyperSphereShape = jimport('net.imglib2.algorithm.neighborhood.HyperSphereShape')
radius = HyperSphereShape(5)
result = ij.dataset().create(web_image)
ij.op().filter().mean(result, web_image, radius)
ij.py.show(result)
HyperSphereShape = jimport('net.imglib2.algorithm.neighborhood.HyperSphereShape') radius = HyperSphereShape(5) result = ij.dataset().create(web_image) ij.op().filter().mean(result, web_image, radius) ij.py.show(result)
In [6]:
Copied!
ij.py.show(web_image, cmap='hsv')
ij.py.show(web_image, cmap='hsv')