-
Notifications
You must be signed in to change notification settings - Fork 6
Surface Sampling Using CIVET surfaces
If you have multi-modal data, this page will take you through some steps on how to use surfaces generated through CIVET on T1 scans (ex: MPRAGE) to sample surfaces of other scans (ex: MP2RAGE, fMRI, etc).
The first step is to make sure that your t1 scan and the scan you are interested in sampling from are aligned. To do so, you can use bestlinreg_g
. You will use the input file from CIVET to perform the alignment.
-nmi
option: instead of using the default cross correlation you use normalized mutual information, which is helpful when aligning two scans from different scan types.
-lsq6
: because these scans are from the same subject, you only use rigid registration
-close
: assumes scans were taken in the same session so they should be mostly overlapping
> module load minc-toolkit
> bestlinreg_g -nmi -lsq6 -close path_to/CIVET/subject_t1.mnc path_to/other_scan/MP2RAGE.mnc transform_t1_to_otherscan.xfm
CIVET does its processing in MNI space. We need to transform the surface from MNI space back to our native space. In order to do so, we can invert the linear transform produced by CIVET to get from native to MNI space. You will need to generate an inverse of the linear transform generated from you CIVET run, using the command xfminvert
. You will list the path to the linear transform followed by the name you wish to give the inverted transform you are creating:
> xfminvert path_to/CIVET/output/subject/transforms/linear/subject_t1_tal.xfm subject_t1_tal_invert.xfm
CIVET 1.1.12 will set all cosine direction angles to be 90 degrees, which is equivalent to a transform, so we want the inverse of this transform as well. Ignore this step if using CIVET 2.1.0. You will use the command dircos_to_xfm
, list the path to the t1 image you used as inputs for your CIVET run, followed by the name for the transform you are creating:
> dircos_to_xfm path_to/CIVET/input/subject_t1.mnc subject_dircos.xfm; done
Now you will combine the transforms you just created into one using the command xfmconcat
. The example below is for CIVET 1.1.12, if you used CIVET 2.1.0, you don't need the subject_dircos.xfm
:
> xfmconcat subject_t1_tal_invert.xfm subject_dircos.xfm transform_t1_to_otherscan.xfm subject_cobmined.xfm
Now you will use the transform you just created to transform both the left and right CIVET mid surface onto the other (target) scan. Once you've done this, you can use Display to see if your new objects align well with your "other scan".
> transform_objects path_to/CIVET/output/subject/surfaces/subject_mid_surface_left_81920.obj subject_combined.xfm subject_transformed_left.obj
> transform_objects path_to/CIVET/output/subject/surfaces/subject_mid_surface_right_81920.obj subject_combined.xfm subject_transformed_right.obj
Now that you've checked that your objects are well aligned, you will use the volume_object_evaluate
command to collect values from the "other scan" onto your surface:
> volume_object_evaluate path_to/otherscan.mnc subject_transformed_left.obj subject_sampled_values_left.txt
> volume_object_evaluate path_to/otherscan.mnc subject_transformed_right.obj subject_sampled_values_right.txt
If you are interested in performing statistics on your sampled values, you need to smooth your values on the surface. We will be using a CIVET tool to do the smoothing so you will need to open a new terminal window and load the appropriate modules:
> module load anaconda/2.3
> module load CIVET/1.1.12
> depth_potential -smooth 28.28 subject_sampled_values_left.txt subject_transformed_left.obj subject_sampled_values_left_smooth.txt
> depth_potential -smooth 28.28 subject_sampled_values_right.txt subject_transformed_right.obj subject_sampled_values_right_smooth.txt
This will give you homology with the CIVET vertices between your subjects. You will use the surf_reg_model_left
for both the left and right!
> surface-resample /opt/quarantine/CIVET/1.1.12/build/CIVET-1.1.12/models/surf_reg_model_left.obj path_to/CIVET/output/subject/surfaces/subject_mid_surface_left_81920.obj subject_sampled_values_left_smooth.txt path_to/CIVET/output/subject/transforms/surfreg/subject_left_surfmap.sm subject_surface_values_rsl.txt
> surface-resample /opt/quarantine/CIVET/1.1.12/build/CIVET-1.1.12/models/surf_reg_model_left.obj path_to/CIVET/output/subject/surfaces/subject_mid_surface_right_81920.obj subject_sampled_values_right_smooth.txt path_to/CIVET/output/subject/transforms/surfreg/subject_right_surfmap.sm subject_surface_values_rsl.txt
These files are now ready for statistics. If you are using R, they are suitable for vertexLm
or vertexLmer