Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
rnai-screen-tf/src/imagej_open.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
55 lines (49 sloc)
1.93 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @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"); |