Macro_Segment2D_in_ROI - stoeter/Fiji-Tools-for-HCS GitHub Wiki

Table of Contents

Macro Segment2D in ROI

  • This macro is part of the "Fish_Embryo_Screen" macro set.
  • This macro loads Opera images (.tif, generated from Macro Opera Stack Montage for Fish) and ROIs (.zip, generated from Macro Select ROI for Segmentation) and does segmentation within the ROI in 2D.
  • The user is enable to adjust several segmentation parameters within the macro, once they are optimized all images will be processed and segmented

Configuration

  1. Start the macro in Fiji under Plugins-> Fiji-Tools-for-HCS->Fish Embryo Screen->
  2. Macro Segment2D in ROI
  3. Select the folder of Opera images (.tif; 8-bit, usually Zmax folder)
  4. Select the folder of ROIs (usually same folder)
  5. Select the folder for results of segmentation (.tif control image and .txt object data lists)
  6. Dialog “Conditions”
    1. Specify the image format (only tif images allowed, usually from previous macro for tiling Opera images).
    2. Adjust numbers of channels
    3. Define start well (macro can be run from that well number on)
  7. Select the channel to use for segmentation and analysis
    1. Tick the channels that suppose to be opened for segmentation and analysis
    2. Specify a tag/text that must be present in the file/path name of the files that will be opened
    3. If Use previous segmentation is ticked all ROIs of the .zip will be used instead of a new segmentation in ROI
  1. Dialog “Which is segmentation channel?”
    1. Select from before given tags/texts which one suppose to be the channel for segmentation
  2. Window ‘Array’ and a dialog “Action Required” will open
    1. Window ‘Array’ displays the files found
    2. If you are done with the file list, press ‘OK’ to go on or ‘Escape’ to stop macro
  3. File by file will be opened and the following options can be selected:
    1. Analyse image? If unchecked, next image will be opened
    2. Stay in manual mode? If unchecked, all following images will be analysed with the current segmentation parameters
    3. Check final control image? If checked, the segmentation image will be displayed with the segmentation outlines

Setting Segmentation Parameters

  • The user has the possibiliy to adjust and verify several parameters for segmentation
  • These parameter are also written to the log file as a documentation
  1. Adjust the segmentation parameter
    1. The auto-threshold can be calculated from pixels in the ROI only or from all pixels of the image
    2. Gaussian blur smoothend the image and reduced noise (default = 1, big radius = very blurred, 0 = no blur)
    3. Background subtraction reduces background intensity (default = 15, big radius = global background, 0 = no subtraction)
    4. Unsharp mask sharpens the enhances contrast (default = 5, big radius = big structures, 0 = no sharpening)
    5. Unsharp mask sharpens the enhances contrast (default = 0.4, weight = 1: maximal effect, 0 = no effect)
    6. Auto-threshold method can be chosen from 16 different methods
    7. If show all auto threshold methods is ticked...
      1. the segmentation result of all method will calculated and displayed (see below)
      2. after closing that window and pressing ok, the macro will go back to this window
    8. Set a minimum size for allowed objects (check this)
    9. Set a maximum size for allowed objects (or check this)
    10. When all parameters are adjusted fine then press to OK to do segmentation and to go on
  2. Optionally other channels will be measured with same segmentation
  3. Macro will save a control image with segmentation outlines as .png (useful to check results)
  4. Object list is saved as a .txt file with the tag "...manualROI_HSCcount.txt" (can be used for further analysis)

Show All Auto-Threshold Methods

  • See detailed description here
  • 16 different algorithms are used and the results are diplayed as a montage
  1. If show all auto threshold methods is ticked all segmentation method are displayed as a montage
  2. Check the numbering / name of the method on the website mentioned above
  3. Zoom in compare the methods with the original image and find the method that gives the best result
  4. Compare the windows "segmentation" or "Result of segmentation" with the original image to judge e.g. blurring and unsharp mask parameters
  5. Check several and different type of images to test if the method of choice works robust with all images
  6. When done press "OK to continue..." and the macro goes back to the previous window

Control Image and Optimization Strategies

  • After segmentation a control image with segmentation outlines is saved as .png and is optionally displayed
  1. Check the segmentation outlines to judge if segmentation parameters were set correctly
  2. Zoom in and maybe open original image to compare the details
  3. Once you are done go on by clicking in window "OK to continue" OK button

More Advices for Optimizing Outcome of the Macro

  • Test several images
  • Test images with very different image content
  • Check intermediate segmentation images (in Show All Auto-Threshold Methods)
  • Make copy of opened image and play around manually with blurring, background correction, etc...
  • Use the Dialog “Conditions” and file list table (column wellIndex) to start with a specific well
  • Re-run the macro with different settings and different output folder to compare different results

Output of the macro

The macro produced the following outputs:

  1. .png, control image in green segmentation image, cyan loaded ROI, red segmentation outlines
  2. .txt, object data with measured parameters counted object list with the tag "...manualROI_HSCcount.txt" (can be processed further)
  3. All parameters set in the script and the files that were saved will be printed in log window and a log file (.txt)

Issues

  • no issues

Code

The code you can find here.

Latest changes

  • fifth release 08-04-2016: release with puplication of paper in JBS
⚠️ **GitHub.com Fallback** ⚠️