pnlbwh / dMRIharmonization

Multi-site dMRI harmonization
Other
44 stars 14 forks source link

tmp dir #31

Closed fedemoro closed 4 years ago

fedemoro commented 4 years ago

Since I'm working on the Imperial college HPC I'm not not allowed to write to /tmp (I can use another locations such as $TMPDIR or $EPHEMERAL instead). Can you be so kind to indicate me where in the pipelines I have to change the /tmp folder?

Thanks

Fede

tashrifbillah commented 4 years ago

Hi @fedemoro , I can help you with this hack. But, I must say I am surprised to know of a cluster that doesn't give users write access to /tmp/ folder. However, I am not sure if you would be able to run dMRIharmonization without write access to /tmp folder anyway because ANTs may need to do so. The latter is used throughout the pipeline for registration.

Anyways, do the following:

cd dMRIharmonization/lib

Then, check the occurrences of /tmp/:

grep /tmp *py

buildTemplate.py:config.read(f'/tmp/harm_config_{os.getpid()}.ini')
debug_fa.py:config.read(f'/tmp/harm_config_{os.getpid()}.ini')
harmonization.py:        configFile= f'/tmp/harm_config_{os.getpid()}.ini'
preprocess.py:config.read(f'/tmp/harm_config_{os.getpid()}.ini')
reconstSignal.py:config.read(f'/tmp/harm_config_{os.getpid()}.ini')

You want to replace them with some directory you can write to:

sed -i "s+/tmp/+/home/fede/+g" *py (backslashes are important)

Finally, confirm your change:

grep fede *py

buildTemplate.py:config.read(f'/home/fede/harm_config_{os.getpid()}.ini')
debug_fa.py:config.read(f'/home/fede/harm_config_{os.getpid()}.ini')
harmonization.py:        configFile= f'/home/fede/harm_config_{os.getpid()}.ini'
preprocess.py:config.read(f'/home/fede/harm_config_{os.getpid()}.ini')
reconstSignal.py:config.read(f'/home/fede/harm_config_{os.getpid()}.ini')
fedemoro commented 4 years ago

Thanks @tashrifbillah, i've followed your indication. In order to run the test I did the same in the tests folder and changed also the pipeline pipeline_test.sh (line 20). As you anticipate, an error is still present during the ANTS registration. This is quite strange to me since in he previous version of the harmonization.py (the one before the introduction of the spm package) no errors occurred during this stage.

image

tashrifbillah commented 4 years ago

In your template folder, you should be able to see logs. Those might be helpful to get to the bottom of it.

fedemoro commented 4 years ago

The problem relay on the antsRegistration flag " --random-seed 123456 " (that indeed was not present in the previous version that I was using before). Do you have any comment on this?

ERROR:  Invalid flag provided random-seed
Using single precision for computations.
Input scalar image: /rdsgpfs/general/user/fmoro/home/dMRIharmonization/lib/tests/connectom_prisma/template/template0dwi_C_connectom_st_b1200_resampled_FARepaired.nii.gz
Reference image: /rdsgpfs/general/user/fmoro/home/dMRIharmonization/lib/tests/connectom_prisma/template/template0.nii.gz
Can't read initial transform /rdsgpfs/general/user/fmoro/home/dMRIharmonization/lib/tests/connectom_prisma/template/dwi_C_connectom_st_b1200_resampled_FA40GenericAffine.mat
tashrifbillah commented 4 years ago

Does this say 2.2.0?

antsRegistration --version

fedemoro commented 4 years ago

I thought that I was using the 2.2.0 while instead is 2.1.0!

tashrifbillah commented 4 years ago

I know what you are saying. In the ANTs release page, the above version is tagged as 2.3.0. This anomaly has confused many of us.

So, what you thought to be 2.2.0 (from the ANTs release page), is in fact 2.1.0, which doesn't support --random-seed specification. On the other hand, the seed is necessary for reproduciblity of a template, hence we moved to 2.2.0 (2.3.0 in the ANTs release page). Hope this helps.

fedemoro commented 4 years ago

First I download the new version : conda install ants -c pnlbwh

antsRegistration --version 2.2.0

I set the path in my bash_profile export ANTSPATH=/rds/general/user/fmoro/home/anaconda3/envs/harmonization/bin/

but I still get ERROR: Invalid flag provided random-seed

tashrifbillah commented 4 years ago

Check echo $PATH

It could be the case that you didn't set new ANTs bin before previous ANTs bin.

Remove your previous ANTs bin and do export PATH=$ANTSPATH:$PATH where ANTSPATH is what you already defined.