Same code, different results

AFNI version info (afni -ver):
Precompiled binary linux_rocky_8: May 9 2024 (Version AFNI_24.1.09 'Publius Septimius Geta')

Dear Colleagues,

Hi. I ran code below twice. The first time I used AFNI_24.0.12. My final conjunction dataset looked about what expected it would look like.

The second time I used AFNI_24.1.08. The code used was identical, and no other differences that I can ascertain are present. This was done to troubleshoot something. My final conjunction dataset looked super odd and not at all like the first iteration. Do you have any ideas on what might have happened?

Sincerely,

Dante

#=========================================================================================
# Conjunction analysis
#
# sstage = 15 arousals
# AAT = 77 arousals
#
# The my_3dclustsim code is weird because it is the same file, but that is okay because
# it creates a nice parallel style and allows all the simulation code to be grouped together.
#=========================================================================================

region=(
    hip
    tha
    pcc
)
for (( h=0 ; h<${#region[@]} ; ++h )) ; do
    # Testing Toggle Territory:
    # Simulation:
    my_3dclustsim=(
        ../output_3dclustsim_${region[h]}_procbasic_ric_rvt_ppga.NN3_1sided.1D
        ../output_3dclustsim_${region[h]}_procbasic_ric_rvt_ppga.NN3_1sided.1D
    )
    my_clust_nvox=(
        $(awk '{if (FNR==9) {print int($3+0.5)}}' ${my_3dclustsim[@]})
    )
    my_olay=(
        ../output_mvm_sstage_${region[h]}_procbasic_ric_rvt_ppga_rz_abs.nii
        ../output_lme_audaro_${region[h]}_procbasic_ric_rvt_ppga_rz_abs.nii
    )
    # Reality:
    # my_3dclustsim=(
    #     output_3dclustsim_${region[h]}_procbasic_ric_rvt_ppga.NN3_1sided.1D
    #     output_3dclustsim_${region[h]}_procbasic_ric_rvt_ppga.NN3_1sided.1D
    # )
    # my_clust_nvox=(
    #     $(awk '{if (FNR==9) {print int($3+0.5)}}' ${my_3dclustsim[@]})
    # )
    # my_olay=(
    #     output_mvm_sstage_${region[h]}_procbasic_ric_rvt_ppga_rz_abs.nii
    #     output_lme_audaro_${region[h]}_procbasic_ric_rvt_ppga_rz_abs.nii
    # )
    my_subbricks=(
        2
        1
    )
    my_suffix=(
        nothrpvthrclthr_subsample_sstage_-SC-_F
        nothrpvthrclthr_fullsample_AAT_Chi-sq
    )
    printf "%s\n" ${my_olay[@]}
    printf "%s\n" ${my_subbricks[@]}
    printf "%s\n" ${my_suffix[@]}
    for (( i=0 ; i<${#my_olay[@]} ; ++i )) ; do
        my_prefix=$(echo ${my_olay[i]} | sed 's/.*\///;s/\.nii//')
        3dClusterize \
            -inset ${my_olay[i]} \
            -idat ${my_subbricks[i]} \
            -ithr ${my_subbricks[i]} \
            -1sided RIGHT_TAIL p=0.05 \
            -NN 3 \
            -clust_nvox ${my_clust_nvox[i]} \
            -outvol_if_no_clust \
            -pref_dat ${my_prefix}_${my_suffix[i]}.nii > \
                      ${my_prefix}_${my_suffix[i]}_myclustrep.txt
    done
    3dcalc \
        -a output_mvm_sstage_${region[h]}_procbasic_ric_rvt_ppga_rz_abs_nothrpvthrclthr_subsample_sstage_-SC-_F.nii \
        -b output_lme_audaro_${region[h]}_procbasic_ric_rvt_ppga_rz_abs_nothrpvthrclthr_fullsample_AAT_Chi-sq.nii \
        -expr "1 * notzero(a) + 2 * notzero(b)" \
        -prefix output_lme_audaro_${region[h]}_procbasic_ric_rvt_ppga_rz_abs_nothrpvthrclthr_fullsample_AAT_Chi-sq_conj_stage.nii
    @chauffeur_afni \
        -ulay /usr/local/apps/afni/current-py3/linux_rocky_8/TT_N27_SSW.nii.gz \
        -olay output_lme_audaro_${region[h]}_procbasic_ric_rvt_ppga_rz_abs_nothrpvthrclthr_fullsample_AAT_Chi-sq_conj_stage.nii \
        -set_subbricks 0 0 -1 \
        -montx 4 \
        -monty 4 \
        -delta_slices -1 -1 4 \
        -set_dicom_xyz -1 -1 25 \
        -func_range 3.0 \
        -pbar_posonly \
        -cbar_ncolors 3 \
        -cbar_topval "" \
        -cbar "3=yellow 2.01=red 1.01=blue 0.01=none" \
        -opacity 9 \
        -label_mode 2 \
        -label_size 5 \
        -set_xhairs OFF \
        -no_cor \
        -no_sag \
        -pbar_saveim output_lme_audaro_${region[h]}_procbasic_ric_rvt_ppga_rz_abs_nothrpvthrclthr_fullsample_AAT_Chi-sq_conj_stage.png \
        -prefix      output_lme_audaro_${region[h]}_procbasic_ric_rvt_ppga_rz_abs_nothrpvthrclthr_fullsample_AAT_Chi-sq_conj_stage
done

#=========================================================================================
# Conjunction analysis
#
# sstage = 15 arousals
# AAT = 15 arousals
#=========================================================================================

region=(
    hip
    tha
    pcc
)
for (( h=0 ; h<${#region[@]} ; ++h )) ; do
    # Testing Toggle Territory:
    # Simulation:
    my_3dclustsim=(
        ../output_3dclustsim_${region[h]}_procbasic_ric_rvt_ppga.NN3_1sided.1D
    )
    my_clust_nvox=(
        $(awk '{if (FNR==9) {print int($3+0.5)}}' ${my_3dclustsim[@]})
    )
    my_olay=(
        ../output_lme_comaat_${region[h]}_procbasic_ric_rvt_ppga_rz_abs.nii
    )
    # Reality:
    # my_3dclustsim=(
    #     output_3dclustsim_${region[h]}_procbasic_ric_rvt_ppga.NN3_1sided.1D
    # )
    # my_clust_nvox=(
    #     $(awk '{if (FNR==9) {print int($3+0.5)}}' ${my_3dclustsim[@]})
    # )
    # my_olay=(
    #     output_lme_comaat_${region[h]}_procbasic_ric_rvt_ppga_rz_abs.nii
    # )
    my_subbricks=(
        1
    )
    my_suffix=(
        nothrpvthrclthr_subsample_AAT_Chi-sq
    )
    printf "%s\n" ${my_olay[@]}
    printf "%s\n" ${my_subbricks[@]}
    printf "%s\n" ${my_suffix[@]}
    for (( i=0 ; i<${#my_olay[@]} ; ++i )) ; do
        my_prefix=$(echo ${my_olay[i]} | sed 's/.*\///;s/\.nii//')
        3dClusterize \
            -inset ${my_olay[i]} \
            -idat ${my_subbricks[i]} \
            -ithr ${my_subbricks[i]} \
            -1sided RIGHT_TAIL p=0.05 \
            -NN 3 \
            -clust_nvox ${my_clust_nvox[i]} \
            -outvol_if_no_clust \
            -pref_dat ${my_prefix}_${my_suffix[i]}.nii > \
                      ${my_prefix}_${my_suffix[i]}_myclustrep.txt
    done
    3dcalc \
        -a output_mvm_sstage_${region[h]}_procbasic_ric_rvt_ppga_rz_abs_nothrpvthrclthr_subsample_sstage_-SC-_F.nii \
        -b output_lme_comaat_${region[h]}_procbasic_ric_rvt_ppga_rz_abs_nothrpvthrclthr_subsample_AAT_Chi-sq.nii \
        -expr "1 * notzero(a) + 2 * notzero(b)" \
        -prefix output_lme_comaat_${region[h]}_procbasic_ric_rvt_ppga_rz_abs_nothrpvthrclthr_subsample_AAT_Chi-sq_conj_stage.nii
    @chauffeur_afni \
        -ulay /usr/local/apps/afni/current-py3/linux_rocky_8/TT_N27_SSW.nii.gz \
        -olay output_lme_comaat_${region[h]}_procbasic_ric_rvt_ppga_rz_abs_nothrpvthrclthr_subsample_AAT_Chi-sq_conj_stage.nii \
        -set_subbricks 0 0 -1 \
        -montx 4 \
        -monty 4 \
        -delta_slices -1 -1 4 \
        -set_dicom_xyz -1 -1 25 \
        -func_range 3.0 \
        -pbar_posonly \
        -cbar_ncolors 3 \
        -cbar_topval "" \
        -cbar "3=yellow 2.01=red 1.01=blue 0.01=none" \
        -opacity 9 \
        -label_mode 2 \
        -label_size 5 \
        -set_xhairs OFF \
        -no_cor \
        -no_sag \
        -pbar_saveim output_lme_comaat_${region[h]}_procbasic_ric_rvt_ppga_rz_abs_nothrpvthrclthr_subsample_AAT_Chi-sq_conj_stage.png \
        -prefix      output_lme_comaat_${region[h]}_procbasic_ric_rvt_ppga_rz_abs_nothrpvthrclthr_subsample_AAT_Chi-sq_conj_stage
done

Hi, Dante-

There's a lot happening here, it's a little hard to picture.

Are you able to share the input datasets, so I could try running this and seeing intermediate outputs, etc.?

--pt

1 Like

Paul,

Hi. How are you? I hope your current stress level is manageable.

Sure. Does this work?

https://app.globus.org/file-manager?origin_id=13c8e9d7-70c2-4e4d-a130-73bbde1f6ce8&origin_path=%2F

Sincerely,

Dante

Hi, Dante-

Ah, the joys of using globus again... But I did manage to wrangle the data, yes.

I think what is happening here is related to a bug fix from early April, for 3dClusterize on the command line for the particular case of a 1-sided distribution when using the -1sided RIGHT_TAIL p=... syntax was used (the GUI was behaving correctly for this, though). That case related to the F-stat, but the Chi-sq distribution you are working with is also 1-sided.

Sorry about that, but the current results should be correct.

--pt

1 Like