diff --git a/05_ImageJ-macro_programming.pptx b/05_ImageJ-macro_programming.pptx index ff52b11f5f8ac0166cd5278e60a8b3bc7bc77114..3bd0f717e58039c20e7950f10b6038ac63c0b053 100644 Binary files a/05_ImageJ-macro_programming.pptx and b/05_ImageJ-macro_programming.pptx differ diff --git a/05_example_code_and_data/analyse_rounding_assay.ijm b/05_example_code_and_data/analyse_rounding_assay.ijm new file mode 100644 index 0000000000000000000000000000000000000000..3d5267ba0c6a1fa40c0ac33bd9f11989676f95a6 --- /dev/null +++ b/05_example_code_and_data/analyse_rounding_assay.ijm @@ -0,0 +1,26 @@ + +// configuration +folder = "C:/structure/teaching/lecture_applied_bioimage_analysis/05_example_data/rounding_assay/"; +image_file = "rounding_assay0035.tif"; +result_csv_file = "summary.csv"; + +// configure measurement +run("Set Measurements...", "fit shape redirect=None decimal=3"); + +// process imagge +open(folder + image_file); + +setAutoThreshold("MaxEntropy dark"); +setOption("BlackBackground", true); +run("Convert to Mask"); + +// get rid of single pixels +run("Erode"); +run("Dilate"); + +// measure properties +run("Analyze Particles...", "summarize"); + +// save the result table +IJ.renameResults("Summary", "Results"); +saveAs("Results", folder + result_csv_file); diff --git a/05_example_code_and_data/analyse_rounding_assay_folder.ijm b/05_example_code_and_data/analyse_rounding_assay_folder.ijm new file mode 100644 index 0000000000000000000000000000000000000000..fd4c94194e4a663a90845975392bced249fb695c --- /dev/null +++ b/05_example_code_and_data/analyse_rounding_assay_folder.ijm @@ -0,0 +1,34 @@ + +// configuration +folder = "C:/structure/teaching/lecture_applied_bioimage_analysis/05_example_data/rounding_assay/"; +result_csv_file = "summary.csv"; + +// configure measurement +run("Set Measurements...", "fit shape redirect=None decimal=3"); + +// retrieve all files in the folder in an array +filelist = getFileList(folder); + +for (i = 0; i < lengthOf(filelist); i++) { + image_file = filelist[i]; + if ( endsWith(image_file, ".tif")) { + // process imagge + open(folder + image_file); + + setAutoThreshold("MaxEntropy dark"); + setOption("BlackBackground", true); + run("Convert to Mask"); + + // get rid of single pixels + run("Erode"); + run("Dilate"); + + // measure properties + run("Analyze Particles...", "summarize"); + close(); + } +} + +// save the result table +IJ.renameResults("Summary", "Results"); +saveAs("Results", folder + result_csv_file); diff --git a/06_ImageJ-macro_programming.pptx b/06_ImageJ-macro_programming.pptx new file mode 100644 index 0000000000000000000000000000000000000000..6a0f15638fb728cbbb4c9d49eb4fcc2c6f3501ed Binary files /dev/null and b/06_ImageJ-macro_programming.pptx differ diff --git a/06_example_code/save_csv_file.ijm b/06_example_code/save_csv_file.ijm new file mode 100644 index 0000000000000000000000000000000000000000..bceb8622c3f5a692da009c3b488744163a4d5ebf --- /dev/null +++ b/06_example_code/save_csv_file.ijm @@ -0,0 +1,11 @@ +path = "C:/structure/teaching/lecture_applied_bioimage_analysis/06_example_code/test.csv"; + +headline = "Number, number squared"; + +File.append(headline, path); + +for (i = 0; i < 10; i++) { + contentline = "" + i + ", " + pow(i, 2); + File.append(contentline, path); +} + diff --git a/06_example_code/visualise_area_in_colors.ijm b/06_example_code/visualise_area_in_colors.ijm new file mode 100644 index 0000000000000000000000000000000000000000..72fd296f2932a71ae92d6751ad36cb2f5c8d2ff6 --- /dev/null +++ b/06_example_code/visualise_area_in_colors.ijm @@ -0,0 +1,57 @@ +// This script analyses a time lapse of images showing yeast cells. +// It measures their size and visualises +// cells in different colors depending on their features: +// * red: too small +// * green: others +// +// +// Robert Haase, rhaase@mpi-cbg.de +// May 2019 + +// open an image from the rounding assay +open("C:/structure/teaching/lecture_applied_bioimage_analysis/05_example_code_and_data/rounding_assay/rounding_assay0004.tif"); + +// save the window title for later - we want to switch to this image +original_image_title = getTitle(); + +// duplicate the image and segment it +run("Duplicate...", " "); +setAutoThreshold("Triangle dark"); +run("Convert to Mask"); +// binary closing +run("Dilate"); +run("Dilate"); +run("Erode"); +run("Erode"); + +// connected components analysis -> send results to ROI Manager +run("Analyze Particles...", " show=Nothing add"); + +// switch back to original image +selectWindow(original_image_title); +roiManager("Show None"); + +number_of_regions = roiManager("count"); +for (i = 0; i < number_of_regions; i++ ) { + + // measure area ( = pixel count) + run("Set Measurements...", "area redirect=None decimal=3"); + roiManager("Select", i); + roiManager("Measure"); + pixel_count = getResult("Area", nResults - 1); + + // visualise if ROIs are too small or not + if (pixel_count > 10) { + Overlay.addSelection("green"); + } else { + Overlay.addSelection("red"); + } +} + +// clean up after the job is done +if (number_of_regions > 0) { + roiManager("deselect"); + roiManager("delete"); +} +run("Clear Results"); +