Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ENH: Play around with ImageJ groovy opener
  • Loading branch information
pan14001 committed May 18, 2017
1 parent 7d4eb47 commit 231559b
Showing 1 changed file with 40 additions and 7 deletions.
47 changes: 40 additions & 7 deletions src/imagej_open.groovy
@@ -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")

0 comments on commit 231559b

Please sign in to comment.