AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
April 12, 2022 01:27PM
Dear all,

this is going to be a longer post, but it is necessary to explain the problem and the single steps that probably brought it up.

I am interested in the power-law exponent (PLE). What is the PLE? The PLE, basically, is the slope of a linear regression applied on the log-log transformation of the frequency-domain. Without going into detail here, the general steps to compute the PLE are as follows:

1. Starting with the preprocessed time-series (e.g., the .errts file), one transforms the time-series into the frequency-domain via 3dPeriodogram or 3dLombScargle.
2. If desired, smoothing can be applied via 3dTsmooth. 3dcalc is then applied for a log-log transformation of the x- and y-axis of the frequency-domain.
3. A linear regression between log(F) and log(P) is applied via 3dfim+.

The output of this computation is a single PLE value for every voxel. One can then use ROIs to compute the average PLE over brain areas. Reported PLE values in fMRI depend on many factors, of course, but are often in the range between ~0.4-1.5.

Now I am working on a dataset that results in way too low PLE values for many subjects, e.g., 0.0068, which is an unrealistic PLE value for an awake subject. A while ago, I worked with the same subjects, yet with another preprocessing script. This script resulted in realistic values for all subjects, e.g., PLE values of 0.4 to 0.8 for the same ROIs.

The script that caused "realistic" PLE values is shown in the following code. This script is not an ordinary SSwarper first and AFNI proc second script, since I faced massive problems in the alignment with these clinical subjects. A colleague then offered me this script.

# 3dWarp
3dWarp \
-deoblique \
-prefix Warp_Anatomical_${subject} \
$directory_raw/anat1to3d+orig

3dWarp \
-deoblique \
-prefix Warp_RestingState_${subject} \
$directory_raw/rest1to3d+orig

3dWarp \
-deoblique \
-prefix Warp_Task_${subject} \
$directory_raw/task1to3d+orig

# Align_epi_anat
align_epi_anat.py \
-epi2anat \
-anat Warp_Anatomical_${subject}+orig \
-epi Warp_RestingState_${subject}+orig \
-child_epi Warp_Task_${subject}+orig \
-epi_base 10 \
-edge \
-partial_axial \
-suffix _Align_epi_anat

# Auto warp - nonlinear registration
auto_warp.py \
-base /applications/afni/abin/MNI152_2009_template_SSW.nii.gz \
-input Warp_Anatomical_${subject}+orig \
-skull_strip_input yes

# 3dbucket
3dbucket \
-DAFNI_NIFTI_VIEW=tlrc \
-prefix anat_ns awpy/Warp_Anatomical_${subject}.aw.nii

3dbucket \
-DAFNI_NIFTI_VIEW=tlrc \
-prefix anat_final awpy/anat.un.aff.qw.nii

cp awpy/anat.un.aff.Xat.1D
cp awpy/anat.un.aff.qw_WARP.nii
cd $directory/awpy

# 3dNwarpApply - Apply a nonlinear 3D warp from 3dQwarp etc. to a 3D dataset
3dNwarpApply \
-master $directory/anat_ns+tlrc -dxyz 3 \
-source $directory/Warp_RestingState_${subject}_Align_epi_anat+orig \
-nwarp "anat.un.aff.qw_WARP.nii anat.un.aff.Xat.1D" \
-prefix $directory/Warp_Align_Nwarp_RestingState_${subject}

3dNwarpApply \
-master $directory/anat_ns+tlrc -dxyz 3 \
-source $directory/Warp_Task_${subject}_Align_epi_anat+orig \
-nwarp "anat.un.aff.qw_WARP.nii anat.un.aff.Xat.1D" \
-prefix $directory/Warp_Align_Nwarp_Task_${subject}

#AFNI proc
afni_proc.py \
-subj_id ${subject}_Rest \
-out_dir $directory/Results \
-dsets \
	$directory_warp/Warp_Align_Nwarp_RestingState_${subject}+tlrc \
-blocks despike tshift volreg mask blur regress \
-copy_anat $directory_warp/anat_final+tlrc \
-anat_has_skull no \
-tcat_remove_first_trs 4 \
-mask_segment_anat yes \
-mask_segment_erode yes \
-regress_anaticor \
-regress_ROI WMe \
-regress_apply_mot_types demean deriv \
-regress_motion_per_run \
-regress_censor_motion 0.3 \
-regress_censor_outliers 0.05 \
-blur_size 6.0 \
-regress_est_blur_epits \
-regress_est_blur_errts \
-html_review_style pythonic \
-execute

While this script works and resulted in the realistic PLE values named above, Paul Taylor explained me that it has some potential flaws. It is better to return to the "SSwarper first - AFNI proc second" original AFNI way of handling things. cool smiley I am happy with that, since it makes things easier anyway. Paul Taylor then helped me a lot and we managed to preprocess all subjects "the AFNI way" with very good alignment results. Consequently, the old unorthodox script was no longer needed.

The new script, first of all, applied deoblique via 3drefit on all anatomical and functional scans, since the data was very oblique. Second, I ran SSwarper without any extra options. The results were very nice. The results were then forwarded to the following AFNI proc script:

afni_proc.py \
-subj_id ${subject}_Rest \
-out_dir $directory_rest/Results \
-dsets \
	$directory_deoblique/Rest1_deoblique+orig \
-blocks despike tshift align tlrc volreg mask blur regress \
-copy_anat $directory_sswarper_1/anatSS.$subject.nii \
-anat_has_skull no \
-tcat_remove_first_trs 4 \
-align_opts_aea -cost lpc+ZZ \
-volreg_align_e2a \
-volreg_align_to MIN_OUTLIER \
-volreg_tlrc_warp -tlrc_base MNI152_2009_template_SSW.nii.gz \
-tlrc_NL_warp \
-tlrc_NL_warped_dsets \
	$directory_sswarper_1/anatQQ.$subject.nii \
	$directory_sswarper_1/anatQQ.$subject.aff12.1D \
	$directory_sswarper_1/anatQQ.${subject}_WARP.nii \
-volreg_post_vr_allin yes \
-volreg_pvra_base_index MIN_OUTLIER \
-mask_segment_anat yes \
-mask_segment_erode yes \
-regress_anaticor \
-regress_ROI WMe CSFe \
-regress_apply_mot_types demean deriv \
-regress_motion_per_run \
-regress_censor_motion 0.35 \
-regress_censor_outliers 0.15 \
-blur_size 8.0 \
-regress_est_blur_epits \
-regress_est_blur_errts \
-html_review_style pythonic \
-execute

The alignment between anatomical-EPI was very nice again, nothing to complain here. Applying the usual Periodogram (or 3dLombScargle) scripts after the above steps both result in meaningless PLE values for many subjects. The frequency range I chose was 0.01-0.25 Hz (my TR=2s).

Here are some things I tried out in order to solve the problem.

- Using the same motion censor level (0.3 and 0.05) instead of 0.35 and 0.15. -> No success, the results remain almost identical
- Using -cenmode NTRP for interpolation of censored TRs. -> No success, the results remain almost identical
- Bandpassing the data (0.01-0.2 Hz). -> Using 3dPeriodogram the PLE for subject 1 increases from 0.006 to 122 (not a typo). 122 is incredible high (and incredible unrealistic, now we have the other extreme). With 3dLombScargle I even reached a PLE of 742 (long-range temporal correlations back to the Dinosaur?). This is really strange, either we have a dead subject (= PLE values of 0.0x or 0.00x), or they project themselves back to times when AFNI was a prophecy told by old and wise men, long before the computer existed (=PLE values of 122 or 742). smileys with beer
- Remove the CSFe from -regress_ROI WMe CSFe, since I read in the AFNI prog page that the regression of CSFe is not really recommended. -> No success, the results remain almost identical

It seems as if the two different options for preprocessing are responsible for the observed PLE differences in some subjects (e.g. 0.006 vs. 0.45). How is this possible? What exactly drives the PLE values in the first (and rather not recommended) preprocessing script to reasonable values. Conversely, what is happening in the second and recommend preprocessing that drastically diminishes PLE values for many subjects?

Thanks for any input,
Philipp



Edited 1 time(s). Last edit at 04/12/2022 01:49PM by Philipp.
Subject Author Posted

3dPeriodogram/3dLombScargle - Preprocessing

Philipp April 12, 2022 01:27PM

Re: 3dPeriodogram/3dLombScargle - Preprocessing

ptaylor April 12, 2022 04:45PM

Re: 3dPeriodogram/3dLombScargle - Preprocessing Attachments

Philipp April 13, 2022 06:41AM

Re: 3dPeriodogram/3dLombScargle - Preprocessing

ptaylor April 13, 2022 08:55AM

Re: 3dPeriodogram/3dLombScargle - Preprocessing

Philipp April 13, 2022 10:23AM