diff --git a/06_ImageJ-macro_programming.pptx b/06_ImageJ-macro_programming.pptx index b20dd7930ad2d7b54c7866825613a57c80e50b1d..1ef751c98bf5fc1b4113a29fd310383d46df312b 100644 Binary files a/06_ImageJ-macro_programming.pptx and b/06_ImageJ-macro_programming.pptx differ 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..01c1a77d0307b329ac1c070da6b912d99b62b72f --- /dev/null +++ b/06_example_code/visualise_area_in_colors.ijm @@ -0,0 +1,47 @@ +// 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"); +