3dWarpDrive to 3dAllineate

Hello,

I would like to know if there are input options (such as the cost function, etc.) that can be set in the function 3dAllineate to have it behave as 3dWarpDrive does. I can set all of the inputs used in 3dWarpDrive in 3dAllineate, but because of the added options and functionality of the newer function, the result was not as desired. There are likely some defaults of 3dWarpDrive that I am missing in this translation to 3dAllineate.

Thanks for your help!

Best,
Kim

Hi, Kim-

What is your 3dWarpDrive command that you are aiming to translate, and can you describe what the inputs are, and can you note what your goal for the command is?

As noted at the top of that program, many functionalities might be better handled in different programs, which I guess is why you are translating an existing 3dWarpDrive command to 3dAllineate:


* This program is a generalization of 3dvolreg.  It tries to find
  a spatial transformation that warps a given dataset to match an
  input dataset (given by the -base option).  It will be slow.
* Here, the spatical transformation is defined by a matrix; thus,
  it is an affine warp.
* Program 3dAllineate can also compute such an affine transformation,
  and it has more options for how the base and input (source) datasets
  are to be matched. Thus, the usefulness of the older 3dWarpDrive
  program is now limited. For future work, consider using 3dAllineate.
*****
***** For nonlinear spatial warping, see program 3dQwarp. *****
*****

 *** Also see the script align_epi_anat.py for a more general ***
 **  alignment procedure, which does not require that the two  **
 **  datasets be defined on the same 3D grid.                  **
 **  align_epi_anat.py uses program 3dAllineate.               **

–pt

3dWarpDrive was meant as an extension of 3dvolreg and, consequently, uses the same cost function of weighted least squares. The closest cost function in 3dAllineate is the pearson correlation (ls) that works with “like to like” images.

Thank you both -

My goal is to do spinal cord fMRI motion correction. Specifically, it is a slicewise alignment of each timepoint to a base, so it is a like to like alignment as you mentioned, Daniel. The alignment is limited to just XY translations.

This is an example of the command I am trying to translate:


3dWarpDrive -affine_general \
-parfix 3 0 -parfix 4 0 -parfix 5 0 -parfix 6 0 -parfix 7 1 -parfix 8 1 -parfix 9 1 -parfix 10 0 -parfix 11 0 -parfix 12 0 \
-quintic -final quintic \
-base fmri_slice1_base.nii \
-prefix fmri_slice1_MCnofilt.nii \
-weight fmri_slice1_Gaussian_mask.nii \
-1Dfile fmri_slice1_MC_params.txt \
-1Dmatrix_save fmri_slice1_MC_xform.aff12.1D \
fmri_slice1.nii

And this is what I have tried to run:


3dAllineate -warp affine_general \
-parfix 3 0 -parfix 4 0 -parfix 5 0 -parfix 6 0 -parfix 7 1 -parfix 8 1 -parfix 9 1 -parfix 10 0 -parfix 11 0 -parfix 12 0 \
-interp quintic -final quintic \
-base fmri_slice1_base.nii \
-prefix fmri_slice1_MCnofilt.nii \
-weight fmri_slice1_Gaussian_mask.nii \
-1Dparam_save fmri_slice1_MC \
-1Dmatrix_save fmri_slice1_MC_xform.aff12.1D \
-cost ls -onepass \
fmri_slice1.nii

I have tried the cost function ‘ls’ and using the -onepass option, which has worked ok so far, but not as well as 3dWarpDrive has worked. If there is no cost function of weighted least squares in the 3dAllineate function, I am gathering that maybe it cannot be used in exactly the same way. The main reason I am looking towards 3dAllineate is because 3dWarpDrive points to using it for future work.

Thanks,
Kim

Hi, Kim-

An interesting application.

Can I ask:
0) are these 3D volumes, or 2D slices?

  1. what are the voxel dimensions of the data?
  2. how much distortion/difference is there from time point to time point?
  3. how you are evaluating these (visualizing overlay/underlay, for example), and what means better or worse (boundaries line up, features lining up, less blurry)?
  4. would you be able to share the data, if I sent a Box drive to your email? It is hard to advise on something I am not very familiar with. For example, I might try the ‘lpa’ or ‘nmi’ cost function, but those choices are informed from a very different context.

thanks,
pt

Hi pt,

Here are my answers to your questions:

  1. are these 3D volumes, or 2D slices? - 2D slices
  2. what are the voxel dimensions of the data? - anisotropic 1x1x3 mm voxels (1x1 in the axial plane)
  3. how much distortion/difference is there from time point to time point? - it depends on the task, but the cord can regularly move 0-3 mm (mostly in the ventral-dorsal direction)
  4. how you are evaluating these (visualizing overlay/underlay, for example), and what means better or worse (boundaries line up, features lining up, less blurry)? - I have been using tSNR as one metric to evaluate these. I also will visually compare the fMRI timeseries before/after motion correction. I tend to look for whether the spinal cord/CSF region/boundary is remaining in the same location from timepoint to timepoint.
  5. would you be able to share the data, if I sent a Box drive to your email? It is hard to advise on something I am not very familiar with. For example, I might try the ‘lpa’ or ‘nmi’ cost function, but those choices are informed from a very different context. - Thank you! I should probably be able to share some data. Should I private message you to provide my email?

Best,
Kim