Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
ENH: Play around with ImageJ groovy opener
- Loading branch information
Showing
1 changed file
with
40 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,54 @@ | ||
/** | ||
* Overlay CellProfiler ROIs. | ||
* | ||
* Uses ImageJ2 libraries whereever possible. | ||
*/ | ||
|
||
import groovy.io.FileType // Recurse directories per http://stackoverflow.com/a/3954639 | ||
//import ij.io.Opener | ||
//import io.scif.SCIFIO | ||
|
||
import ij.plugin.FolderOpener | ||
|
||
import io.scif.img.ImgOpener | ||
|
||
import net.imglib2.img.display.imagej.ImageJFunctions | ||
|
||
/** Path to project Git repo */ | ||
def prefix = "/share/Pariksheet/consultations/rnai-screen-tf" | ||
def prefix_project = "/share/Pariksheet/consultations/rnai-screen-tf" | ||
|
||
/** | ||
* Read a stack of raw images. | ||
* | ||
* @param plate name of the plate to match | ||
* @param well name of the well in [A-P][01-24] format | ||
*/ | ||
def open = {String plate, String well -> | ||
def dirBg = new File("$prefix/results/z_projection") | ||
def found = [] | ||
dirBg.eachFileMatch(FileType.FILES, ~/${plate}_${well}_.+/) { | ||
found << it.name | ||
def open = { String plate, String well -> | ||
def opener = new FolderOpener() | ||
opener.run() | ||
|
||
// Build a list of the relevant image files. | ||
def dirBg = new File( "${prefix_project}/results/z_projection" ) | ||
def files = [] | ||
dirBg.eachFileMatch( FileType.FILES, ~/${plate}_${well}_.+/ ) { | ||
files << it.name | ||
} | ||
println found | ||
paths = files.collect { "${dirBg}/${it}" } | ||
|
||
//def imp = new Opener().openImage("${prefix}") | ||
|
||
// Open the images as a stack per the scifio tutorial | ||
// https://github.com/scifio/scifio-tutorials | ||
//def scifio = new SCIFIO() | ||
//def reader = scifio.initializer().initializeReader(paths[0]) | ||
//reader.getClass().getMethods().each {println it} | ||
|
||
// Open using imglib2 ImgOpener() as described in wiki examples | ||
// http://imagej.net/ImgLib2_Examples | ||
def imgOpener = new ImgOpener() | ||
def im = imgOpener.openImg( paths[0] ) | ||
//ImageJFunctions.show( im ) | ||
//println im | ||
} | ||
|
||
open("160415_015529-V", "C03") |