Segmentation and analysis of zebrafish bones.
For the scale morphology study, see https://github.com/JGIBristol/scale_morphology/.
For the less-neat but more complete original jaw segmentation repository, see https://github.com/JGIBristol/zebrafish_jaw_segmentation.
The Hammond Lab is interested in how bones develop, heal and grow and how this is affected by things like gene expression, time of day, age, sex... They're also interested in their morphology and mechanical properties.
Zebrafish are a useful model organism (for a number of reasons), and the group has a large dataset of CT scanned zebrafish. Segmenting bones from these scans takes a very long time - each CT scan contains around 2000 2d-image slices, manually labelling of which takes a very long time.
AI methods in image segmentation are well established; this repository stores the code for segmentation.
This code was developed and run on Ubuntu 22.04 - it might work on other platforms, but you might need to change some things. If you're on Windows, I'd suggest using WSL.
The python environment here is managed with uv.
To install uv, see the instructions.
Once you have installed uv, set up the python environment by running
uv sync
from the root of this repository.
This repository comes with some pre-trained models for segmenting out the jawbone - if you just want to run inference on some scans, start here.
The user interface is provided here as a collection of python scripts, stored in scripts/, see:
You will need access to the RDSF to train your own models.
This is where the raw data lives, and is accessible only to Univeristy of Bristol researchers. Ask your PI to give you access to the Zebrafish_Osteoarthritis partition.
Mount the RDSF in the usual way - one way that doesn't require superuser is
gio mount smb://rdsfcifs.acrc.bris.ac.uk/Zebrafish_Osteoarthritis
This will mount the RDSF somewhere like /run/user/123456/gvfs/smb-share:server=rdsfcifs.acrc.bris.ac.uk,share=zebrafish_osteoarthritis/.
Have a look in /run/user/ to find the exact path. You can then create a convenient symlink to this directory using ln.
If you can't access the RDSF
If you can't access the RDSF (e.g. you are an external collaborator, reviewer, etc.) then you can still run the code here, but some bits might be more difficult.
Running inference on a complete zebrafish scan doesn't require the RDSF. Pre-trained models are provided with this repo, so you can run inference as normal with the inference script.
Training the models is a little more complicated, since some things are hard-coded relative to the root of the RDSF.
If you don't have RDSF access but do have access to a folder of training data (e.g. one that was deposited as the data for a publication), then you can use this:
- unzip this directory of training data somewhere
- change
rdsf_dirinuserconf.ymlto point to where you unzipped this directory.
This should work, but I haven't tested it.
If you don't have the training data and you want to train a model, you'll have to get access to the training data first.
You will likely want to the a GPU to train the models. As well as the usual BriCS/ACRC computing facilities, the group has a remote machine with an A6000 GPU on it. Ask the right person to get access to this.
See the documentation for instructions on how to train your first model.
If you're coming on to this project, I've created an Issue with suggested first steps to follow and potential future work.