I used 3dresample to downsize the slice resolution from 321 slices to 53 slices via -dxyz, specifying 6 x slice thickness. I use “-rmode Linear”. Specifically,
3dresample -dxyz 1.042 1.042 3.36 -rmode Linear -prefix …
I checked the source codes but I was not sure the exact equation.
Is it a simple linear fit over 6 slices with a straight line?
Could someone explain?
I hope to find the exact equation used across the slices at the same XY location.
That uses the identical routines that Bob wrote for the
afni viewer, so many years ago. It should not use 6
slices for the interpolation, it does not care about the
reduction factor, say.
My understanding, which I hope is accurate, is that for
each voxel, the coordinates are mapped into the original
dataset. That might land exactly on some voxel (in
which case there is no interpolation), or it might land
somewhere with 8 neighbors (i.e. 4 neighbors in each
of 2 slices). Then for linear interpolation, the contribution
of the neighbors will be based on the fractional distances.
Nearest neighbor would simply get the value of the
closest of those 8.
The linear interpolation option works better for my case. I want to simulate 2D from the 3D images.
Based on my data, when the slice of 2D is right at the 3D slice location, the voxel values are very close to each other, but not exactly the same. It seems some interpolation still happens.
“The contribution of the neighbors will be based on the fractional distances.” makes sense to me. Do you have a specific equation by any chance?
" it might land somewhere with 8 neighbors" Do you mean 8 neighbor slices are always used in “3dresample” (well, except edge slices)?
If a new coordinate is .3 of the way from old coordinate
A to old coordinate B (on one axis at a time), then linear
interpolation would give the new value .7val_A + .3val_B.
If it is 0.0 from A to B, then it gets A. This is done in all 3
axis directions, one at a time.
If you are getting unexpected interpolation, maybe you
should describe exactly how you are evaluating it at one
voxel location. Please include the output from:
3dinfo -n4 -extent -orient DATASET
Thanks,
rick
The
National Institute of Mental Health (NIMH) is part of the National Institutes of
Health (NIH), a component of the U.S. Department of Health and Human
Services.