ERROR: (FAILED) attempt to over-write file 3dFWHMx.1D

Hello,

I am running 3dBlurToFWHM, and I sometimes see throught the process an error message:
ERROR: (FAILED) attempt to over-write file 3dFWHMx.1D

I don’t see any problem with the output of this function.
What does this error mean? Am I to be concerned?

Many thanks,

Galit

Hi Galit,

When run with -acf of -ACF, 3dFWHMx will write out the fit and measured ACF parameters to a text file. If you do not specify one, it will write to 3dFWHMx.1D. Since this will generally be executed per run, to overwrite the existing file from a previous run, it just whines about it. If you never look at these files, you probably do not care.

When using afni_proc.py to do this, it specifies an output file name for each run, so that they do not try to overwrite.

  • rick

Thanks Rick,
I plan to run 3dFWHMx on the residuals I get from 3ddeconvolve, to estimate the ACF parameters for the cluster analysis. I used the BlurToFWHM just for smoothing (before 3ddeconvolve). Is there any reason for keeping or using the ACF parameters from this stage? Or can I safely carry on as originally planned, and estimate it after 3ddeconvolve?
Many thanks again,
Galit

Hi Galit,

If you store and carry on the 3 ACF parameters, that should be sufficient. Those .1D files are just informative, e.g. in case you wanted to plot them.

  • rick

Dear AFNI experts,

I get the same error when I run the 3dBlurToFWHM command on my fMRI data, because after the blurring is done, the 3dFWHMx command is run check the results. In this case, since I am not running the 3dFWHMx command, how could I specify a different name for different fMRI data (e.g. different run), in order to have the output of the 3dFWHMx command in a different file (not overwriting on the same 3dFWHMx.1D file)?

Thank you in advance for your answer!

Yours sincerely,
R. Nechifor.

Hi-

This is what the afni_proc.py command runs for residuals typically:


3dFWHMx                                                                      \
    -detrend                                                                 \
    -mask     mask_epi_anat.$subj+tlrc                                       \
    -ACF      files_ACF/out.3dFWHMx.ACF.errts.r$run.1D                       \
    errts.${subj}+tlrc"[$trs]" \
    >> blur.errts.1D

So, for example, you could use:
3dFWHMx
-detrend
-mask MASK_DSET
-ACF ACF_FIT.1D
DSET_TIME_SERIES
>> ACF_PARAMS.1D


... putting in the appropriate datasets.  After running this, you will have ACF_FIT.1D.png, which is a picture of the fit to the data (based on running 1dplot on the also-created ACF_FIT.1D column file).  The ACF_PARAMS.1D will be a commented file with 2 rows of numbers, looking like:

old-style FWHM parameters

0 0 0 0

ACF model parameters for aexp(-rr/(2bb))+(1-a)*exp(-r/c) plus effective FWHM

0.732927 3.10594 10.5977 8.04264


... where the numbers you want for the ACF fit are in that last row.

--pt

Dear PT,

Thank you very much for your detailed and useful explanation! It is indeed important, needed and interesting to know those things!

However, I do not necessary and intentionally run the 3dFWHMx command, therefore I am not actually able to specify any of the options you present, so I am not able to have the output of the -ACF option saved separately (e.g. for each run a different file). In my case I want to blur the image after the preprocessing (before the 1st level analysis) using the 3dBlurToFWHM command. This command (the 3dBlurToFWHM), after is completed, somehow starts automatically the 3dFWHMx command in order to check the blurring process. As I said, since I do not intentionally run the 3dFWHMx, I do not have a full control on the command; more specifically am not able to include all the suggested option for the 3dFWHMx command. My question was, since the 3dFWHMx command is still running in this manner, is there a way to operate it’s options such that those outputs (e.g. 3dFWHM.1D and 3dFWHM.1D.png) will be still saved for each run of the fMRI data?

I was thinking to one solution: since I am not able to operate the options of the 3dFWHMx command, I could save each output of each run of the 3dBlurToFWHM command (so implicitly of the 3dFWHMx command appearing automatically after the 3dBlurToFWHM command) in different folder; in this way will have the data saved using the default name (3dFWHMx.1D and 3dFWHMx.1D.png) but in different folder, so the outputs for different run of the same subject will not overlap; but maybe there are some other more professional/easy way to address this situation.

Thank you in advance for your help!

Yours sincerely,
R. Nechifor.

Hi-

Ah, I see, I misunderstood previously.

Could you please put your 3dBlurToFWHM command here? (And also just to check: I guess you aren’t running this as part of afni_proc.py, is that right, but separately?)

I note that 3dBlurToFWHM does take some additional parameters for outputtng ACF parameters, such as these:


3dBlurToFWHM                                                                 \
    -FWHM    RADIUS_VAL                                                              \
    -mask    DSET_MASK                                           \
    -input   DSET_TIMESERIES_IN                            \
    -prefix  DSET_TIMESERIES_OUT                          \
    -ACF                                                                     \
    > FILE_save_params.1D

After this, FILE_save_params.1D contains the ACF parameters (and its name is controllable. The output PNG should be called DSET_TIMESERIES_OUT.1D.png (created from the column file DSET_TIMESERIES_OUT.1D). Does that allow you to name all the information appropriately?

–pt

Hi,

This is the command I use (of course, with 2 loops for going through all the subjects - 1st loop - and all the runs - 2nd loop):


for ((i=1;i<10;i++)); do

for ((j=1; j<6; j++)); do

3dBlurToFWHM -input ${global_path}2.derivatives/sub-0${i}/func/sub-0${i}_task-stress_run-${j}_space-MNI152NLin6Asym_res-2_desc-preproc_bold.nii.gz
-prefix ${global_path}5.1st_level_analysis/sub-0${i}/func/GLM_INPUT/sub-0${i}_task-stress_run-${j}_space-MNI152NLin6Asym_res-2_desc-preproc_bold_blur.nii.gz
-mask ${global_path}2.derivatives/sub-0${i}/func/sub-0${i}_task-stress_run-${j}_space-MNI152NLin6Asym_res-2_desc-brain_mask.nii.gz
-FWHM 6 -detrend

done

done


And yes, as you mentioned, this command (3dBlurToFWHM) is not part of afni_proc.py; I run this command (3dBlurToFWHM) separately (with the intention to blur the preprocessing output from the fMRIPrep).

As you can see, I don’t have the ACF option for this command (3dBlurToFWHM). However, as I previously mentioned, after the 3dBlurToFWHM command is completed, the 3dFWHMx command appears automatically (in order to check the quality of the 3dBlurToFWHM command), as can be seen in this output:


  • Checking results by running command below:
  • /home/z820/abin/3dFWHMx -arith -detrend -mask /media/z820/Hard_3/SciRel/2.Analysis/2.derivatives/sub-102/func/sub-102_task-rest_space-MNI152NLin6Asym_res-2_desc-brain_mask.nii.gz -input /media/z820/Hard_3/SciRel/2.Analysis/5.1st_level_analysis/sub-102/func/GLM_INPUT/sub-102_task-rest_space-MNI152NLin6Asym_res-2_desc-preproc_bold_blur.nii.gz
    ++ 3dFWHMx: AFNI version=AFNI_23.0.07 (Mar 1 2023) [64-bit]
    ++ Authored by: The Bob

Thank you in advance for your help!

Cheers,
r.

If you want to save all of those files, just rename them in the loop. Move them to the
${global_path}5.1st_level_analysis/sub-0${i}/func/GLM_INPUT
directory, which is already being referenced for the subject in the loop.

The reason they are being overwritten is presumably because they are written to your current directory. So do something like:

for ((i=1;i<10;i++)); do
for ((j=1; j<6; j++)); do

   3dBlurToFWHM -input ${global_path}2.derivatives/sub-0${i}/func/sub-0${i}_task-stress_run-${j}_space-MNI152NLin6Asym_res-2_desc-preproc_bold.nii.gz \
      -prefix ${global_path}5.1st_level_analysis/sub-0${i}/func/GLM_INPUT/sub-0${i}_task-stress_run-${j}_space-MNI152NLin6Asym_res-2_desc-preproc_bold_blur.nii.gz \
      -mask ${global_path}2.derivatives/sub-0${i}/func/sub-0${i}_task-stress_run-${j}_space-MNI152NLin6Asym_res-2_desc-brain_mask.nii.gz \
      -FWHM 6 -detrend

   mv 3dFWHMx.1D ${global_path}5.1st_level_analysis/sub-0${i}/func/GLM_INPUT

done
done

Does that seem reasonable?

  • rick

Hi Rick,

Thanks for your suggestion, which is great!

Because I have 1 run for resting and 5 runs for task fMRI, I decided to generate another sub-folder for each run, and to save the outputs in those folders, in order to avoid overwriting. For this I am doing something like:


for ((i=1;i<133;i++)); do

mkdir 5.1st_level_analysis/sub-${i}
mkdir 5.1st_level_analysis/sub-${i}/func
mkdir 5.1st_level_analysis/sub-${i}/func/GLM_INPUT

for ((j=1; j<6; j++)); do 

mkdir 5.1st_level_analysis/sub-${i}/func/GLM_INPUT/run-${j}

cd 5.1st_level_analysis/sub-${i}/func/GLM_INPUT/run-${j}

3dBlurToFWHM -input ${global_path}2.derivatives/sub-${i}/func/sub-${i}_task-stress_run-${j}_space-MNI152NLin6Asym_res-2_desc-preproc_bold.nii.gz \
-prefix ${global_path}5.1st_level_analysis/sub-${i}/func/GLM_INPUT/sub-${i}_task-stress_run-${j}_space-MNI152NLin6Asym_res-2_desc-preproc_bold_blur.nii.gz \
-mask ${global_path}2.derivatives/sub-${i}/func/sub-${i}_task-stress_run-${j}_space-MNI152NLin6Asym_res-2_desc-brain_mask.nii.gz \
-FWHM 6 -detrend

done

done

Thanks for your useful help!
R. Nechifor.

Sure, that is great. You could also rename the 1D files to include the run index.

  • rick