Exporting Large Tiled Images
Often high resolution imaging of large objects or specimens is accomplished by tiling many smaller images to create one large high resolution image (also referred to as a montage image). These images are usually provided from the acquisition instrument or software in one of two ways. Often, they are automatically stitched together and provided as one large image. In this case, they must be broken into smaller images for CellProfiler to analyze (due to memory limitations of CellProfiler) and then FCS Express will reassemble the larger image. Alternatively, they are provided as many smaller images. In that case, CellProfiler can analyze the smaller images as they are, and FCS Express will (optionally) reassemble them into a single large image.
In the course of this tutorial we will explain:
• | Image naming conventions needed for FCS Express to import the tiled data processed by CellProfiler. |
• | How to split large images into tiles for segmentation in CellProfiler. |
• | Exporting tiled images in CellProfiler for use in FCS Express |
Naming Conventions for Tiled Images
When reconstructing a series of tiled images FCS Express will use information stored in the filename to piece the images back together. In particular the words "row" and "col" followed by a number indicate the position of the tile in the image. Below are a few examples of this naming convention:
mytiledimage_row00_col00.tif
mytiledimage_row00_col01.tif
mytiledimage_row00_col02.tif
The above file names represent the first three tiles (from left to right) of a tiled image as indicated by their "row" and "col" positions. The words "row" and "col" and the associated tile position should be added at the time of acquisition if possible or post acquisition by manually renaming the files or using a file renaming program.
Starting with a Large Image
Large images may also be analyzed by Cell Profiler and FCS Express. Due to the memory limits of most computers these images must first be "split" into smaller images for image segmentation. We recommend splitting larger images using Total Image Slicer to 500 x 500 pixel squares and setting the File name template as: [name]_row%row_col%col.tiff . (Total image slicer will simultaneously and automatically split the image to discrete squares and rename them with the "rowXX" "colXX" naming convention).
Exporting Tiled Images in CellProfiler for use in FCS Express
The CellProfiler modules that will be discussed in this section are Load Images, Convert Objects to Images, Save Images, and Export to Spreadsheet. The completed pipeline for this example can be found in the Tutorial Sample Data archive within the Exporting Tiled Images in CP folder is named CellProfilerTiledExportCOMPLETED.cp The completed pipeline is meant to be used as a template for comparison to your pipeline and represents the finished product of this tutorial.
The example data set we will be using can be found in the Tutorial Sample Data archive within the Exporting Tiled Images in CP folder is named "In_Situ_Cerebellum_Staining". The sample data set (kindly provided by Dragan Maric, Ph.D) represents a 3 color + bright field experiment in which a portion of a rat cerebellum was imaged. To access the final product of the pipeline and a layout of the data please visit our Applications Examples webpage.
The steps for exporting data from CellProfiler have been broken down by module according to the CellProfilerTiledExport.cp pipeline. After loading the CellProfilerTiledExport.cp pipeline in CellProfiler, follow the steps below to amend the pipeline to prepare for export to FCS Express.
Selecting Default Input and Output Folders
To organize your data correctly for FCS Express, first ensure that the default input (where your images are stored) and output folders in CellProfiler are set to the same folder in the Input/Output Folder window (Figure T24.43).
Note: The DefaultOUT.mat file will also be exported to the Output Folder. This file is for use in MATLAB. If you do not wish to use this file, we recommend deleting it to conserve disk space.
Figure T24.43 Set the Default Input and Output Folders to the Same Location
LoadImages Module Setup
In order for FCS Express to recognize your image data is in a row and column format for a tiled image, metadata from the image file names must be extracted. A Regular Expression must be defined to find the metadata in the file name or path of the data by following these steps (Figure T24.44):
1. | Click on the DAPI- drop-down list labeled Extract metadata from where?. |
2. | Select which metadata you wish to use. For this example, choose File name. |
3. | Enter the "Regular Expression" you wish to use in the field labeled Regular expression that finds metadata in the file name. For this example we will use "_0000_350_DAPI_row(?P<rowtile>[0-9]{1,3})_col(?P<coltile>[0-9]{1,3}).tiff" which defines the row and column information of each tile as found in the image name. |
Notes:
• | Follow these links for a tutorial on "Regular Expressions" and how to translate regular expressions. |
• | Setting up metadata and regular expressions only has to be done for one image in the set. For this example, it has been set up for the DAPI channel. |
• | The regular expression output names: Well, Row, Column, and Col may only be used with plate based or montage imaging experiments. Using any of these names for a single image experiment will result in a non-working export. |
Figure T24.44 Setting up a Regular Expression in the LoadImages Module for a tiled image experiment.
ConvertObjectsToImage Modules
In this module, the objects you have defined through the "Identify Primary/Secondary Objects" module will be converted to image masks that FCS Express will use during import and analysis. See Figure T24.45 for an example of the module window.
4. | Select the first ConvertObjectsToImage module in the pipeline. |
5. | Choose Select the input objects as Nuclei from the drop-down list. |
6. | Name the output image with any name you prefer. For this example, use "Nuclei" (case sensitive). |
7. | Select the color type from the drop-down list and choose uint16 (Figure T24.3). |
8. | Select the second ConvertObjectsToImage module in the pipeline. |
9. | Choose Select the input object as Cells from the drop-down list. |
10. | Name the output image with any name you prefer. For this example, use "Cells" (case sensitive). |
11. | Select the color type from the drop-down list and choose unit16. |
12. | Select the Third ConvertObjectsToImage module in the pipeline. |
13. | Choose Select the input object as Cytoplasm from the drop-down list. |
14. | Name the output image with any name you prefer. For this example, use "Cytoplasm" (case sensitive). |
15. | Select the color type from the drop-down list and choose unit16. |
Note: Repeat steps 4-7 for as many objects you have defined through the Identify Primary/Secondary Objects module when defining your own pipeline.
(Note: In order for FCS Express to properly import the data the Name the output image name must be the same as the Select the input objects name and is case sensitive)
Figure T24.45 ConvertObjectsToImage Module: Defining Nuclei and Cells Image Masks
SaveImages Module
The image masks that were defined in the ConvertObjectsToImage module must now be saved and related to the original images/data.
12. | Select the first SaveImages module in the pipeline. |
13. | Select the type of image to save as Image from the drop-down list. |
14. | Select the image to save as Cells. |
Note: When defining your own pipeline, select the appropriate image you defined in the ConvertObjectsToImage module.
15. | Select method for constructing file names as single name from the drop-down list. |
16. | Enter single file name as any name you prefer followed by a hyphen "_rowtile_columntile". For this example use CellLabel_rowtile_columntile . |
17. | Right-click after CellLabel_rowtile (but before the underscore "_"), choose rowtile. |
18. | Right-click after columntile and choose coltile. |
19. | Select the second SaveImages module in the pipeline. |
20. | Select the type of image to save as Image from the drop-down list. |
21. | Select the image to save as Nuclei. |
22. | Select method for constructing file names as Single name from the drop-down list. |
23. | Enter single file name as any name you prefer followed by a hyphen "_rowtile_columntile". For this example use NucleiLabel_rowtile_columntile . |
24. | Right-click after NucleiLabel_rowtile (but before the underscore "_"), choose rowtile. |
25. | Right-click after columntile and choose coltile. |
26. | Select the third SaveImages module in the pipeline. |
27. | Select the type of image to save as Image from the drop-down list. |
28. | Select the image to save as Cytoplasm. |
29. | Select method for constructing file names as Single name from the drop-down list. |
30. | Enter single file name as any name you prefer followed by a hyphen "_rowtile_columntile". For this example use CytoplasmLabel_rowtile_columntile . |
31. | Right-click after CytoplasmLabel_rowtile (but before the underscore "_"), choose rowtile. |
32. | Right-click after columntile and choose coltile. |
Note: rowtile and coltile are values you defined as regular expressions for the load images module. Using regular expressions allows every output file to be assigned a unique file name based on the text from the input file name. This will prevent output file names from overwriting each other and allows FCS Express to identify the unique image mask associated with each image file.
Perform steps 33-39 on all the SaveImages modules set up for CellLabel, NucleiLabel, and CytoplasmLabel.
33. | Select the format to use as tif from the drop-down list. |
34. | Set Image bit depth at 16 from the drop-down list. |
35. | Choose Default Output Folder from Output file location. |
36. | Check the Overwrite existing files without warning? box. |
37. | Set Select how often to save as Every cycle from the drop-down list. |
38. | Select colormap as gray from the drop-down list. |
39. | Check the Update file names within CellProfiler? box. |
The SaveImages module for CellLabel should now look like Figure T24.46
Figure T24.46 Defining the SaveImages Module
ExportToSpreadsheet Module
Now that all of the images and object image masks have been defined and saved for analysis, you must now ask CellProfiler to export the measurements you wish to view in FCS Express. For this example, we will export selected measurements.
(Note: For more details on only exporting certain parameters please see the Selecting Individual Parameters for CellProlifer Export section)
33. | Select the first ExportToSpreadsheet module. |
34. | Select or enter the column delimiter by choosing Comma (",") from the drop-down list. |
35. | Uncheck the Prepend the output file name to the data file names? box. |
36. | Choose Output file location as Default Output Folder from the drop-down list. |
37. | Uncheck Export all measurements, using default file names?. |
38. | Choose Image from the first Data to export drop-down list. |
39. | Uncheck Use the object name for the file name?. |
40. | Set the file name as Image.cptoc. |
41. | Select the second ExportToSpreadsheet module. |
42. | Select or enter the column delimiter by choosing Comma (",") from the drop-down list. |
43. | Uncheck the Prepend the output file name to the data file names? box. |
44. | Choose Output file location as Default Output Folder from the drop-down list. |
45. | Check the box for Select the columns of measurements to export?. |
Note: In this case measurements have already been chosen for you and the nuclei.cpout file has been setup. Click on the Press to select measurements button to review which measurements have been selected.
46. | Choose Add another data set. |
47. | Choose Cells from the second Data to export drop-down list. |
48. | Uncheck Use the object name for the file name. |
49. | Set the file name as cells.cpout. |
50. | Repeat steps 47-50 for "Cytoplasm" and set the file name as cytoplasm.cpout. |
The second ExportToSpreadsheet module options should look like Figure T24.47 when you are done.
Note 1: on file extensions: ".cptoc" stands for CellProfiler Table of Contents and ".cpout" stands for CellProfiler Output. The "Image.cptoc" file stores information about the location and number of images for all objects processed in the pipeline, while the separate "Nuclei.cpout" and "Cells.cpout" store the actual raw data associated with individual objects and analysis. There should be a separate ".cpout" file defined for each object mask defined in CellProfiler. Only one "Image.cptoc" file is needed.
Note 2:The name of your .cpout file must begin with the name of the object data you are exporting and may only be include the object name and regular expressions. For example: the file names nuclei.cpout and nuclei_<regular express>.cpout will result in a proper export while dataset1nuclei.cpout or <regularexpression>_nuclei.cpout will resulting in a non-working export.
Figure T24.47 The second ExportToSpreadsheet Module Set Up to Export nuclei.cpout, cells.cpout, and cytoplasm.cpout.
46. | Select Analyze images to run the pipeline. The folder where your images are stored will now contain the cells.cpout, nuclei.cpout, cytoplasm.cpout and Image.cptoc files. There will also be a CellLabel, NucleiLabel, and CytoplasmLabel image associated with every original image/well from the tiled data set. |
In the next section, we will import and analyze the Tiled or Montage Image.