Пример #1
0
def rescaleimp(file_inpath,file_outpath):

	imp = IJ.openImage(file_inpath)
	img = ImgLib.wrap(imp)
	img2 = Resample(img,0.25)
	imp = ImgLib.wrap(img2)
	output = "nrrd=["+file_outpath+"]"
	IJ.run(imp, "Nrrd ... ", output)
Пример #2
0
def rescaleimp(file_inpath, file_outpath):
    """Function to rescale a  single 3D NRRD image """

    imp = IJ.openImage(file_inpath)
    img = ImgLib.wrap(imp)
    img2 = Resample(img, 0.25)
    imp = ImgLib.wrap(img2)
    output = "nrrd=[" + file_outpath + "]"
    IJ.run(imp, "Nrrd ... ", output)
Пример #3
0
def rescale(folder_in,folder_out):
	for filename in os.listdir(folder_in):
		imp =IJ.openImage(os.path.join(folder_in,filename))
		img = ImgLib.wrap(imp)
		img2 = Resample(img,0.25)
		imp=ImgLib.wrap(img2)
		output = "nrrd=["+folder_out+filename+"]"
		IJ.run(imp, "Nrrd ... ", output)
		IJ.run("Collect Garbage", "");
Пример #4
0
def rescale(folder_in, folder_out):
    """Function to rescale 3D NRRD image series"""
    for filename in os.listdir(folder_in):
        imp = IJ.openImage(os.path.join(folder_in, filename))
        img = ImgLib.wrap(imp)
        img2 = Resample(img, 0.25)
        imp = ImgLib.wrap(img2)
        output = "nrrd=[" + folder_out + filename + "]"
        IJ.run(imp, "Nrrd ... ", output)
        imp = None
        img = None
        img2 = None
        gc.collect()
        time.sleep(15)
        gc.collect()
        IJ.run("Collect Garbage", "")
        IJ.run("Collect Garbage", "")
Пример #5
0
from script.imglib.math import Compute, Divide, Multiply, Subtract
from script.imglib.algorithm import Gauss, Scale2D, Resample
from script.imglib import ImgLib
from ij import IJ, WindowManager

# Start Clean
IJ.run("Close All")

# 1. Open an image
imp = IJ.openImage("https://imagej.nih.gov/ij/images/bridge.gif")
ti = imp.getShortTitle()
img = ImgLib.wrap(imp)

# 2. Simulate a brighfield from a Gauss with a large radius
# (First scale down by 4x, then gauss of radius=20, then scale up)
brightfield = Resample(Gauss(Scale2D(img, 0.25), 20), img.getDimensions())

# 3. Simulate a perfect darkfield
darkfield = 0

# 4. Compute the mean pixel intensity value of the image
mean = reduce(lambda s, t: s + t.get(), img, 0) / img.size()

# 5. Correct the illumination
corrected = Compute.inFloats(Multiply(Divide(Subtract(img, brightfield),
                                             Subtract(brightfield, darkfield)), mean))

# 6. ... and show it in ImageJ - it needs to be scaled. This is a 32 bit image
ImgLib.wrap(corrected).show()

# 7. JRM get the displayed image