User Tools

Site Tools




The main motivation for this function is to cross-check BrainVoyager's registration quality with that of SPM (once again cross-checked with manual inspection, of course).


For this function to work, either SPM5 or SPM8 must be available on the path. For SPM8, it is important that all required subfolders (e.g. matlabbatch, etc.) are already on the path. If in doubt, use spm fmri prior to calling this function (this call adds all required sub-folders of SPM to the path).

Also, Matlab must have write access to the temporary folder (on Unix-ish systems, that usually is /tmp) to write out the VMRs as Analyze files.

W.r.t. to the VMRs, you must have two objects loaded which you want to bring into the same space (whereas the reference/secondary VMR is the stationary one!)

Function reference ('help vmrspmcoreg')

  vmrspmcoreg  - apply SPM's coregistration to two VMRs
  FORMAT:       vmrtrf = vmrspmcoreg(srcvmr, refvmr)
  Input fields:
        srcvmr      VMR to coregister (primary VMR)
        refvmr      reference (stationary/secondary VMR)
  Output fields:
        vmrtrf      BV compatible TRF object


These are the steps taken by vmrspmcoreg:

  • load the required batch/job file for the available SPM version
  • write both VMRs as Analyze files (using the vmr.WriteAnalyzeVol method)
  • putting the two filenames into the job
  • passing control to SPM's job manager
  • read back the Analyze file headers
  • delete the temporary Analyze files
  • determine the required transformation (incl. taking care of origin difference)
  • create TRF object and settings all required fields


For an example, check the reference page of vmr.ApplyTRF, which also explains how to then apply the obtained TRF object to actually re-sample the source VMR into the target space.

vmrspmcoreg.txt · Last modified: 2010/06/22 21:58 by jochen