Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ENH: Try using Python instead of Groovy
  • Loading branch information
pan14001 committed May 18, 2017
1 parent 231559b commit 1b20330
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 54 deletions.
54 changes: 0 additions & 54 deletions src/imagej_open.groovy

This file was deleted.

55 changes: 55 additions & 0 deletions src/imagej_open.py
@@ -0,0 +1,55 @@
# @DatasetIOService ds
# @UIService ui
# @File(label="Raw images directory", description="Images path", style="directory", value="/share/Pariksheet/consultations/rnai-screen-tf/results/z_projection") path
# @String(label="Plate name", choices={"160415_015529-V", "501B102", "502B98", "503B99", "507B99"}) plate
# @String(label="Well", value="C03") well
# @OUTPUT Dataset image

# It looks like the only "ImageJ2" way of opening a single-TIFF
# image series is using the big data viewer:
# http://forum.imagej.net/t/wrap-imageplus-virtualstack-into-imglib2/4154/10
# The big data viewer VirtualStackImageLoader requires an ImagePlus as input.

# Open the image stack and convert to hyperstack
import glob
import os.path

files = glob.glob(os.path.join(str(path), "{}_{}*".format(plate, well)))
files.sort()
# There doesn't seem to be a trivial way to read multiple files.
#ims = [ds.open(filename) for filename in files]
#print(type(ims[0]))
from io.scif.config import SCIFIOConfig
from io.scif.img import ImgOpener
#from io.scif import SCIFIO
import net.imagej.ImageJ as ij

config = (
SCIFIOConfig()
.groupableSetGroupFiles(True)
)
im = ds.open(files[0], config)
print(im)
#ds = ij.scifio()#.datasetIO().open(files[0], config);
#im = ImgOpener().openImg(files[0], config)
#print(dir(im))
#print(im.metadata.getImageCount())

#scifio = SCIFIO()
#reader = scifio.initializer().initializeReader(files[0])
#print(reader.getMetadata().getImageCount())

#from ij import IJ, WindowManager
#IJ.run("Image Sequence...",
# "open={path} file={pattern} sort".format(
# path=path, pattern="{}_{}".format(plate, well)))
#im = WindowManager.getCurrentImage()
#IJ.run("Stack to Hyperstack...",
# "order=xyctz channels=3 slices=1 frames={frames} display=Composite".format(
# frames=im.getNSlices() / 3))
#IJ.Stack.setActiveChannels("011");
#IJ.run("Blue");
#IJ.Stack.setActiveChannels("101");
#IJ.run("Red");
#IJ.Stack.setActiveChannels("110");
#IJ.run("Green");

0 comments on commit 1b20330

Please sign in to comment.