Flag Image allows you to flag an image based on properties that you specify, for example, quality control measurements.
This module allows you to assign a flag if an image meets certain measurement criteria that you specify (for example, if the image fails a quality control measurement). The value of the flag is 1 if the image meets the selected criteria (for example, if it fails QC), and 0 if it does not meet the criteria (if it passes QC). The flag can be used in post-processing to filter out images you do not want to analyze, e.g., in CellProfiler Analyst. In addition, you can use ExportToSpreadsheet to generate a file that includes the flag as a metadata measurement associated with the images. The Metadata module can then use this flag to put images that pass QC into one group and images that fail into another.
A flag can be based on one or more measurements. If you create a flag based on more than one measurement, you can choose between setting the flag if all measurements are outside the bounds or if one of the measurements is outside of the bounds.
This module must be placed in the pipeline after the relevant measurement modules upon which the flags are based.
Settings:
Name the flag's category
Name a measurement category by which to categorize the flag. The
Metadata
category is the default used in CellProfiler to store information about
images (referred to as
metadata).
The flag is stored as a per-image measurement whose name is a combination of the
flag's category and feature name, underscore delimited.
For instance, if the measurement category is
Metadata and the feature name is QCFlag, then the default
measurement name would be Metadata_QCFlag. Please see the Metadata module for more details on metadata collection and usage
Name the flag
The flag is stored as a per-image measurement whose name is a combination of the
flag's category and feature name, separated by underscores.
For instance, if the measurement category is
Metadata and the feature name is QCFlag, then the default
measurement name would be Metadata_QCFlag.
Flag if any, or all, measurement(s) fails to meet the criteria?
- Flag if any fail: An image will be flagged if any of its measurements fail. This can be useful
for flagging images possessing multiple QC flaws; for example, you can flag all bright images
and all out of focus images with one flag.
- Flag if all fail: A flag will only be assigned if all measurements fail. This can be useful
for flagging images that possess only a combination
of QC flaws; for example, you can flag only images that are both bright and out of focus.
Skip image set if flagged?
Select Yes to skip the remainder of the pipeline for image sets
that are flagged. CellProfiler will not run subsequent modules in the
pipeline on the images in any image set that is flagged.
Select No for CellProfiler to continue to process the pipeline regardless
of flagging.
You may want to skip processing in order to filter out
unwanted images. For instance, you may want
to exclude out of focus images when running
CorrectIllumination_Calculate. You can do this with a
pipeline that measures image quality and flags inappropriate
images before it runs CorrectIllumination_Calculate.
Flag is based on
- Whole-image measurement: A per-image measurement, such as intensity or
granularity.
- Average measurement for all objects in each image: The average of all
object measurements in the image.
- Measurements for all objects in each image: All the
object measurements in an image, without averaging. In other words, if any
of the objects meet the criteria, the image will be flagged.
- Rules:Use a text file of rules produced by CellProfiler Analyst. If you
choose Rules, you will have to ensure that this pipeline makes every measurement
in the rules file prior to this module.
Select the object to be used for flagging
(Used only when flag is based on an object measurement)
Select the objects whose measurements you want to use for flagging.
Flag images based on low values?
Select Yes to flag images with measurements below the specified cutoff.
Flag images based on high values?
Select Yes to flag images with measurements above the specified cutoff.
Rules file location
(Used only when flagging using Rules)
Select the location of the rules file that will be used for filtering.
You can choose among the following options which are common to all file input/output
modules:
- Default Input Folder: Use the default input folder.
- Default Output Folder: Use from the default output folder.
- Elsewhere...: Use a particular folder you specify.
- Default input directory sub-folder: Enter the name of a subfolder of
the default input folder or a path that starts from the default input folder.
- Default output directory sub-folder: Enter the name of a subfolder of
the default output folder or a path that starts from the default output folder.
Elsewhere and the two sub-folder options all require you to enter an additional
path name. You can use an absolute path (such as "C:\imagedir\image.tif" on a PC) or a
relative path to specify the file location relative to a directory):
- Use one period to represent the current directory. For example, if you choose
Default Input Folder sub-folder, you can enter "./MyFiles" to look in a
folder called "MyFiles" that is contained within the Default Input Folder.
- Use two periods ".." to move up one folder level. For example, if you choose
Default Input Folder sub-folder, you can enter "../MyFolder" to look in a
folder called "MyFolder" at the same level as the Default Input Folder.
Rules file name
(Used only when flagging using Rules)
The name of the rules file. This file should be a plain text
file containing the complete set of rules.
Each line of
this file should be a rule naming a measurement to be made
on an image, for instance:
IF (Image_ImageQuality_PowerLogLogSlope_DNA < -2.5, [0.79, -0.79], [-0.94, 0.94])
The above rule will score +0.79 for the positive category and -0.94
for the negative category for images whose power log slope is less than -2.5
pixels and will score the opposite for images whose slope is larger.
The filter adds positive and negative and flags the images whose
positive score is higher than the negative score.
Class number
(Used only when flagging using Rules)
Select which classes to flag when filtering. The
CellProfiler Analyst classifier user interface lists the names of
the classes in order. By default, these are the positive (class 1)
and negative (class 2) classes.
FlagImage uses the
first class from CellProfiler Analyst if you choose "1", etc.
Please note the following:
- The flag is set if the image falls into the selected class.
- You can make multiple class selections. If you do so, the module
will set the flag if the image falls into any of the selected classes.