MIC-DKFZ / TractSeg

Automatic White Matter Bundle Segmentation
Apache License 2.0
227 stars 76 forks source link

Docker_CPU downloads weights to /root/.tractseg, creating complications when running as singularity container #194

Open ajschadler12 opened 2 years ago

ajschadler12 commented 2 years ago

For the purposes of running TractSeg on a local compute cluster, I converted the docker container to a singularity image. However, since Docker_CPU downloads the pre-trained weights to /root/.tractseg/, the converted singularity container cannot access the weights, and subsequently downloads the weights to ${HOME}/.tractseg/.

A potential workaround I have found is to move the weights to a global-readable directory (e.g. /usr/local/share/tractseg) and set TRACTSEG_WEIGHTS_DIR to said directory in /code/startup.sh.

ajschadler12 commented 2 years ago

TractSeg is able to run this way for tract-segmentations and ending-segmentations, but fails for TOM. It tries to find the files in ${HOME}/.tractseg instead of $TRACTSEG_WEIGHTS_DIR. Does this need to be set via an option?

wasserth commented 2 years ago

This is quite strange. For TOM it should look for the weights at the same directory as for tract segmentation. Are you sure inside of your $TRACTSEG_WEIGHTS_DIR you have downloaded the TOM weights? The directory should look similar to the following:

pretrained_weights_endings_segmentation_v4.npz
pretrained_weights_peak_regression_part1_v2.npz
pretrained_weights_peak_regression_part2_v2.npz
pretrained_weights_peak_regression_part3_v2.npz
pretrained_weights_peak_regression_part4_v2.npz
pretrained_weights_tract_segmentation_v3.npz
ajschadler12 commented 2 years ago

Yep, the weights are all there:

Apptainer> echo $TRACTSEG_WEIGHTS_DIR
/usr/local/share/tractseg/
Apptainer> ls $TRACTSEG_WEIGHTS_DIR/
pretrained_weights_dm_regression_v2.npz
pretrained_weights_dm_regression_xtract_v1.npz
pretrained_weights_endings_segmentation_v4.npz
pretrained_weights_peak_regression_part1_v2.npz
pretrained_weights_peak_regression_part2_v2.npz
pretrained_weights_peak_regression_part3_v2.npz
pretrained_weights_peak_regression_part4_v2.npz
pretrained_weights_tract_segmentation_v3.npz
pretrained_weights_tract_segmentation_xtract_v1.npz