// This code opens raw CZI files from the Microscope using the Bioformats plugin
// The Green Channel images are converted to a binary mask to facilitate quantification
// Then uses the 'Analyze Particles' function to measure the brightness, size, dimensions of fluorescent areas.
// Step 1. Open and load into FIJI
// uses a directory containing raw CZIs
list = getFileList(dir1);
// takes the list of files and defines essential variables
for (i=0; i showProgress(i+1, list.length);
name = File.getName(path);
dir = File.getParent(path);
name2 = substring(name, 0, lastIndexOf(name, "."));
// on our files, channel 0 is the gfp channel.
// import the file, we have variables defined, split into 3 channels. uses raw czi file.
// must have bio-formats importer plugin
run("Bio-Formats Importer", "open=[" + path + "] color_mode=Default split_channels view=Hyperstack");
selectWindow(name + " - C=1");
selectWindow(name + " - C=2");
// create a duplicate gfp channel image; use to create binary mask
run("Duplicate...","duplicate channels=0");
selectWindow(name + " - C=0-1");
// identify, threshold, and outline areas of green fluorescence
// subtract minor background
run("Subtract Background...", "rolling=10");
// Unsharp mask helps to define edges of fluorescent areas
run("Unsharp Mask...", "radius=1 mask=0.60");
// threshold the fluorescent areas
setAutoThreshold("Default dark");
setOption("BlackBackground", false);
// save the binary mask as a TIF
// green fluorescent areas are black, all else is white.
saveAs("Tiff", dir1+list[i]);
// now, load the original raw green channel.
selectWindow(name + " - C=0");
quotedTitle = "'" + orig + "'";
selectWindow(name + " - C=0");
// use binary mask to define areas to measure on the raw channel
// redirect the measurements to the raw green channel
selectWindow(name2 + ".tif");
run("Set Measurements...", "area mean standard min integrated area_fraction limit display add decimal=3 redirect="+quotedTitle);
run("Analyze Particles...", "display exclude summarize in_situ");