Skip to content

Latest commit

 

History

History
executable file
·
54 lines (38 loc) · 2.26 KB

data_preprocessing.md

File metadata and controls

executable file
·
54 lines (38 loc) · 2.26 KB

Generate Ground Truth Labels

  1. Download and unzip the CoNSeP dataset to the directory ../MCSpatNet_datasets

      wget https://warwick.ac.uk/fac/cross_fac/tia/data/hovernet/consep.zip -P ../MCSpatNet_datasets
      unzip ../datasets/consep.zip -d ../MCSpatNet_datasets
    
  2. cd data_prepare/

  3. Edit 1_generate_dot_maps_consep.py
    Set the variables:
    in_dir points to the CoNSeP train/test directory, and
    out_root_dir points to the training/testing data output directory, respectively.
    Default values are:

      in_dir = '../../MCSpatNet_datasets/CoNSeP/Train' 
      out_root_dir = '../../MCSpatNet_datasets/CoNSeP_train' 
    
  4. Run 1_generate_dot_maps_consep.py

     python 1_generate_dot_maps_consep.py
    

    It will create 2 sub-directories: images and gt_custom in the output folder.
    The generated files are:

    • images/:
      • <img_name>.png: the rescaled images by 0.5 (20x).
    • gt_custom/:
      • <img_name>_gt_dots.npy: the classification dot annotation map.
      • <img_name>_gt_dots_all.npy: the detection dot annotation map.
      • <img_name>.npy: the classification binary mask.
      • <img_name>_all.npy: the detection binary mask.
      • <img_name>_s<class id>_binary.png: visualization of the binary mask for each class (default: 1=inflammatory, 2=epithelial, 3=stromal).
      • <img_name>_binary.png: visualization of the detection binary mask.
      • <img_name>_img_with_dots.jpg: image with cells dot annotation visualization with different dot colors. (default: blue=inflammatory, red=epithelial, green=stromal).
  5. Edit 2_calc_kmaps.py
    Set the variables:
    root_dir points to the CoNSeP train/test directory created in the previous step
    Default value is:

      root_dir = '../../MCSpatNet_datasets/CoNSeP_train' 
    
  6. Run 2_calc_kmaps.py

     python 2_calc_kmaps.py
    

    It will create the sub-directory: k_func_maps in the output folder.
    It generates the cross k function maps. The file names are k_func_maps/<img_name>_gt_kmap.npy

  7. Repeat steps 3-6 with the test data directory:
    Replace CoNSeP/Train with CoNSeP/Test
    Replace CoNSeP_train with CoNSeP_test