Dear AFNI wizards,
I’m trying to run a population receptive field (PRF) analysis with AFNI but I’m new to the software package and generally still a bit confused. I was hoping somebody could give me a hint as to whether I go wrong at some point.
First, I try to create a stimulus BRIK. The experiment involved a sweeping bar stimulus of which I have the image files (binary masks 990x990) as png files. Given the onset and duration of the bar sweeps, I convert them to a series of jpg files (one for each TR). Then, I create a stimulus brik from it like so:
3dTcat -prefix stim.360 -TR 1.5 mask*.jpg
3drefit -orient LSA stim.360+orig
# convert to nifti for use in fsl
3dAFNItoNIFTI stim.360+orig. stim.360.nii.gz
# threshold and binarize stimulus nifti
fslmaths stim.360.nii -thr 100 tmp.nii
fslmaths tmp.nii.gz -bin tmp_bin.nii
# back to brick
3dcopy tmp_bin.nii.gz stim_bin+orig.
Next, I try to create a convolution reference time series (I think it should be a simple canonical HRF)
3dDeconvolve -nodata 18 1.5 -polort -1 \
-num_stimts 1 -stim_times 1 '1D:0' SPMG1 \
-x1D conv.ref.spmg1.1D
Then, I try to prepare the data. The basis is file called data.nii.gz, which is just the average of detrended time series from four runs with same experiment.
make a copy in AFNI format
3dcopy data.nii.gz AFNIpRF+orig.
calculate the mean for each voxel
3dTstat -mean -prefix AFNIpRFMean AFNIpRF+orig. -overwrite
Calculate a brain mask
3dAutomask -prefix automask AFNIpRF+orig. -overwrite
Demean and scale the time-series data
3dcalc -a AFNIpRF+orig. -b AFNIpRFMean+orig. -c automask+orig. -expr ‘100c(a-b)/b’ -prefix e.scale.demean+orig. -overwrite
The enviroment variables are set like so
AFNI_CONVMODEL_REF=conv.ref.spmg1.1D
export AFNI_CONVMODEL_REF
AFNI_MODEL_PRF_STIM_DSET=stim_bin+orig.
export AFNI_MODEL_PRF_STIM_DSET
AFNI_MODEL_PRF_ON_GRID=YES
export AFNI_MODEL_PRF_ON_GRID
AFNI_MODEL_DEBUG=3
export AFNI_MODEL_DEBUG
Finally, I run 3dnlfim
3dNLfim -input e.scale.demean+orig. \
-mask automask+orig. \
-noise Zero \
-signal Conv_PRF \
-sconstr 0 -10.0 10.0 \
-sconstr 1 -1.0 1.0 \
-sconstr 2 -1.0 1.0 \
-sconstr 3 0.0 1.0 \
-BOTH \
-nrand 10000 \
-nbest 5 \
-bucket 0 Buck.PRF \
-snfit snfit.PRF \
-TR 1.5 \
-float
# convert to nifti for compatibility later
3dAFNItoNIFTI Buck.PRF+orig. buck.nii.gz
3dAFNItoNIFTI snfit.PRF+orig. snfit.nii.gz
AFNI seems to run the fit (for a little less than 30 minutes). However, when I look at the output Buck.PRF, I can’t make sense of it. It seems a bit random. (see attached file).
Does anybody know, at what point I’m failing? Or am I not interpreting the output correctly?
Again, I’m really new to AFNI and any hints would be very welcome.
Thanks!
Oliver