Hi Ged,
Hope you do find it useful. I must confess, I simply copied the code
for allowing user-chosen interpolation from another of John's routines
(normalization I think). Someone else will have to comment on the
mechanics of the reslice routines.
Mark
Ged Ridgway wrote:
> Hi Mark,
>
> Looks a useful hack! Do you by any chance know the answer to my
> earlier confusion:
> "spm_sample_vol seems to offer sinc or polynomial, but not b-spline"
>
> I see in your help you refer to nth order B-spline interpolation, but
> I think the help for spm_sample_vol refers instead to Lagrange
> polynomial interpolation; I didn't think these were the same, but
> maybe I'm wrong about that... I guess B-splines are piecewise
> polynomials... Do you (and/or any other readers) think they are
> different names for the same thing? (I haven't looked through the C
> code to see what's actually done!)
>
> Best,
> Ged.
>
> Mark Daglish wrote:
>> Hi Siawoosh,
>>
>> I hacked the attached version of spm_applydef_ui.m to allow me to choose
>> the resampling option when applying a deformation field to an image. I
>> wanted nearest neighbour so I could resample object maps. It offers a
>> choice of the interpolation options offered by SPM2.
>>
>> I _haven't_ tried it with SPM5.
>>
>> Hope it is useful.
>>
>> Mark
>>
>> Ged Ridgway wrote:
>>> Hi Siawoosh,
>>>
>>> <snip>
>> ------------------------------------------------------------------------
>>
>> function spm_applydef_ui(P,PT,interp)
>> % Applies a deformation field to an image
>> %
>> % Changes made by Mark Daglish 04/11/19
>> % Wanted to allow different interpolation levels so
>> % 1: interp added to function call
>> % 2: If no vargin then full gui with P (array of deformation fields)
>> % PT (array of images to warp) and interp (level of interpolation)
>> % are required to be specified.
>> % If P & PT are defined, but not interp, then assume someone is
>> expecting
>> % John's original program and set interp=1 as default.
>> % If P, PT & interp are specified then use them & skip GUI.
>> % 3: Calls to spm_slice_vol and spm_sample_vol changed to include
>> % interp variable
>> %_______________________________________________________________________
>> % @(#)spm_applydef_ui.m 1.4 John Ashburner 04/03/24
<snip>
|