Tips/Labeling: Difference between revisions

From MiToBo
Jump to navigationJump to search
(Added links to ImageJ manual)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
__FORCETOC__
= Manual annotation and labeling of cell contours =
Some MiToBo operators like [[Applications/PaCeQuant|PaCeQuant]], [[Applications/ActinAnalyzer2D| ActinAnalyzer2D]] or [[Applications/CytoskeletonAnalyzer2D|CytoskeletonAnalyzer2D]] analyze individual cells in microscope images.<br> Thus, they require information about the cell regions and cell boundaries, respectively, of individual cells.<br> PaCeQuant includes algorithms for automatic cell segmentation, and operators like the CellBoundaryExtractor2D might be used for extracting cell boundaries.<br> However, if automatic segmentation does not work properly and manual post-processing is not an option, cell segmentation can also be performed completely manually.  
Some MiToBo operators like [[Applications/PaCeQuant|PaCeQuant]], [[Applications/ActinAnalyzer2D| ActinAnalyzer2D]] or [[Applications/CytoskeletonAnalyzer2D|CytoskeletonAnalyzer2D]] analyze individual cells in microscope images.<br> Thus, they require information about the cell regions and cell boundaries, respectively, of individual cells.<br> PaCeQuant includes algorithms for automatic cell segmentation, and operators like the CellBoundaryExtractor2D might be used for extracting cell boundaries.<br> However, if automatic segmentation does not work properly and manual post-processing is not an option, cell segmentation can also be performed completely manually.  


Line 11: Line 15:


Note that some operators also accept binary masks. Refer to the documentation of the specific operator for details.
Note that some operators also accept binary masks. Refer to the documentation of the specific operator for details.
Contours can also be represented by line drawings, i.e., images with white (or black) background where the contours are marked as 1-pixel wide lines in black (or white).<br> Such images can easily be converted into a label image using the <i>MiToBo Runner</i> to be found in ImageJ/Fiji via
  Plugins -> MiToBo -> MiToBo Runner
Then select in the package
de - unihalle - informatik - MiToBo - segmentation - regions - labeling
the operator <i>LabelComponentsSequential</i>. To use the operator make sure that your contours have black color on a white background. <br>
If this is not the case, invert the image using the ImageJ/Fiji function
  Edit -> Invert
The outcome of the operator will be a label image which is accepted as input for most MiToBo operators requiring contour or region information.


== Manual labeling in ImageJ/Fiji ==
== Manual labeling in ImageJ/Fiji ==
Line 63: Line 82:
binary mask image as input image. Then press the "Run" button. <br>
binary mask image as input image. Then press the "Run" button. <br>
The result will be a label image which you can save to disk, e.g., in TIF format.
The result will be a label image which you can save to disk, e.g., in TIF format.
== Generating/editing contour images with Gimp and MiToBo ==
In a contour image just the surroundings of the cells are marked. The background of such an image is usually white and the cell boundaries are given as 1-pixel wide lines in black, or vice versa. <br> To create such a representation of the contours in your image proceed as described below. For details about the different functions of Gimp and how to use them please refer to the documentation of Gimp at https://www.gimp.org/docs/. All operations can also be performed with Photoshop or another graphics tool of your choice.
<br>
Create a contour representation for your cell image:
* run Gimp and open the cell image
* add a new transparent layer to your image
* select the pen tool with a size of one pixel (without any smoothing or blurring options)
* use the freehand selection tool to draw the surroundings of your cells to the new layer; once a contour is finished convert it to a path, use the option to trace the path and mark it, e.g., in black; then proceed with the next cell
* when finished delete the layer with your cell image and add a new layer with white background below the contour layer; save the image to disk
<br>
For some MiToBo operators a contour image can directly be used as input, but in most cases label images are required. <br>A label image can be generated from your contour image by using the <i>LabelComponentsSequential</i> operator as described on top of this page.
If you are already given a contour image and you would like to edit the contours proceed as follows:
* open the corresponding cell image in Gimp
* open the contour image as new layer
* add a transparency layer to your image, select the background of your contour image (e.g., with the color selection tool) and remove it from the image pressing 'Ctrl' + 'x';<br> as result you will get an overlay of your cell image with the segmented contours
* you can now either edit the contours directly or invert your selection to extract the contours and convert them to a path on which changes can be performed
* when done, remove the cell image layer, add a new white background layer to your image, and save it to disk

Latest revision as of 12:49, 28 August 2018


Manual annotation and labeling of cell contours

Some MiToBo operators like PaCeQuant, ActinAnalyzer2D or CytoskeletonAnalyzer2D analyze individual cells in microscope images.
Thus, they require information about the cell regions and cell boundaries, respectively, of individual cells.
PaCeQuant includes algorithms for automatic cell segmentation, and operators like the CellBoundaryExtractor2D might be used for extracting cell boundaries.
However, if automatic segmentation does not work properly and manual post-processing is not an option, cell segmentation can also be performed completely manually.

On this page you will find information about manually post-processing segmentation results as well as suggestions how to best perform manual segmentation.

Formats of cell contour data in MiToBo

Most operators in MiToBo accept cell contour information in one of the following formats:

  • label image: an image where the background is black and each cell (or more general: foreground object) is marked with a unique gray value
  • ImageJ ROIs: contour/region data in ImageJ ROI format

Note that some operators also accept binary masks. Refer to the documentation of the specific operator for details.

Contours can also be represented by line drawings, i.e., images with white (or black) background where the contours are marked as 1-pixel wide lines in black (or white).
Such images can easily be converted into a label image using the MiToBo Runner to be found in ImageJ/Fiji via

 Plugins -> MiToBo -> MiToBo Runner

Then select in the package

de - unihalle - informatik - MiToBo - segmentation - regions - labeling

the operator LabelComponentsSequential. To use the operator make sure that your contours have black color on a white background.
If this is not the case, invert the image using the ImageJ/Fiji function

 Edit -> Invert

The outcome of the operator will be a label image which is accepted as input for most MiToBo operators requiring contour or region information.

Manual labeling in ImageJ/Fiji

To manually label the cells in an image in ImageJ/Fiji you can proceed as follows:

Use the freehand tool to surround a cell in the image.
When done, press "t" to add the contour to the ROI manager.
Repeat the same for all other cells in the image.

If ImageJ ROIs are sufficient for your task, simply save the set of contours to file by selecting from the ROI manager

 "More >>" -> "Save..."

and save the ROIs to a file of your choice.

For generating a label image, first set the ImageJ foreground color to black via

Edit -> Options -> Color...

Then select the complete image via

Edit -> Selection -> Select All

Afterwards select

Edit -> Fill

This will fill your complete image in black.

Now change the foreground color to white and select a cell region from the ROI manager. Its contour is shown in the image. Right-click inside the contour and select "Fill". This will make the cell region white.

Proceed with all cell regions from the ROI manager that way.

You should now have a black-white mask image for your cell image.

To transform this mask into a label image navigate in ImageJ/Fiji to

Plugins -> MiToBo -> MiToBo Runner

Then select from the tree of available operators

de - unihalle - informatik - MiToBo - segmentation - regions - labeling

the operator

LabelComponentsSequential

by double-click. This will bring-up a window where you can select your binary mask image as input image. Then press the "Run" button.
The result will be a label image which you can save to disk, e.g., in TIF format.

Generating/editing contour images with Gimp and MiToBo

In a contour image just the surroundings of the cells are marked. The background of such an image is usually white and the cell boundaries are given as 1-pixel wide lines in black, or vice versa.
To create such a representation of the contours in your image proceed as described below. For details about the different functions of Gimp and how to use them please refer to the documentation of Gimp at https://www.gimp.org/docs/. All operations can also be performed with Photoshop or another graphics tool of your choice.


Create a contour representation for your cell image:

  • run Gimp and open the cell image
  • add a new transparent layer to your image
  • select the pen tool with a size of one pixel (without any smoothing or blurring options)
  • use the freehand selection tool to draw the surroundings of your cells to the new layer; once a contour is finished convert it to a path, use the option to trace the path and mark it, e.g., in black; then proceed with the next cell
  • when finished delete the layer with your cell image and add a new layer with white background below the contour layer; save the image to disk


For some MiToBo operators a contour image can directly be used as input, but in most cases label images are required.
A label image can be generated from your contour image by using the LabelComponentsSequential operator as described on top of this page.

If you are already given a contour image and you would like to edit the contours proceed as follows:

  • open the corresponding cell image in Gimp
  • open the contour image as new layer
  • add a transparency layer to your image, select the background of your contour image (e.g., with the color selection tool) and remove it from the image pressing 'Ctrl' + 'x';
    as result you will get an overlay of your cell image with the segmented contours
  • you can now either edit the contours directly or invert your selection to extract the contours and convert them to a path on which changes can be performed
  • when done, remove the cell image layer, add a new white background layer to your image, and save it to disk