Skip to content
Mindy edited this page May 7, 2021 · 11 revisions

Welcome to the gt_pickup_annotation wiki!

Beginning a New Dataset

  1. Create a roi_generation folder inside your dataset folder.
  2. Copy preparation_annotation.sh into roi_generation. Run the script with the name of the folder that contains ROI images.

    $ prepare_annotation.sh [name of ROI image folder]

  3. The script will have created 5 new folders and default masks to start the annotation GUI
    • img_links
    • masks (ROI masks)
    • annotations (.txt files with relative location between the ROI and the section mask)
    • queues (.sjon files that lists the coordinates of your annotations)
    • annot_imgs (image of each section with the ROI drawn in)
  4. Locate and open roi_generation_tutorial_annotation.m and roi_generation_tutorial_writejson.m
  5. For each file, copy and paste the script into a new script window. Save it as a new file.
  6. In your new GridTapeAlign file, search for TODO, to place the necessary files/paths for:
    1. Master path (path to dataset on your machine)
    2. Section mask (to be generated by you based on your dataset)
    3. Slot mask (can be copied from prev. dataset, preferably 8 vertices)
    4. Path to image links (usually the same, masterPath/img_links)
  7. In your new writeJson file, search for TODO and place the necessary files/paths for:
    1. Master path (path to dataset on your machine)
    2. Section mask (to be generated by you based on your dataset)
    3. Slot mask (can be copied from prev. dataset, preferably 8 vertices) ##4. Path to image links (usually the same, masterPath/img_links) ##5. section_mask_ref (a sample of what an annotation file looks like, includes ROI and slot vertices)
    4. ROI_mask (file with the ROI mask, can just be the section_mask)

How to annotate ROIs when section and slot mask annotations have been made already

Staining image annotations are usually done in one of two ways:

(1) When tissue is visible over the slot, imaging ROIs (masks) are annotated directly in the GUI. The annotated section masks are used directly as imaging ROIs.

(2) When tissue is not visible, section masks are annotated using the edges of the sections or other features like knife marks. In this case the section masks can't be used directly as imaging ROIs.

The script writeJson_template.m is meant for case (2). Vnc1 and aedes_r194 scripts are appropriate for case (1). At some point, I'd like to integrate all of these options into the annotation GUI, just need to find the time.

To specify the imaging ROI, you need to

(1) Pick a reference section (ideally one in which you can see both the edges of the section and the tissue)

(2) Using the GUI(GridTapeAlign) "draw new section mask" tool, draw an imaging ROI. It can be any shape. Save it as something like "ROI_mask_sectXXXX.txt" in the masks folder.

(3) We also need the section mask annotation from the reference section (because the relative location between the ROI and the section mask is what matters). To make sure that this doesn't get overwritten, copy the annotation file (annotations/XXXX.txt) into the masks folder and rename it something like "reference_mask_sectXXXX.txt"

(4) Edit the top portion of the writeJson_template.m with the location of the relevant mask files and section ranges. Make sure to put any sections that don't exist or don't have annotations in the "problems list" to be skipped.

(5) Run the script! It should show you an image of each section with the ROI drawn in (and also save this in the annot_imgs folder). Use these images to sanity check that the ROIs look correct. (note, the purple dot should mark the middle of the mask. If it looks off, probably the slot mask annotation was wrong for that section)

Clone this wiki locally