I’m now using AFNI to preprocess resting state fMRI data. As I cannot use FreeSurfer to segment tissues, I plan to use the example 11b to do preprocessing in afni_proc.py.
From the example, it tells us to import a ventricle mask from the template and then using TT space as illustration. And the template used is TT_desai_dd_mpm+tlrc. I’m wondering if there is any template in MNI space that I can use to extract the ventricle mask?
I have noticed that there are many templates including MNI and TT templates in abin folder. But don’t know which one to use, since it seems that TT_desai_dd_mpm template is the probability map. And I also don’t know the labels of ventricles in MNI space.
The afni_proc.py script I plan to use is as follows:
afni_proc.py -subj_id subj1
-blocks despike tshift align tlrc volreg blur mask regress
-align_opts_aea -cost lpc+ZZ
-mask_import Tvent template_ventricle_2.5mm+tlrc
-mask_intersect Svent CSFe Tvent
-regress_ROI_PC Svent 3
-regress_make_corr_vols WMe Svent
-regress_apply_mot_types demean deriv
So use MNI space as the base space.
Do you have any idea about extracting ventricle from MNI template like the script as follows?
3dcalc -a ~/abin/TT_desai_dd_mpm+tlrc -expr ‘amongst(a,152,170)’ -prefix template_ventricle
The datasets that end with “mpm” are “maximum probability maps”, really the maps of the regions that give the maximum probability at each voxel, rather than a specific probability. You could use a ventricle mask from the N27 dataset in MNI space. Download the N27 surfaces and volumes in MNI space here:
You could use the ventricle mask dataset, aparc+aseg_REN_vent.nii.gz, as a mask. Take a look to see if that’s what you want.
Thanks for your reply!
I’ve tried the dataset you mentioned. But it occured fatal error when processing:
3dmask_tool -input mask_CSFe_resam+tlrc mask_import_Tvent+tlrc -inter -prefix mask_inter_Svent
++ processing 2 input datasets…
++ padding all datasets by 0 (for dilations)
** FATAL ERROR: nvoxel mis-match
It seems the number of voxel of the two masks do not mach? Do I need to resample the template you mentioned at first? I have already used 3dresample to make it to 2.5mm as the example does.
When using -mask_import, the input dataset must match
the final grid of the processed data. Since you used
3dresample to make it 2.5 mm^3, I must guess that the
bounding box is not correct, meaning you used -dxyz
instead of -master.
The safest way to apply 3dresample (both here and in
general) is to use -master, which will match the grid
of an existing dataset, rather than just altering the
voxel size of the input dataset.
Try running something like:
3dresample -master full_mask+tlrc …
to match the grid of the standard space data from
some subject. That mask should be appropriate to
import as you are trying.
Please let us know how it goes.
Thanks for your suggestion.
I have tried the method you suggested. But it seemed didn’t work. Since we cannot have the final grid of the processed data until we finish processing, I just used the processed data I did before for other subjects as the master dataset. The used data were following example 11 which used FreeSurfer to segment tissues. And the voxel resolution of the processed data is 2.5 mm^3.
I then used this dataset as the mater to resample the template ventricle using the following code:
3dresample -master errts+tlrc -prefix template_ventricle -input aparc+aseg_REN_vent.nii.gz
(But actually the final processed dataset is exactly 2.5 mm^3, they should be matched with the former one using 3dresample -dxyz. Am I right?)
However, when running the script generated from proc.py, error occured as follows:
3dToutcount -automask -fraction -polort 3 -legendre pb00.koon_pre.r01.tcat
++ 3dToutcount: AFNI version=AFNI_17.1.09 (Jun 6 2017) [64-bit]
** Can’t open dataset pb00.koon_pre.r01.tcat
I cannot come up with the reason of this error. Could you please help clarify? Thanks!
Using “3dresample -dxyz 2.5 2.5 2.5” may or may not be correct.
It depends on having the same bounding box and orientation, too.
So -master is a more sure way to get them to match.
The 3dToutcount error does not seem to have anything to do with
the resampling, as it is complaining about not being able to
locate the pb00.*.tcat dataset. The command shown there does
not have a view on it. Is there a missing +orig? Given that,
are you actually editing the proc script? It is better to
alter the afni_proc.py command and not the proc script, unless
it is absolutely necessary.
Yes you are right. The problem is with the missing +orig in the generated script. After adding the missing part, it works fine.
But I didn’t alter the proc script before. I don’t know what happened since no matter how many times I have tried, the final script is still the same as the missing one. I need to add the missing part manually.
Besides, is it no problem that I use other’s processed fMRI data as the master dataset in 3dresample to get the template ventricle? It seems weird that what if I don’t have the available processed data and need to process the new dataset…
Thanks for your reply!
Yes, it is a bit circular in that you don’t know the grid
until you get there, so making a grid template ahead of
time does not quite work. But the grid is based on
3dAllineate applying -dxyz 2.5 to the final anatomical
dataset, which is apparently a little different from
applying it to the template.
Or possibly, 3dAllineate’s application of 2.5 mm is a
little different that that of 3dresample. I would have
to see where that is coming from…
To understand the missing +orig, would you please mail
me a proc script?