Closed soichih closed 6 years ago
The docker container provided in the repository is still work in progress (WIP). It does not work yet, because the FSL and Mrtrix commands are not automatically loaded (.bashrc is not automatically sourced). Apart from that the docker container is ready. I will try to fix this issue soon. If you do not want to wait you can use TractSeg without Docker. That works.
I just realized you are using the docker container from gkoehler90/tractseg. That one is out-dated. As soon as I fixed the docker issue mentioned in the previous comment I will push a new docker image to dockerhub. Until then you should use TractSeg without Docker (or build your own docker container).
@wasserth Thank you for looking into the container issue. I did try to run it without it by installing various dependencies, but I couldn't get it to work after messing around for a while. I can wait for the container to be updated.
@soichih I fixed the issues and now it should work using the following command:
sudo docker run -v /absolute/path/to/my/data/directory:/data \
-t wasserth/tractseg_container:v1.4 TractSeg -i /data/dwi.nii.gz -o /data
On OSX you might have to increase the Docker Memory limit from the default of 2GB to something higher.
Great! Thanks!
I just tested it again (I have to use singularity for our HPC system)
$ singularity exec docker://wasserth/tractseg_container:v1.4 TractSeg -i dwi.nii.gz
...
Creating brain mask...
sh: 1: bet: not found
rm: cannot remove 'tractseg_output/nodif_brain_mask.nii.gz': No such file or directory
mv: cannot stat 'tractseg_output/nodif_brain_mask_mask.nii.gz': No such file or directory
Creating peaks (1 of 3)...
dwi2response: [ERROR] Command failed: mrconvert /home/hayashis/test/tractseg/tractseg_output/nodif_brain_mask.nii.gz /home/hayashis/test/tractseg/dwi2response-tmp-WJAF5I/mask.mif -datatype bit (dwi2response:88)
dwi2response: Output of failed command:
mrconvert: [ERROR] cannot access file "/home/hayashis/test/tractseg/tractseg_output/nodif_brain_mask.nii.gz": No such file or directory
mrconvert: [ERROR] error opening image "/home/hayashis/test/tractseg/tractseg_output/nodif_brain_mask.nii.gz"
dwi2response: Script failed while executing the command: mrconvert /home/hayashis/test/tractseg/tractseg_output/nodif_brain_mask.nii.gz /home/hayashis/test/tractseg/dwi2response-tmp-WJAF5I/mask.mif -datatype bit
dwi2response: For debugging, inspect contents of temporary directory: /home/hayashis/test/tractseg/dwi2response-tmp-WJAF5I/
Creating peaks (2 of 3)...
dwi2fod: [ERROR] cannot access file "tractseg_output/nodif_brain_mask.nii.gz": No such file or directory
dwi2fod: [ERROR] error opening image "tractseg_output/nodif_brain_mask.nii.gz"
Creating peaks (3 of 3)...
sh2peaks: [ERROR] failed to open key/value file "tractseg_output/WM_FODs.mif": No such file or directory
sh2peaks: [ERROR] error opening image "tractseg_output/WM_FODs.mif"
Traceback (most recent call last):
File "/usr/local/bin/TractSeg", line 113, in <module>
data_img = nib.load(join(HP.PREDICT_IMG_OUTPUT, "peaks.nii.gz"))
File "/usr/local/lib/python2.7/dist-packages/nibabel/loadsave.py", line 42, in load
raise FileNotFoundError("No such file or no access: '%s'" % filename)
nibabel.py3k.FileNotFoundError: No such file or no access: 'tractseg_output/peaks.nii.gz'
...
Maybe FSL is not in the PATH?
When I run the docker container FSL is in the PATH. So it is strange that it does not find it when you run it with singularity. I updated the python code so FSL is added to the path right before "bet" is called. So you could try it again. I updated the container on dockerhub (version is still v.1.4, so you might have to deleted your downloaded image first so it will download the new one)
I've cleaned the ~/.singularity/docker directory and rerun, but I am still seeing the same error message.
Creating brain mask...
sh: 1: bet: not found
rm: cannot remove 'tractseg_output/nodif_brain_mask.nii.gz': No such file or directory
mv: cannot stat 'tractseg_output/nodif_brain_mask_mask.nii.gz': No such file or directory
Creating peaks (1 of 3)...
I've also tried running singularity witih -e option which prevents ENV parameter on the host to be set inside the container, but that didn't help either. I think the issue is related to singularity but I haven't really looked into it yet.
Sorry for the late reply. I was on vacation last week. I also think it is an issue with singularity as it works fine with plain Docker on several systems. I never used singularity so I do not know about its details.
OK. I've created my own Dockerfile that works for our environment. Tractseg now seems to work via singularity!
The first thing I noticed though, is that it's downloading the trained model under $HOME/.tractseg. Is there anyway I could pre-stage the model and make it part of my Docker container? - maybe by doing something like RUN curl http:/somewhere/pretrained_weights_tract_segmentation -O someplace
and point Tractseg to use it?
nvm.. I found this on the official Dockerfile
RUN mkdir -p ~/.tractseg \
&& curl -SL -o ~/.tractseg/pretrained_weights_tract_segmentation_v1.npz https://www.dropbox.com/s/nygr0j2zgztedh0/TractSeg_best_weights_ep448.npz?dl=1 \
&& curl -SL -o ~/.tractseg/pretrained_weights_endings_segmentation_v2.npz https://www.dropbox.com/s/l5fa6hhtbv5npvm/EndingsSeg_best_weights_ep176.npz?dl=1 \
&& curl -SL -o ~/.tractseg/pretrained_weights_peak_regression_v1.npz https://www.dropbox.com/s/ogywkbrj3165v3e/PeakReg_best_weights_ep229.npz?dl=1 \
&& curl -SL -o ~/.tractseg/pretrained_weights_dm_regression_v1.npz https://www.dropbox.com/s/d82iv95flz8n5a2/DmReg_best_weights_ep427.npz?dl=1
Great that it works. So far there is not option to change the tractseg home directory from ~/.tractseg
to another place. You would have to change it in the code. But I think inside of the docker container it does not really matter where those weights are located. So ~/.tractseg
should be fine normally.
I am running it through singularity, and it mounts host's home directory by default - wiping out the container's home directory (/root for docker?).
I've done following to hack around it.
export HOME=/
TractSeg -i $dwi -o .
It's ugly.. but it seems to work for now. It would be nice to be able to specify the directory where model is stored though! :)
Hello!
I am trying to run TractSeg via singularity like the following
I have following files in my local directory.
When I run it, I get following error messages.
On my current directory, I see an empty directory created with the name "tracseg_output".
Am I running this in a wrong way?