quantification of cell spreading
timelapse-stacks-v105.txt
//Macro for ImageJ by
//Michael Cammer cammer@aecom.yu.edu for AIF www.aecom.yu.edu/aif/
//Data presented or published using this/these macro(s)/function(s) or modification(s) thereof
//must acknowledge the "Analytical Imaging Facility at the Albert Einstein College of Medicine"
//and ImageJ as explained at rsb.info.nih.gov/ij/docs/faqs.html
// Michael Cammer 20030118
// macros for cleaning up time series data
//---------------------------------------------
// User selects a ROI in the background of a stack.
// This ROI is measured in each slice and the mean value of each slice is subtracted
// from the correct slice. This corrects for variation in background value over time.
function checkCurrentVersion(){
requires('1.38d');
}
macro 'Subtract background based on ROI'{
checkCurrentVersion();
run("Set Measurements...", " mean redirect=None decimal=0");
run("Plot Z-axis Profile"); run("Close");
for (i=1; i<=nSlices; i++){
bgmean=getResult("Mean",(i-1));
run("Set Slice...", "slice="+i);
run("Select All");
run("Subtract...", "slice value="+bgmean);
}
//-----------------------------------------------
macro 'Multiply to fix bleaching based on ROI'{
checkCurrentVersion();
original = getImageID();
run("Set Measurements...", " mean redirect=None decimal=0");
run("Plot Z-axis Profile"); run("Close");
standard = getResult("Mean",(0));
selectImage(original);
for (i=1; i<=nSlices; i++){
bgmean = standard / getResult("Mean",(i-1));
run("Set Slice...", "slice="+i);
run("Select All");
run("Multiply...", "slice value="+bgmean);
}
//-----------------------------------------------
macro "paste with blend adjacent slices"{
checkCurrentVersion();
original = getImageID();
selectImage(original);
for (i=2;i<=nSlices;i++) {
run("Set Slice...", "slice="+i); run("Select All"); run("Copy");
run("Set Slice...", "slice="+(i-1)); setPasteMode("Average"); run("Paste");
}
selectImage(original);
run("Set Slice...", "slice="+nSlices); run("Delete Slice");
run("Set Slice...", "slice="+1); run("Delete Slice");
run("Brightness/Contrast...");
}
//------------------------------------------
macro "paste with subtract adjacent slices"{
checkCurrentVersion();
original = getImageID();
selectImage(original);
for (i=2;i<=nSlices;i++) {
run("Set Slice...", "slice="+i); run("Select All"); run("Copy");
run("Set Slice...", "slice="+(i-1)); setPasteMode("Subtract"); run("Paste");
}
selectImage(original);
run("Set Slice...", "slice="+nSlices); run("Delete Slice");
run("Set Slice...", "slice="+1); run("Delete Slice");
run("Brightness/Contrast...");
}
//--------------------------------
macro "make test image"{
checkCurrentVersion();
x=0; y=0;
for (i=1;i<=nSlices;i++) {
run("Set Slice...", "slice="+i);
setPixel(x, y, 255); setPixel(round(x*1.25), y, 255);
setPixel(100+(2*random()), 80+(2*random()), 255);
x=x+1; y=y+1;
}
}
//------------------------------------------------------------------
macro 'Projections of variable width'{
checkCurrentVersion();
original = getImageID();
end = nSlices();
zdepth = 4;
projtype = "'Max Intensity'" ; // or 'Average Intensity' or some other type
for (i=1;i<(end-zdepth);i++){
stop = i + zdepth;
run("Z Project...", "start="+i+" stop="+stop+" projection="+projtype);
run("Select All");
run("Copy");
run("Close");
selectImage(original);
run("Set Slice...", "slice="+i);
run("Paste");
}
}
//-------------------------------------------------------------------
macro "Subtract adjacent slices in a stack SLOW"{
checkCurrentVersion();
original = getImageID();
height = getHeight(); width = getWidth(); bits = bitDepth();
run("New...", "name=early type="+bits+"-bit fill=White width="+width+" height="+height+" slices=1");
early = getImageID();
run("New...", "name=late type="+bits+"-bit fill=White width="+width+" height="+height+" slices=1");
late = getImageID();
selectImage(original);
run("Set Slice...", "slice=1"); run("Select All"); run("Copy");
selectImage(late);
run("Paste");
selectImage(original);
for (i=2;i<=nSlices;i++) {
tempvalue = early; early = late; late = tempvalue;
run("Set Slice...", "slice="+i); run("Select All"); run("Copy");
selectImage(early);
run("Paste");
run("Image Calculator...", "image1=late operation=Subtract image2=early create ");
run("Select All"); run("Copy"); run("Close");
selectImage(original);
run("Set Slice...", "slice="+(i-1)); run("Paste");
}
selectImage(early); run("Close");
selectImage(late); run("Close");
selectImage(original); run("Set Slice...", "slice="+nSlices); run("Delete Slice");
run("Set Slice...", "slice="+1); run("Delete Slice");
run("Brightness/Contrast...");
}
//------------------------------------------
quantification of cell spreading
timelapse-stacks-v105.txt
//Macro for ImageJ by
//Michael Cammer cammer@aecom.yu.edu for AIF www.aecom.yu.edu/aif/
//Data presented or published using this/these macro(s)/function(s) or modification(s) thereof
//must acknowledge the "Analytical Imaging Facility at the Albert Einstein College of Medicine"
//and ImageJ as explained at rsb.info.nih.gov/ij/docs/faqs.html
// Michael Cammer 20030118
// macros for cleaning up time series data
//---------------------------------------------
// User selects a ROI in the background of a stack.
// This ROI is measured in each slice and the mean value of each slice is subtracted
// from the correct slice. This corrects for variation in background value over time.
function checkCurrentVersion(){
requires('1.38d');
}
macro 'Subtract background based on ROI'{
checkCurrentVersion();
run("Set Measurements...", " mean redirect=None decimal=0");
run("Plot Z-axis Profile"); run("Close");
for (i=1; i<=nSlices; i++){
bgmean=getResult("Mean",(i-1));
run("Set Slice...", "slice="+i);
run("Select All");
run("Subtract...", "slice value="+bgmean);
}
//-----------------------------------------------
macro 'Multiply to fix bleaching based on ROI'{
checkCurrentVersion();
original = getImageID();
run("Set Measurements...", " mean redirect=None decimal=0");
run("Plot Z-axis Profile"); run("Close");
standard = getResult("Mean",(0));
selectImage(original);
for (i=1; i<=nSlices; i++){
bgmean = standard / getResult("Mean",(i-1));
run("Set Slice...", "slice="+i);
run("Select All");
run("Multiply...", "slice value="+bgmean);
}
//-----------------------------------------------
macro "paste with blend adjacent slices"{
checkCurrentVersion();
original = getImageID();
selectImage(original);
for (i=2;i<=nSlices;i++) {
run("Set Slice...", "slice="+i); run("Select All"); run("Copy");
run("Set Slice...", "slice="+(i-1)); setPasteMode("Average"); run("Paste");
}
selectImage(original);
run("Set Slice...", "slice="+nSlices); run("Delete Slice");
run("Set Slice...", "slice="+1); run("Delete Slice");
run("Brightness/Contrast...");
}
//------------------------------------------
macro "paste with subtract adjacent slices"{
checkCurrentVersion();
original = getImageID();
selectImage(original);
for (i=2;i<=nSlices;i++) {
run("Set Slice...", "slice="+i); run("Select All"); run("Copy");
run("Set Slice...", "slice="+(i-1)); setPasteMode("Subtract"); run("Paste");
}
selectImage(original);
run("Set Slice...", "slice="+nSlices); run("Delete Slice");
run("Set Slice...", "slice="+1); run("Delete Slice");
run("Brightness/Contrast...");
}
//--------------------------------
macro "make test image"{
checkCurrentVersion();
x=0; y=0;
for (i=1;i<=nSlices;i++) {
run("Set Slice...", "slice="+i);
setPixel(x, y, 255); setPixel(round(x*1.25), y, 255);
setPixel(100+(2*random()), 80+(2*random()), 255);
x=x+1; y=y+1;
}
}
//------------------------------------------------------------------
macro 'Projections of variable width'{
checkCurrentVersion();
original = getImageID();
end = nSlices();
zdepth = 4;
projtype = "'Max Intensity'" ; // or 'Average Intensity' or some other type
for (i=1;i<(end-zdepth);i++){
stop = i + zdepth;
run("Z Project...", "start="+i+" stop="+stop+" projection="+projtype);
run("Select All");
run("Copy");
run("Close");
selectImage(original);
run("Set Slice...", "slice="+i);
run("Paste");
}
}
//-------------------------------------------------------------------
macro "Subtract adjacent slices in a stack SLOW"{
checkCurrentVersion();
original = getImageID();
height = getHeight(); width = getWidth(); bits = bitDepth();
run("New...", "name=early type="+bits+"-bit fill=White width="+width+" height="+height+" slices=1");
early = getImageID();
run("New...", "name=late type="+bits+"-bit fill=White width="+width+" height="+height+" slices=1");
late = getImageID();
selectImage(original);
run("Set Slice...", "slice=1"); run("Select All"); run("Copy");
selectImage(late);
run("Paste");
selectImage(original);
for (i=2;i<=nSlices;i++) {
tempvalue = early; early = late; late = tempvalue;
run("Set Slice...", "slice="+i); run("Select All"); run("Copy");
selectImage(early);
run("Paste");
run("Image Calculator...", "image1=late operation=Subtract image2=early create ");
run("Select All"); run("Copy"); run("Close");
selectImage(original);
run("Set Slice...", "slice="+(i-1)); run("Paste");
}
selectImage(early); run("Close");
selectImage(late); run("Close");
selectImage(original); run("Set Slice...", "slice="+nSlices); run("Delete Slice");
run("Set Slice...", "slice="+1); run("Delete Slice");
run("Brightness/Contrast...");
}
//------------------------------------------