ANTsX / ANTs

Advanced Normalization Tools (ANTs)
Apache License 2.0
1.21k stars 381 forks source link

Use ants image in docker to complete registration #1723

Closed Schwarao closed 7 months ago

Schwarao commented 7 months ago

Below is the script file I run in the container: image Here, if I replace the -t parameter with SyN, an error will be reported. Why? It is still useful when -t is affine

The error is reported as follows: /usr/local/bin/script.sh: line 16: 20 Killed $reg -d 3 -v 1 --use-histogram-matching 0 --winsorize-image-intensities [0.005, 0.995] -n NearestNeighbor -m MI[/usr/dataaccess/fixed_mask1_25.nii.gz,/usr/dataaccess/linear_mask1_25.nii.gz,1,32] -t SyN[.20,3,0] -c [1000x1000x500x100x0,1.e-6,10] -s 4x3x2x1x0vox -f 32x16x8x4x1 --float 0 -o [${out},${out}_diff.nii.gz,${out}_inv.nii.gz]

cookpa commented 7 months ago

SyN requires significantly more memory, which can lead to the process being killed if there is not enough available

Schwarao commented 7 months ago

SyN 需要更多的内存,如果没有足够的可用内存,这可能会导致进程被终止

My memory is sufficient, and it can be successfully run by calling the script file locally on my computer. Why can't it be done in docker?

Schwarao commented 7 months ago

Is there any master who has the experience to tell me, this is very urgent.

Schwarao commented 7 months ago

I'm using antsx/ants images

Schwarao commented 7 months ago

Or can anyone tell me about antsx/ants and antsx/antspy in dockerhub: latest How do I use the containers created by these two images?

stnava commented 7 months ago

Try reading https://docs.docker.com/config/containers/resource_constraints/

cookpa commented 7 months ago

If you're using docker desktop, there is a memory limit

https://docs.docker.com/desktop/settings/windows/#:~:text=Memory%20limit.,decrease%20it%2C%20lower%20the%20number.

cookpa commented 7 months ago

https://docs.docker.com/desktop/settings/mac/

https://docs.docker.com/desktop/settings/windows/

https://docs.docker.com/desktop/settings/linux/

Schwarao commented 7 months ago

It shouldn't be a problem of insufficient memory, could it be that there is a problem with my shell script configuration? image I still have 18GB of RAM available on my computer when I'm not running programs

cookpa commented 7 months ago

I don't recognize these graphs, but the top right one appears to show 11.68 Gb of memory available.

Schwarao commented 7 months ago

That's right, so why is the program being killed?

stnava commented 7 months ago

the docker container does not have enough memory. that's different than the machine on which the container is being run.

Schwarao commented 7 months ago

ok,i will Use it on a different computer

Schwarao commented 7 months ago

Thanks to both of you, I now put it on the linux host to run docker but I found that linux will use more memory, for example: windows only needs more than 10 G, while linux needs more than 100 G, why is this?

cookpa commented 7 months ago

What are the dimensions of the images?

Schwarao commented 7 months ago

moving: image

fixed: image

cookpa commented 7 months ago

So 400x274x460 and 456x320x528. Those are big images, and the registration needs to store those plus the associated transforms. Simplest solution to reduce footprint would be to run with --float 1.

Schwarao commented 7 months ago

ok,i will try it ,thank you very much.

stnava commented 7 months ago

probably worth trying to blur + downsample