Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
L
lecture_applied_bioimage_analysis_2020
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rhaase
lecture_applied_bioimage_analysis_2020
Commits
348e0b20
Commit
348e0b20
authored
Jun 12, 2020
by
rhaase
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added results for the count-round-exercise
parent
c79d469b
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
168 additions
and
0 deletions
+168
-0
04_Adv_ImageJ_Macro/example_code/result_shape_count.csv
04_Adv_ImageJ_Macro/example_code/result_shape_count.csv
+65
-0
04_Adv_ImageJ_Macro/example_code/visualise_area_and_shape_in_colors.ijm
...Macro/example_code/visualise_area_and_shape_in_colors.ijm
+103
-0
No files found.
04_Adv_ImageJ_Macro/example_code/result_shape_count.csv
0 → 100644
View file @
348e0b20
This diff is collapsed.
Click to expand it.
04_Adv_ImageJ_Macro/example_code/visualise_area_and_shape_in_colors.ijm
0 → 100644
View file @
348e0b20
//
// This script analyses a time lapse of images showing yeast cells.
// It counts the number of round cells over time and visualises
// cells in different colors depending on their features:
// * red: too small or too large
// * yellow: round (dying)
// * green: elongated (alive)
//
// Robert Haase, rhaase@mpi-cbg.de
// May 2019
//
// configuration
input_folder = "C:/structure/teaching/lecture_applied_bioimage_analysis_2020/03_Feature_extraction_and_ImageJ_Macro/example_images/rounding_assay/";
output_folder = "C:/structure/teaching/lecture_applied_bioimage_analysis_2020/04_Adv_ImageJ_Macro/example_code/";
result_file = "result_shape_count.csv";
// how are round cells identified?
maximum_aspect_ratio = 2;
// size constraints for yeast-cells
minimum_cell_size = 10; // in pixels
maximum_cell_size = 200; // in pixels
// prepare resulting CSV file
if ( File.exists(output_folder + result_file) ) {
File.delete(output_folder + result_file);
}
File.append("File, Number of round cells, Number of elongated cells", output_folder + result_file);
// access the folder
filelist = getFileList(input_folder);
for (i = 0; i < lengthOf(filelist); i++) {
//for (i = 30; i < 31; i++) {
filename = input_folder + filelist[i];
if (endsWith(filename, ".tif")) {
// open an image from the rounding assay
open(filename);
// 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_round_regions = 0;
number_of_elongated_regions = 0;
number_of_regions = roiManager("count");
for (j = 0; j < number_of_regions; j++ ) {
// measure area ( = pixel count) and shape
run("Set Measurements...", "area shape redirect=None decimal=3");
roiManager("Select", j);
roiManager("Measure");
pixel_count = getResult("Area", nResults - 1);
aspect_ratio = getResult("AR", nResults - 1);
// visualise if ROIs are too small or not
if (pixel_count > minimum_cell_size && pixel_count < maximum_cell_size) {
if (aspect_ratio > maximum_aspect_ratio) {
number_of_elongated_regions ++;
Overlay.addSelection("green");
} else {
number_of_round_regions ++;
Overlay.addSelection("yellow");
}
} else {
Overlay.addSelection("red");
}
}
File.append(filename + "," + number_of_round_regions + ", " + number_of_elongated_regions , output_folder + result_file);
// clean up after the job is done
if (number_of_regions > 0) {
roiManager("deselect");
roiManager("delete");
}
run("Clear Results");
run("Flatten");
save(output_folder + filelist[i] + "_result_visualisation.jpg");
run("Close All");
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment