Filter objects
Prerequisites
Before starting this lesson, you should be familiar with:
Learning Objectives
After completing this lesson, learners should be able to:
Remove objects from a label mask image.
Motivation
Once objects have been identified in an image, one often filters the objects based on certain measured criteria. For example, very small objects may be noise rather than real objects and could be removed.
Concept map
graph TD
L("Label image") -->|"remove label(s)"| ML("Modified label image")
Example figure
Activity
Open a label mask image and remove labels (objects) from it. Discuss how filtering can also be done afterwards using a spread-sheet software. Advantages to create a filtered label image.
Show activity for:ImageJ Macro & GUI
run("Close All") // File > Open open("https://github.com/NEUBIAS/training-resources/raw/master/image_data/xy_8bit_labels__nuclei_touchborder.tif") // Plugins › MorphoLibJ › Label Images › Remove Border Labels run("Remove Border Labels", "left right top bottom"); // Plugins › MorphoLibJ › Analyze › Analyze Regions run("Analyze Regions", "area") // Plugins › MorphoLibJ › Label Images › Label Size Filtering run("Label Size Filtering", "operation=Lower_Than size=10000");
Exercises
Show exercises for:ImageJ Macro & GUI
- Open xy_8bit_labels__nuclei_touchborder_2.tif
- Remove objects touching the border
- Create a label mask that contains only the smallest object (metaphase cell)
Solution
run("Close All") // File > Open open("https://github.com/NEUBIAS/training-resources/raw/master/image_data/xy_8bit_labels__nuclei_touchborder_2.tif") // Plugins › MorphoLibJ › Label Images › Remove Border Labels run("Remove Border Labels", "left right top bottom"); // Plugins › MorphoLibJ › Analyze › Analyze Regions run("Analyze Regions", "area") // Plugins › MorphoLibJ › Label Images › Label Size Filtering run("Label Size Filtering", "operation=Lower_Than size=4000");
Assessment
True of false?
- In bioimage analysis one should always remove all labels that touch the image boundary.
- The largest object has the highest label index.
- If you remove one object the number of distinct labels decreases by one.
Solution
- Very often, but not always. Sometimes it also is an option to normalise downstream measurements by the visible size of objects.
- No, the label index usually has no meaning.
- Yes.
Discuss with your neighbour
- Is it a good idea to manually remove objects (labels) from an image or should this rather be an automated procedure?
- What are the pros and cons of removing labels from the image as opposed to keeping all of them and removing the corresponding object measurements later during statisitical analysis of the measurement results?
Solution
- Automated typically is better as it forces you to define objective and reproducible criteria for which objects to remove.
- Very important topic, but too much to write, ask your bioimage analysis consultant ;-)
Follow-up material
We recommend reading these modules next:
Learn more: