Skip to content
Permalink
master
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
// @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
// @File(label="ROI nucleus images directory", description="Images path", style="directory", value="/share/Pariksheet/consultations/rnai-screen-tf/results/cellprofiler/nuc") path_nuc
// @File(label="ROI centromere images directory", description="Images path", style="directory", value="/share/Pariksheet/consultations/rnai-screen-tf/results/cellprofiler/cen") path_cen
// @File(label="ROI ectopic centromere images directory", description="Images path", style="directory", value="/share/Pariksheet/consultations/rnai-screen-tf/results/cellprofiler/ect") path_ect
// @File(label="ROI overlap images directory", description="Images path", style="directory", value="/share/Pariksheet/consultations/rnai-screen-tf/results/cellprofiler/ect_overlap") path_ect_overlap
// @OUTPUT Dataset image
/*
* Open multiple TIFF files as hyperstack and overlay ROIs.
*/
// Use batch mode for speed and protecting user settings.
setBatchMode(true);
// Clear all ROIs.
if (roiManager("count") > 0) {
roiManager("deselect")
roiManager("delete")
}
/** Open hyperstack of the well */
function imOpen(path, plate, well) {
run("Image Sequence...",
" open=" + path +
" file=" + plate + "_" + well +
" sort");
run("Stack to Hyperstack...",
" order=xyctz" +
" channels=3" +
" slices=1" +
" frames=" + nSlices / 3 +
" display=Composite")
Stack.setChannel(1);
run("Blue");
Stack.setChannel(2);
run("Red");
Stack.setChannel(3);
run("Green");
}
//imOpen(path, plate, well);
/** Import ROIs generated by CellProfiler */
function roiOpen(path, plate, well, color) {
run("Image Sequence...",
" open=" + path +
" file=" + plate + "_" + well +
" sort");
getMinAndMax(im_min, im_max);
im_list = getList("image.titles");
orig = im_list[lengthOf(im_list) - 1];
roi_min = roiManager("count");
// Iterate through all the images to add the ROIs to the ROI manager.
for (i = 1; i < 3; i++) {//im_max; i++) {
selectWindow(orig);
run("Duplicate...", "duplicate");
setThreshold(i, i);
run("Convert to Mask", "method=Default background=Dark");
run("Analyze Particles...", "add stack");
close();
}
roi_max = roiManager("count") - 1;
// If any new ROIs were added, set an appropriate color.
if (roi_max + 1 > roi_min) {
roi_ids = newArray();
for (i = roi_min; i <= roi_max; i++)
roi_ids = Array.concat(roi_ids, i);
roiManager("select", roi_ids);
roiManager("Set Color", color);
}
}
roiOpen(path_nuc, plate, well, "blue");
roiOpen(path_cen, plate, well, "green");
roiOpen(path_ect, plate, well, "red");
// Only show ROIS in current slice.
roiManager("Associate", "true");
roiManager("Show All");
setBatchMode(false);