Segmentation of burnt regions on lasered EM grids
To use this create a python environment and install the following packages:
pip install matplotlib mrcfile numpy xmltodict scipy membrain-seg
To run the script the BatchPositionsList.xml and the SearchMap.mrc files from the ThermoFisher tomography software are needed. Additionally, a particles file can optionally be provided together with a key phrase to search for in that file.
python laser_grid_segment.py --batch_positions /path/to/BatchPositionsList.xml --search_maps /path/to/SearchMaps --membrain_ckpt /path/to/membrain/seg/ckpt --output /path/to/output/folder --particles /path/to/particles.star --key particle_name
Due to the way ThermoFisher record the batch locations, the hole positions may not exactly match the search map image. If that is observed, these can be manually shifted with the --x and --y parameters.
Further parameters are available to change the search map downscaling and thresholding, which are unlikely to need adjusting.
The primary output of the script is an adjusted particles star file with distances added as a new column under the _rlnHelicalTubeId key. Text files containing the positions of each batch, and the distance from the burnt region are also made.
Intermediate outputs can be used to assess the quality of the segmentation. Three mrc files are created for each search map: an enhanced map, the map segmented using membrain-seg, and the final mask. For final assessement a jpg file of the positions and segmentation overlaid on the search map is made.
