Pipeline 2: CellProfiler tutorials


For this tutorial, we’ll be building a pipeline
to find and select worms for creating a worm module. This is the pipeline you’d want to
run if you’re creating a model for the first time and can be omitted if a previously created
model fits new data. This is the pipeline you would want to run
if you’re creating a model for the first time, and can be emitted if a previously created
model fit new data. To begin, start CellProfiler 2.1, or alternatively,
save any previously created projects and then clear the pipeline. The CellProfiler interface
consists of the pipeline panel to the left, which is divided into input modules, and then
analyses modules. A space for module notes for annotations and a file list will appear
to the right. To provide CellProfiler with image files ti be analyzed, drag and drop
the input image files into the file list space For a model to be able to handle the variability
and shapes seen in a broad spectre of phenotypes, we start by selecting a few images from each
of the L4440Daf2 and pep-1 phenotypes. The goal is to find approximately 40-60 non touching
worms as input for training the model. For the current dataset, select 3 images from
each gene. For example, you can use all the images from wells in row D of the plate. The
input module metadata enables the extraction metadata from file names and folders. In this case, we aren’t making any measurements
and can therefore omit metadata extraction. Next, select the input module names and types.
Set the input image type to color image and assign the images the name RawData. No grouping is needed, so the groups module
can be omitted as well. In order to save the worm model, you’ll need to adjust the output
settings. Click on the view output settings on the bottom left of the CellProfiler interface
and then adjust the default output folder to point tot he folder where you want to store
your output. Once the input modules are set, the analysis
pipeline is built up by inserting modules into the analysis panel. Modules are added
by clicking the plus sign next to adjust modules in the bottom left corner of the interface
to bring up a list of selectable modules. Most object detection methods in CelProfiler
are designed for bright objects in a dark background. Since the input images are color
images with a bright background, the first thing we need to do is to infer the image
pixel intensities. Adding the module called ColorMath located under the module category
ImageProcessing. Add the module by selecting and double clicking
it. The modules now have been added to your analysis pipeline. When the modules selecting
its settings are shown to the panel to the right where they cn be adjusted. For this
module select invert as the operation, call the output image InvertedRaw and select RawData
as the input. Most imaging processing algorithms operate
on greyscale data, so the next thing we do is convert the inverted color image into a
greyscale image in two different ways. First, we add the module ColorToGray and then combine
the red, green, and blue channels of the inverted raw image into a single image that we will
call OrigGray. The image will be used to identify the worms. To see the effect of a module, click on start
test mode. It is now possible to step through the analysis pipeline and monitor the output
at each step. Add another colorToGray module, and this time,
split the red, green, and blue channels, and call them OrigRed, OrigGreen, and OrigBlue. These images will be used for identification
of bubbles and fatty regions. As it turns out, the bubbles have high contrast
in the red image channel and appear brighter than the worms in the inverted image. The
same is true for the edges of the wells visible in the corners of the image. We can detect
both of these structures in the OrigRed image using the Object Identification module IdentifyPrimaryObjects.
Using a manual intensity threshold of .5, and allowing a size range for 10 – 10000 pixels. Make sure not to discard objects touching
the border of the image, as we do not want to lose clusters of worms where only one or
a few worms are partly inside the field of view. In this case, we will not attempt to
separate touching objects, and we will call the output Well_n_Bubbles. We also want to
remove shadows surrounding bubbles and well edges. To do this, we will add the module
Expand or Shrink Objects and select Expand objects by specifying the number of pixels.
And expand the well_n_bubbles pixels by 5 pixels. We will call the output Expanded_well_n_bubbles. Next, we use the masked image module to mask
the OrigGray image with expanded_well_n_bubbles to get a new image, MaskedGreyWithoutArtifacts. Make sure to invert the mask in order to keep
worms and remove artifacts. We will now use IdentifyPrimaryObjects to separate worms and
worm clusters from the image background. With the MaskedGrey image as input, we et the size
range from between 20 pixels and 30000 pixels to remove small debris and ensure that large
worm clusters are kept. We use automated thresholding with global
robust background as the method. Since there�s a risk for empty wells, we also set a minimum
threshold level at 0.09. In this case, we will not attempt to separate touching objects.
Uncheck the fill holes and identify objects setting. Finally, we will give the name WormObjects
to the worm objects. We can view the worm identification results
by stepping through this module in test mode. Add the convert objects to image module to
convert the worm objects to a binary image, calling the output image WormBinary. Add the module UntangleWorms from the worm
toolbox. Set it to untangle using WormBinary as input, and choose both as the overlapping
style. This sets the module to work with overlapping mass when measuring size and shape and non
overlapping mass when measuring intensity. click the box for retaining both kinds of
outlines and set the training set file name to DefaultWormModel.xml file. Again, we can view the untangling result by
stepping through this module in test mode. As, check the result, use Overlay Outlines
to overlay the worm outlines on the original RawData image. select the two outlines and
call the outline image OrigOverlay. Now the worms have been identified through
untangling, we want to begin to extract shape and intensity measurements. We start by adding
MeasureObjectSizeShape to the pipeline and measure from the non-overlapping worm objects. Be sure to deselect the calculate the Zernike
feature setting as these measurements are not relevant in this context and add computational
time. Since the true width of the worms will be
biased by the width of the worm model, we want to extract the actual average width from
the WormObjects. We achieve this by using the Morph module to calculate the distance
transform of the worm binary image. Select Distance as the operation to perform and call
the output image WormWidthsFromBinary. Add the measure object intensity to measure
worm intensities. Select OrigRed, OrigBlue, and WormWidths from binary as the images to
measure. Select non overlapping worms as the objects to measure. The measurements on WormWidthsFromBinary
will provide information about the worm widths, while measurements from OrigRed and origBlue
will provide information on the stain distribution and color. The straightenWorms module from the Worm Toolbox
extracts intensity measurements from subregions of the worms after digitally straightening
the worms and dividing them into a fixed number of transfer segments in longitudinal stripes.
these measurements can provide information on fat is located inside the worm. In this module, we select Non OverlappingWormstoStraigten
and specify the default worm model.xml file as the training set. We then select a single
transfer segment and five longitudinal stripes. Note that if a head marker was available,
all worms could be automatically aligned. We select OrigBlue as the image for measurements.
Before identifying the fat subregions of the worms, we want to mask away all regions in
the image that should not be considered as a worm. We do this by adding the module Mask
Image. Set Orrigbkue as the input image and wormsBinary as the masking image. The OrigBlue image is selected to define a
fatty regions since the ___ has its greatest contrast in the blue image channel. The output
of this module is called MaskedBlue. Now we use OdentifyPrimaryObjects to find the fatty
regions. This time we let their diameter vary in size from 5 pixels to 10,000 pixels and
specify a fixed intensity threshold for whats regarded as fat, set for .4 for this dataset. This fixedThreshold was selecting by trying
a range of thresholds and viewing the result and should be adjusted for a new dataset.
We do not attempt to separate clumped objects, but we do retain the outlines. We will call
the output objects FatObjects and the outlines FatOutlines. Today we will see the detered fat outlines
will be used OverlayOutlines module to add them to the image to which we already outlined
the worms, named OrigOverlay. we do this by adding the module OverlayPOutlines and selecting
OrigOverlay as the image on which to display the outlines, selecting FatOutlines for the
outlines and calling the output image OrigOverlayWithFat. Run the pipeline in test mode and visually
confirm the output. Now extract the shape and intensity measurements
from the FatObjects by adding the module MeasureObjectSizeShape and unchecking the Zernike measurement calculate
again. We also add the module MeasureObjectIntensity
and measure intensity features from the OrigBlue and OrigRed images, with FatObjects as the
selected objects. In order to assign each detecting fatty region
to a worm, we add the module RelateObjects, with FatObjects as the children and NonOVerlappingWormds
as the parents. We also check the calculate per parent means for all child measurements
box to aggregate the fastistics for each worm. Finally, we will save all measurements, segmentation
mass, worm outlines, as well as the images with overlayed outline. Add the module SaveImages
and save the OrigOverlayWithFat image using the RawData file name as the prefix and _RES
as the append a suffix. Next, add another saveImages module to save
the worm outlines as they will be useful later in the machine learning set in CPA. Select the OverLappedWormOutlines as the input,
the RawData file name for
the prefixes above and _outlines as the suffix. Also, check the record file and path information
to the SavedI mage box. Add a third SavedImages modules to save the
segmentation mass called OverlappingWorms and save them as Objects with a file name
extension _worm_objects. The format as .tiff, which is the only format for saving overlapping
objects. These will be used as input for pipeline number four. Export all images to an SQLite
dataset using the ExporttoLite Database module. Choose SQLite as the database type, and label
the experiment MyExperiment. Check the box to create a CPA properties file and choose
nonOverlappingWorms as the objects used for location. The plate type should be 96. Set
the plate metadata to plate and the well metadata to well, and specify that only selected objects
will be used for export and select the NonOverlappingWormObejcts. your pipeline is now complete, so exit test
mode by pressing the ExitTestmode button. Since we’ve finished previewing the results,
the display windows can be closed to save time and memory during the analysis run. Hide
all windows on run from the window menu item to close all the display windows and have
them remain closed during the analysis run. Then press the analyze images button to run
the pipeline on all images. The output will be in SqlLite database with
measurements, a properties file for data exploration in CPA, a set of images showing outlines of
worms and fatty regions on top of the raw data, a set of images without lines only,
and a set of segmentation masks describing the overlapping worms.

Leave a Reply

Your email address will not be published. Required fields are marked *