WCHN / CTseg

Brain CT image segmentation, normalisation, skull-stripping and total brain/intracranial volume computation.
GNU General Public License v3.0
62 stars 16 forks source link

Error using websave when running Docker in Windows #22

Closed basicskywards closed 1 year ago

basicskywards commented 1 year ago

Firstly, thank you a lot for creating this useful tool for neuroimaging.

I'm using Docker to run CTseg on Windows.

Command use: docker run --rm -it -v D:\Softwares\CTseg\data:/data ubuntu:ctseg function spm_CTseg '/data/CT.nii.gz'

Issue: image

It seems 'prior_CTseg.mat' and 'mu_CTseg.nii' cannot be downloaded automatically. So my quick solution is I downloaded it manually and saved to my local machine. And now I want to copy it to Docker container and deprecate the 'websave' function. But I hit some questions:

What location in Docker containter should it be copied to? And where can I find spm_CTseg.m so that i can remove websave? Or could you please mind suggesting a better solution?

Thank you a lot again!

gllmflndn commented 1 year ago

Hello @basicskywards The issue probably took place when building the Docker image but this was hidden due to my commit 40e7bcc. The dropbox link works for me so not sure what is going on here but if you did download the files manually and saved them in the same folder than spm_CTseg.m (i.e. the directory of this repo) then if you build the Docker image again, these files will be automatically copied in the image and websave shouldn't be called.

basicskywards commented 1 year ago

Hi @gllmflndn, I got it. I will save those files in the same folder as spm_CTseg.m and build the Docker image again. Thank you a lot for your suggestion!

basicskywards commented 1 year ago

Hi @gllmflndn ,

I put those files in the same folder as spm_CTseg.m like below

image

and then build the Docker image again from the beginning using docker build --no-cache -t ubuntu5:ctseg5 -f CTseg/Dockerfile .. It finished successfully like below image

Unfortunately, when i run docker run --rm -it -v D:\Softwares\CTseg_new\data:/data ubuntu5:ctseg5 function spm_CTseg '/data/CT.nii.gz', i still hit the same issue.

image

Could you please mind helping with this issue?

Thank you a lot!

gllmflndn commented 1 year ago

Hi @basicskywards Sorry, I had forgotten how CTseg's Dockerfile was written and there was no chance my suggestion would have worked here. One solution would be to add a COPY instruction in the Dockerfile to copy the files at their right place in the container but I'm also going to make a new compiled version of SPM+CTseg that will natively contain these files - it might take me a bit of time but I'll let you know when it is available.

gllmflndn commented 1 year ago

I made some changes in the Dockerfile in commit 0f8f780 after having created new compiled versions of SPM that include CTseg. Could you update your repo and try building the container again?

basicskywards commented 1 year ago

Hi @gllmflndn

I got it! I will update my repo and build it again. Thank you so much for your kind support!

gllmflndn commented 1 year ago

The link might change but for now you should be able to pull a pre-built Docker image with:

docker run --rm -it -v dir_host:/data ghcr.io/spm/spm-docker:docker-tbx function spm_CTseg '/data/CT.nii'

(don't forget to replace dir_host with the name of the directory containing the NIfTI file CT.nii.

basicskywards commented 1 year ago

I re-built the Docker image with your updated commit and it worked now. Thank you a lot again @gllmflndn !