AFNI Message Board

History of AFNI updates  

|
August 07, 2013 01:02PM
I want to coregister scans of the same modality (EPI to EPI), combined with 3dvolreg for motion correction. After a lot of reading I pasted together this code. It works - although not overwhelmingly well, especially the outlines of the brains sometimes don't match, it could need a little bit more stretch..., and as you can see below the images don't have a lot of details (because they are mouse brains) thats why I decided to use the mutual information cost function according to the help file.

The base (Template+orig) and source scans have exactly the same matrix sizes and the slices are roughly placed at the identical positions so I don't expect huge translations, the voxel sizes are 0.26x0.23x0.5mm therefore only a small blur.
Also, I could not get this to work with align_epi_anat.py, because it does not seem to recognize the -1Dmatrix_save command...



# calculate 3dAllineate 1D matrix
3dAllineate -base ../TEMPLATE+orig -source pb01.$subj.r$run.tshift+orig	\
	    -1Dmatrix_save coreg_matrix.1D				\
	    -twoblur 0.8						\
	    '-autoweight+100**1.5'					\
	    -cost mi		

# register each volume to the base, save only as 1D matrix
3dvolreg -zpad 1 -base pb01.$subj.r01.tshift+orig'[0]' 		\
         -1Dfile dfile.r$run.1D 				\
         -Fourier                                               \
	 -1Dmatrix_save realignment_matrix.1D			\
         pb01.$subj.r$run.tshift+orig

# combine the two transformations
cat_matvec coreg_matrix.1D realignment_matrix.1D > combined_transform.1D

# apply the combined transformations to the EPI
3dAllineate -1Dmatrix_apply combined_transform.1D		\
	    -input pb01.$subj.r$run.tshift+orig			\
	    -prefix pb02.$subj.r$run.volreg





Subject Author Posted

My coregistration code needs some suggestions for improvement

paranoidandroid August 07, 2013 01:02PM

Re: My coregistration code needs some suggestions for improvement

Daniel Glen August 07, 2013 01:45PM

Re: My coregistration code needs some suggestions for improvement

paranoidandroid August 08, 2013 04:10AM



Sorry, only registered users may post in this forum.

Click here to login