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

Table of Contents

Macro Cell Classifier

  • This macro is part of the "Cell Analysis Tools" macro set.
  • This macro loads (segmented) images (.jpg or .png) and allows the user to classify different objects by clicking on the image.
  • This macro uses the Cell Counter plugin from Fiji (Plugins -> Analyse -> Cell Counter)
  • Using e.g. KNIME classified data from this macro can be combined with e.g. CellProfiler cell data for classification.

Configuration

  1. Start the macro in Fiji under Plugins-> Tools for HCS->Cell Analysis Tools->Macro Cell Classifier
  2. Select the folder with images (e.g. CellProfiler control images)
  3. Select or create the folder for results (classified object list (.txt); classified objects (.xml); list of images that were loaded (.txt))
  4. Dialog “Image File Filter...”
    1. Leave as default will select .jpg images that contain the text "_T0001" (default from CV7000).
    2. Optionally specify the image file extension.
    3. Define text that should be searched in the file path.
    4. Specify what should be dont if this text is found in path
      1. no filtering: nothing will be done
      2. exclude: file containing this text will be excluded from all files found
      3. include: only file are processed that contain this text
    5. Up to 3 consecutive filters can be applied and the output of one filter is the input of the next filter. (Note that filters are applied consecutively and list are not additive (e.g. 1) include GFP, 2) include DAPI will not result in a file list containing file paths with GFP and DAPI)
    6. If check file list is ticked windows with a file list after each filter will be displayd for trouble shooting.
  5. Dialog “Setting for analysis”
    1. Choose between four different modes to load the images as a group:
      1. per well (all images of one well -> e.g. multiple images with same phenotype, CV7000 image name only!)
      2. per field (all images of one fiels -> e.g. one image of different phenotypes, CV7000 image name only!)
      3. per well-field (image by image, CV7000 image name only!)
      4. batch of images (number of images per batch -> e.g. per batch sorted by file name)
    2. If well, field or well-field was selected, unique values can be displyed in a separate window
    3. If batch of images was selected, the number of batches can be specified (this determins the number of images per batch)
  6. Image sets are opened and collapes into a stack:
    1. Image names can be seen in the line below the window name
    2. File names were written into a text file "FileListGroup_....txt" in output folder
      1. This text file contains the group identifier, the slice in the stack and the image path and is important for analysis
    3. The 'Cell Counter' window opened
    4. The 'Interactive Instructions' window guides the user through the analysis (keep this open!)
    5. The 'Action Required' window asks the users to pay attention if more than one Cell Counter windows are open (close the ones you dont need), click 'ok' to go on
  7. Initialize and Setup of Cell Counter
    1. ...and the 'Action Required' window will ask you ...
    2. to press 'Initialize' that the Cell Counter can operate on the opened image(s) (Stack is renamed with prefix 'Counter Window - ')
    3. to set up the classes in the Cell Counter
    4. to follow the instructions in the 'Log' window
    5. Set up the Cell Counter with the help mentioned above, then click 'ok'
    6. In brief:
      1. give useful name to classes useing 'Rename'
      2. set the colors as you want using 'Options'
      3. ATTENTION! always click 'ok', if you clicked 'cancel' restart Fiji to see that Option window again (bug)
      4. see 'Chapter 1' in Log window for more details...
  8. Classify Objects
    1. Follow the instructions of 'Chapter 2' in the Log window
    2. Select a class and do your classifications...
    3. HINT: use the + and - keys to zoom in and out of the image
    4. Press 'ok' in the 'Action Required' window when you are done with the entire stack of images
  9. Saving Classifications
    1. Follow the instructions of 'Chapter 3' in the Log window
    2. The window 'Interactive Instructions' let you mark/select the given file name
    3. Copy/paste these file names to save the markers and the results in output folder
    4. Press 'ok' in the 'Action Required' window when you are really done with saving markers and results
    5. After pressing 'ok' the images will be closed and the next batch will be loaded

Log and List Windows

  1. The log window will document all important information of the macro
    1. Input and output directories
    2. Number of files that were found and fitted the filtering criteria
    3. Defined filter text and method and number of file after each filterig
    4. Number of wells, fields, well field or batches
    5. Name of each opened image and file name of text file containing image path, group and slice in stack
  2. In addition list windows are optionally opened to check the filtering process (see above)
  3. Windows listing the well, fields, well fields and channel are also displayed optionally
  4. The log window will be saved as a log file (.txt) with time stamp in the result folder or with a temp name

Using the Results of this Macro

Raw results are:

  1. Result file with all object data class, x and y coordinates and slice in stack (no class name, no image name!)
  2. The button 'Results' gives a summary of the objects in classes and slices (not used in this macro)
  3. The images paths are written into the text file "FileListGroup_....txt" in output folder
    1. In addition the group identifier and the slice in the stack are stored
    2. Use this information to join with object result table base on group (from file name) and slice
  4. It is useful to store manually the Cell Counter settings in a separate text file
    1. classType as number to join with type in object result table
    2. color as text to adjust manually later the Options if neccessary
    3. class as text to specify the class name in the object table
  5. The .xml data can be used to load the classified data points for the same image group again for reanalysis, continuation or validation (needs same image file name of group, e.g. Counter Window - ImageGroup_etc...)
The x and y coordinates can be used to link object classified here with this macro with other analysis data of these objects (e.g. from CellProfiler) using the k nearest neighbor (kNN) algorithm (e.g. in KNIME)

Issues

  • Cell Counter seemed buggy in some aspects
    • Update Fiji to at least version 1.51k (the previous version behaved weired in some cases)
    • Note the there were problems in updating automatically beyond 1.51j, consider new installation!
  • Re-writing the macro in Java or maybe python would allow access to plugin GUI, e.g. Initialize or saving ...
  • Re-writing the Cell Counter plugin could allow to save classification model, class names, image paths etc. into the .xml file or into the result file

Code

The code you can find here.

Latest changes

  • first release 17-03-2017: first release
⚠️ **GitHub.com Fallback** ⚠️