from net.imglib2.algorithm.region.hypersphere import HyperSphere; # create an empty image phantom=ops.create().img(array([xSize, ySize], 'l')) # use the randomAccess interface to place points in the image randomAccess= phantom.randomAccess(); randomAccess.setPosition(array([xSize/2, ySize/2], 'l')); randomAccess.get().setReal(255.0); randomAccess.setPosition(array([xSize/4, ySize/4], 'l')); randomAccess.get().setReal(255.0); location = Point(phantom.numDimensions()) location.setPosition(array([3*xSize/4, 3*ySize/4], 'l')); hyperSphere = HyperSphere(phantom, location, 5); for value in hyperSphere: value.setReal(16); display.createDisplay("phantom", phantom) # create psf using the gaussian kernel op (alternatively PSF could be an input to the script) psf=ops.create().kernelGauss(array([10, 10], 'd')); # convolve psf with phantom convolved=ops.filter().convolve(phantom, psf); display.createDisplay("convolved", convolved)
# create an empty image phantom=ops.create().img([xSize, ySize, zSize]) # make phantom an ImgPlus phantom=ops.create().imgPlus(phantom); # use the randomAccess interface to place points in the image randomAccess= phantom.randomAccess() randomAccess.setPosition([xSize/2, ySize/2, zSize/2]) randomAccess.get().setReal(255.0) randomAccess.setPosition([xSize/4, ySize/4, zSize/4]) randomAccess.get().setReal(255.0) location = Point(phantom.numDimensions()) location.setPosition([3*xSize/4, 3*ySize/4, 3*zSize/4]) hyperSphere = HyperSphere(phantom, location, 5) for value in hyperSphere: value.setReal(16) phantom.setName("phantom") # create psf using the gaussian kernel op (alternatively PSF could be an input to the script) psf=ops.create().kernelGauss([5, 5, 5]) # convolve psf with phantom convolved=ops.filter().convolve(phantom, psf) # make convolved an ImgPlus
from net.imglib2.algorithm.region.hypersphere import HyperSphere # create an empty image phantom = ops.create().img(array([xSize, ySize], 'l')) # use the randomAccess interface to place points in the image randomAccess = phantom.randomAccess() randomAccess.setPosition(array([xSize / 2, ySize / 2], 'l')) randomAccess.get().setReal(255.0) randomAccess.setPosition(array([xSize / 4, ySize / 4], 'l')) randomAccess.get().setReal(255.0) location = Point(phantom.numDimensions()) location.setPosition(array([3 * xSize / 4, 3 * ySize / 4], 'l')) hyperSphere = HyperSphere(phantom, location, 5) for value in hyperSphere: value.setReal(16) display.createDisplay("phantom", phantom) # create psf using the gaussian kernel op (alternatively PSF could be an input to the script) psf = ops.create().kernelGauss(array([10, 10], 'd')) # convolve psf with phantom convolved = ops.filter().convolve(phantom, psf) display.createDisplay("convolved", convolved)
#@OUTPUT ImgPlus phantom #@OUTPUT ImgPlus convolved #@OUTPUT ImgPlus deconvolved1 #@OUTPUT ImgPlus deconvolved2 from net.imglib2 import Point from net.imglib2.algorithm.region.hypersphere import HyperSphere xSize = 200 ySize = 200 # create an empty image phantom = ops.create().img([xSize, ySize]) location = Point(phantom.numDimensions()) location.setPosition([xSize / 2, ySize / 2]) hyperSphere = HyperSphere(phantom, location, 20) for value in hyperSphere: value.setReal(16) ui.show("phantom", phantom) psf1 = ops.create().kernelGauss([2, 2]) psf2 = ops.create().kernelGauss([4, 4]) # convolve psf with phantom convolved = ops.filter().convolve(phantom, psf1) deconvolved1 = ops.deconvolve().richardsonLucy(convolved, psf1, 100)