コード例 #1
0
#
# This example Jython script shows how to
# reslice an image in the GPU.
#
#
# Author: Robert Haase, [email protected]
#         October 2019
##########################################

from net.haesleinhuepf.clij import CLIJ;
from ij import IJ;

IJ.run("Close All");

# init CLIJ and GPU
clij = CLIJ.getInstance();

# get an example data set
imp = IJ.openImage("http://imagej.nih.gov/ij/images/t1-head.zip");
imp.show();
imp.setRoi(86,3,100,250);
imp = imp.crop("25-74");
imp.show();

# push it to the GPU
src = clij.push(imp);
# generate the output-image on the GPU with thee right size
dst = clij.create([src.getWidth(), src.getDepth(), src.getHeight()], src.getNativeType());

# Reslice on GPU
clij.op().resliceTop(src, dst);
コード例 #2
0
        return self.finished

    def getCLIJ(self):
        return self.clij2


#imp = IJ.openImage("C:/structure/data/2018-05-23-16-18-13-89-Florence_multisample/processed/tif/000116.raw.tif");
imp = IJ.openImage(
    "https://bds.mpi-cbg.de/CLIJ_benchmarking_data/000461.raw.tif")

from net.haesleinhuepf.clij import CLIJ
from net.haesleinhuepf.clij2 import CLIJ2

# print out available OpenCL devices
print("Available devices:")
for name in CLIJ.getAvailableDeviceNames():
    print(name)

# initialize a hand full of processors
processors = []
for i in range(0, len(CLIJ.getAvailableDeviceNames())):
    processors.append(Processor(CLIJ2(CLIJ(i))))

from java.lang import System

startTime = System.currentTimeMillis()

# loop until a given number of images was processed
processed_images = 0
while (processed_images < 10):
    # go trough all processors and see if one is doing nothing
コード例 #3
0
# clinfo.py
# ===================
#
# Output all information about found GPUs
# (or rather: all found OpenCL devices)
#
# Author: Robert Haase, [email protected]
#         October 2019
#########################################

from ij import IJ
from net.haesleinhuepf.clij import CLIJ

IJ.log(CLIJ.clinfo())
コード例 #4
0
ファイル: spotDetectionpy.py プロジェクト: liorse/clij-docs
# load single image
#imp = IJ.openImage("C:/structure/data/florence/000300.raw.tif");
#IJ.run(imp, "32-bit", "");
#imp.show();

# load sequence
IJ.run("Image Sequence...", "open=[" + data_folder + "] sort use")
IJ.run(
    "Stack to Hyperstack...",
    "order=xyczt(default) channels=1 slices=" + str(number_of_z_planes) +
    " frames=" + str(number_of_images) + " display=Color")
imp = IJ.getImage()

# init GPU
clij = CLIJ.getInstance("1070")

# configure initial scaling step
calib = imp.getCalibration()
scaleX = calib.pixelWidth / calib.pixelDepth * zoom
scaleY = calib.pixelHeight / calib.pixelDepth * zoom
scaleZ = 1.0 * zoom

# initialize state
input = None
formerT = None
resultCylinderMaxProjection = None
resultMaxProjection = None
spots = None
circles = None
blobs = None
コード例 #5
0
ファイル: CLIJDecon.py プロジェクト: imagej/ops-experiments
#@ OpService ops
#@ UIService ui
#@ Dataset data
#@ Dataset psf

from java.lang import System

# init CLIJ and GPU
from net.haesleinhuepf.clij import CLIJ
from net.haesleinhuepf.clij2 import CLIJ2
from net.haesleinhuepf.clijx.plugins import DeconvolveFFT

# show installed OpenCL devices
print CLIJ.getAvailableDeviceNames()

# initialize a device with a given name
clij2 = CLIJ2.getInstance("RTX")
clij2.clear()

print "Using GPU: " + clij2.getGPUName()

# transfer image to the GPU
gpuImg = clij2.push(data)
gpuPSF = clij2.push(psf)

# measure start time
start = System.currentTimeMillis()

# create memory for the output image first
gpuEstimate = clij2.create(gpuImg.getDimensions(), clij2.Float)