ANTsX / ANTs

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

Template construction using antsMultivariateTemplateConstruction2.sh does not work properly in Ubuntu #1535

Closed Marjola89 closed 1 year ago

Marjola89 commented 1 year ago

Hi, I am trying to do the template construction on liver 3d images in Ubuntu 20.04.5. I have used antsMultivariateTemplateConstruction2.sh script to produce the template using affine and BSplineSyN non-rigid registration (see scripts below. Although, it works fine in my Mac Monterey system when I try it in my Ubuntu 20.04.5 it fails to produce a temaplate. The error I get is that "can't find initial tranform T_liverx0GenericAffine.mat". So, the script either does not compute that file or it removes it. I also realise that let's say I have 20 organs, the script may produce 6 T_liverx0GenericAffine.mat files but not the rest 14 so it kills the process automatically.

Looking at the (antsMultivariateTemplateConstruction2.sh ) script I can see that it should produce a file like this ${OUTPUTNAME}*GenericAffine.mat but then in line 1417 I can see that it removes it. I am not sure if that is the problem as it works fine in Mac. I have used -b 1 argument to back up the results but it backs up files such as rigid*_0GenericAffine.mat and rigid*_0_liver.nii.gz which are not what I need. I would really appriciate your input. Thanks.

Here is the code I use to construct the template in bth systems (Mac and Ubuntu). While it works fine in Mac it fails in Ubuntu

"${ANTSPATH}"/antsMultivariateTemplateConstruction2.sh \
  -d 3 \
  -b 1 \
  -o ${outputPath}T_ \
  -i 4 \
  -g 0.25 \
  -j 6 \
  -c 2 \
  -k 1 \
  -w 1 \
  -q 100x70x50x10 \
  -n 0 \
  -r 1 \
  -m MI \
  -t BSplineSyN \
  ${inputPath}/*/liver.nii.gz
cookpa commented 1 year ago

I'm not sure what's going on here.

Can you run this example on both systems?

https://github.com/ntustison/TemplateBuildingExample

Marjola89 commented 1 year ago

Hi, Thank you for your response. I investigated this and it seems that my workstation distributes the workload across all the 20 CPU cores even though I specify 6 cores. I tried to use -j 3 or -j 4 and it works fine now. I presume that if this works fine on my Mac and not on my Ubuntu it might be an operating system issue rather than a software issue. Thanks anyway!