vmr.applytrf
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | vmr.applytrf [2010/06/22 19:32] (current) – created jochen | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== vmr.ApplyTRF ====== | ||
+ | |||
+ | ===== Motivation ===== | ||
+ | The main motivation for using this function is the ability to flexibly script spatial VMR transformation in Matlab. | ||
+ | |||
+ | ===== Method reference (' | ||
+ | < | ||
+ | |||
+ | | ||
+ | |||
+ | Input fields: | ||
+ | |||
+ | | ||
+ | | ||
+ | .asdouble | ||
+ | .inverse | ||
+ | .method | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | ===== Usage examples ===== | ||
+ | * using a TRF that was created in BrainVoyager (and instead of the file selector in the first two lines, this can be scripted!): <code matlab vmr_applytrf_bvtrf.m> | ||
+ | vmr = xff(' | ||
+ | trf = xff(' | ||
+ | |||
+ | % apply transformation with cubic interpolation | ||
+ | trfvmr = vmr.ApplyTRF(trf, | ||
+ | trfvmr.SaveAs; | ||
+ | |||
+ | % clear objects | ||
+ | vmr.ClearObject; | ||
+ | trf.ClearObject; | ||
+ | trfvmr.ClearObject;</ | ||
+ | * using two VMRs, coregister them, then transform the first: <code matlab vmr_applytrf_coreg.m> | ||
+ | vmr1 = xff(sourcevmr); | ||
+ | vmr2 = xff(targetvmr); | ||
+ | |||
+ | % run coregistration (requires SPM5 or SPM8 on the path!!) | ||
+ | % vmr2 is the target space (stationary), | ||
+ | trf = vmrspmcoreg(vmr1, | ||
+ | |||
+ | % resample vmr1 using sinc (lanczos3) interpolation | ||
+ | vmr1_in_vmr2_space = vmr1.ApplyTRF(trf, | ||
+ | |||
+ | % save TRF and VMR | ||
+ | [sourcepath, | ||
+ | if isempty(sourcepath) | ||
+ | sourcepath = ' | ||
+ | end | ||
+ | [nullpath, targetfile] = fileparts(targetvmr); | ||
+ | trf.SaveAs(sprintf(' | ||
+ | vmr1_in_vmr2_space.SaveAs(sprintf(' | ||
+ | |||
+ | % clear objects | ||
+ | clearxffobjects({vmr1, | ||
+ | |||
vmr.applytrf.txt · Last modified: 2010/06/22 19:32 by jochen