Mask Resample error

We created a Basal Ganglia mask using 3dcalc (harvard oxford atlas) and are we get the following error when trying to extract time series

++ 3dmaskave: AFNI version=AFNI_24.2.01 (Aug 14 2024) [64-bit]

** ERROR: EDIT_dset_items[3]: illegal new nvals

*+ WARNING: Input dataset grid mismatch from mask.

Try the following command for grid comparison:

3dinfo -header_line -prefix -same_all_grid /Volumes/Imaging_LC/Masks/BG_resam.nii.gz

*** Input and mask datasets are not same dimensions!

/Volumes/Imaging_LC/ASD_R00/ASD015/rest/ASD015_rest_fnirt_MNI_ICAaroma_b6_nuisreg_nogsr.nii.gz: Permission denied.

These are the resample scripts what were ran. All resulted in the mismatch error.

3dresample -rmode Cu -master MAST_DSET ${subj}/rest/${subj}_rest_fnirt_MNI_ICAaroma_b6_nuisreg_bp_nogsr.nii.gz -prefix BG_resam.nii.gz -input /Volumes/Imaging_LC/Masks/W_basalganglia_final.nii.gz

3dresample -master ${subj}/rest/${subj}_rest_fnirt_MNI_ICAaroma_b6_nuisreg_bp_nogsr.nii.gz -prefix BG_resam.nii.gz -input /Volumes/Imaging_LC/Masks/W_basalganglia_final.nii.gz

After resampling the mask and opening on AFNI the masks show as 0s

Please advise, thank you.

code text  # or delete if not needed

Hi-

If you have an integer-valued dataset to resample, you likely want to use nearest neighbor "NN" resampling, to preserve integer values. So:

3dresample \
    -rmode NN \
    -master MAST_DSET \
    -input INPUT_DSET \
    -prefix OUTPUT_DSET

How does that look out output? What is the output of:

3dinfo -max -prefix INPUT_DSET OUTPUT_DSET

?

Note that to check whether datasets are on the same grid---and hence can be used together for voxelwise calculations---you can run either of these on 2 or more datasets:

# terse output: binary yes/no per dset
3dinfo -same_grid -prefix DSET1 DSET2 [DSET3 DSET4 ...]

# more detailed output: 5 binary yes/no checks per dset
3dinfo -same_all_grid -prefix DSET1 DSET2 [DSET3 DSET4 ...]

3dinfo's help describes what the detailed checks are in the second.

--pt

1 Like

Thank you!

We were able to get the resample script to work and extracted time series. Now I am getting the following error on the Deconvolve script:

** ERROR: output dataset name 'Decon' conflicts with existing file
** ERROR: dataset NOT written to disk!

Here is what we ran

cd ${subjectsDirectory}

3dDeconvolve -float -input rest/${subj}_rest_fnirt_MNI_ICAaroma_b6_nuisreg_bp_nogsr.nii.gz \ 
			-mask rest/${subj}_automask_MNI.nii.gz \
			-nfirst 0 -polort 1 \
			-GOFORIT 5 -allzero_OK \
			-num_stimts 1 \
			-stim_file 1 /Volumes/Imaging_LC/ASD_R00/${subj}/${subj}_BG_timeseries.1D -stim_label 1 network \ 
			-jobs 2 \
			-rout -tout \
			-bucket /Volumes/Imaging_LC/ASD_R00/${subj}/${subj}_FC_BG.nii.gz

Please let me know if you have any suggestions, thank you for your time!

I think a couple things are happening here.

You have spaces to the right of some of your "continuation of line" characters \ (the ones in lines 3 and 8, above). That makes the continuation stop, so that the subsequent lines are not treated like part of this command. Therefore, I don't think that the -bucket .. option is actually being used as part of your command, and you are not passing an output filename to the program. As such, 3dDeconvolve has a default output filename, Decon. But, AFNI programs will not overwrite existing files by default; in some cases, you can add -overwrite to force them to do so. So, that is what is happening here.

I think you should remove the spaces to the right of the \ characters in your script, firstly. Then, you probably want to remove the old Decon output, anyways, because it wouldn't have had your complete set of options. Then, you should be able to get the desired output.

--pt

Hi,

We got it to work, thank you!
we are now running 3dClustSim for our paired sample t-test but we are unsure if our script is complete.

cd /Volumes/Imaging_LC/
	
3dClustSim -mask /Volumes/Imaging_LC/Masks/BG_resam.nii.gz \
BG_paired_asd_td.nii.gz \ -iter 1000 -pthr 0.05 -fwhmx 7.43439  -fwhmy 7.42654  -fwhmz 7.1111 -quiet -fast -approx

Here is the error we receive:

fatal error: --unkown option 'BG_paired_asd_td.nii.gz '
program comple data = mar 17 2024

Please let me know if you have any suggestions, thank you!

Hi-

The command looks a bit oddly ordered, with maybe a copy+paste error?
Should there be a -prefix .. preceding "BG_paired_td.nii.gz"?

Also, following on from this work on cluster-y stuff:

... it would probably make more sense to use the mixed autocorrelation function (ACF) smoothness estimation for cluster things? There are some examples of using 3dClustSim for that from the AFNI Codex (Code Examples) here and here. Typically, when running afni_proc.py the smoothness estimations for the ACF fit will be done during processing with 3dFWHMx; that command in the proc script looks like:

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

.. where errts* is the residual time series.

--pt