Coder Social home page Coder Social logo

Comments (11)

wasserth avatar wasserth commented on August 19, 2024

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.

from tractseg.

wasserth avatar wasserth commented on August 19, 2024

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).

from tractseg.

soichih avatar soichih commented on August 19, 2024

@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.

from tractseg.

wasserth avatar wasserth commented on August 19, 2024

@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.

from tractseg.

soichih avatar soichih commented on August 19, 2024

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?

from tractseg.

wasserth avatar wasserth commented on August 19, 2024

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)

from tractseg.

soichih avatar soichih commented on August 19, 2024

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.

from tractseg.

wasserth avatar wasserth commented on August 19, 2024

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.

from tractseg.

soichih avatar soichih commented on August 19, 2024

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

from tractseg.

wasserth avatar wasserth commented on August 19, 2024

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.

from tractseg.

soichih avatar soichih commented on August 19, 2024

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! :)

from tractseg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.