/NerveStitcher_R2

NerveStitcher rewrite

Primary LanguagePython

NerveStitcher: Corneal Confocal Microscope Images Stitching with Neural Networks

Introduction

NerveStitcher is a deep learning based corneal confocal microscopic image stitching tool. The tool integrates the functions of microscope vignetting correction and image stitching, and can process corneal nerve images in a pipeline. Input sequential images (without pre-defined acquisition sequences) and output vignetting corrected images and stitching results.

It has extremely high efficiency and accuracy, in our preliminary experiments: NVIDIA GeForce GTX1060 6G stitching time is about 0.331 seconds (per image pair) under GPU hardware acceleration. i5-4460 3.2GHz stitching time is about 0.945 seconds (per image pair) under CPU hardware acceleration.

NerveStitcher was developed by Tianyu Li of TGU-UOW Lab on the basis of SuperGlue.

For more information, please read:
NerveStitcher: Li G, Li T, Li F, et al. NerveStitcher: Corneal confocal microscope images stitching with neural networks[J]. Computers in Biology and Medicine, 2022: 106303. https://doi.org/10.1016/j.compbiomed.2022.106303

Vignetting correction: LI Tianyu,LI Guangxu,ZHANG Chen,et al.Adaptive vignetting correction of corneal nerve microscopy images[J].Optics and Precision Engineering,2022,30(20):2479-2488. DOI: 10.37188/OPE.20223020.2479.

Official Website: TGU-UOW 2022

Usage

Before running, you need to download the model file and replace it in models/weights, here is the link to download the weights: https://drive.google.com/drive/folders/1SgHwGcFwKbV6Bv7OgV1PbqCWmSJgx3jZ?usp=sharing

Note before use that the default image size is 384×384, use English file names and sort well (e.g. zhOD0001.jpg zhOD0002.jpg ...).
NerveStitcher is compatible with .jpg .png .tiff format images.
We provide files to modify the file name and format, please refer to img_rename.py

Make sure that only numbers are sorted when sorting. As in line 14 of make_img_list.py, the current sort is zhOD0001.jpg with the number 0001 (sorted from the fourth positive character to the middle of the fourth negative character), you can modify this sorting rule to match the name of your image. The same code also appears in correction.py line 191.

vignetting correction

Please refer to correction.py , and modify the path and savepath parameters before use.

There are two methods of vignetting correction:

  1. Adaptive correction (not recommended)
    This method will automatically calculate the vignetting parameters for each image, but it is slow and ineffective. If you want to use this method please uncomment line 163 and add comment line 164.
  2. Automatic correction
    This method uses fixed vignetting parameters, which have been verified by our tests to ensure the accuracy of the correction. First, refer to data/reference.jpg to specify the histogram of the original image, and then correct it according to the preset vignetting parameters (line 164).

image stitching

Please refer to stitching.py , modify input_dir (the address of the image data to be stitched), input_pairs_path (the address of the list of images to be stitched), output_viz_dir (the address where the final result is saved), force_cpu (whether to force the CPU or GPU) before using.
The folder structure is based on the example file data/test/stitch_img OR stitch_img2, where the "match" folder holds the final stitching results and the "result" folder holds the results of each stitching.

Contact Us

NerveStitcher can also be used to stitch other microscopy images. Some of the images we have successfully tested are: fundus vascular and thickness OCT images, fundus vascular images.

For additional questions or discussions, Please contact email:

liguangxu@tiangong.edu.cn

litianyu@tiangong.edu.cn

BibTeX Citation

If you use any ideas from the paper or code from this repo, please consider citing:

@article{li2022nervestitcher,
  title={NerveStitcher: Corneal confocal microscope images stitching with neural networks},
  author={Li, Guangxu and Li, Tianyu and Li, Fangting and Zhang, Chen},
  journal={Computers in Biology and Medicine},
  pages={106303},
  year={2022},
  publisher={Elsevier}
}

Copyright

Do not use for commercial purposes without permission.
Copyright (c) 2022 TGU-UOW

TODOs

  • [] fully introduce static typing
  • [] refactor model internals
  • [] better cli
  • [] GUI
  • [] remove legacy code
  • [] implement alternative preprocessing steps
  • [] implement more robust stitching algorithm
  • [] implement offline stitching approach
  • [] implement artefact detection
  • [] implement artefact correction
  • [] implement piecewise stitching