Dear AFNI friends,
I would like to interpolate the value of some voxels with zero values considering neighbouring voxels within an ROI (e.g. sphere, box) and that it can also consider a mask (e.g. tissue mask) to indicate which voxels to consider. Is there any program that can perform this beyond the options of 3dLocalstat? For instance considering a linear interpolation or high-order spline interpolation?
Thanks in advance for your suggestions
Would it be enough to run 3dAllineate to resample (or 3dresample, if those interpolants are sufficient), and then threshold with 3dcalc?
The point is that we are not doing any spatial transformation since the data is in the same space. I checked 3dresample but it does not have any option for mask.
As for 3dAllineate, is it possible to use it with no spatial transformation or how an identity transformation can be coded? Could the options -emask ee or -source_mask sss serve for our purposes? We only want to do the interpolations (-final) and considering a mask.
I’m not clear as to what you want to do. I’ll provide options that hopefully will give clues.
- 3dAllineate does allow for an identity matrix, mostly for the purpose of resampling. Both -1Dparam_apply and -1Dmatrix_apply can take “IDENTITY”.
- 3dBlurInMask can be used specifically with a mask.
- 3danisosmooth also smooths within a mask. You can set the fraction of gaussian smoothing.
Let us know if I’m completely off track with these suggestions.
Thanks for the suggestions. One question: Does 3dAllineate have the option of setting a mask in the source image so that masked voxels are ignored for the interpolation? In fact, we want to fill in these voxels that we know shouldn’t be zero.
We will try 3danisosmooth.
3dAllineate does have mask for the source dataset, but I’m not sure if that’s what you want. Are you trying to fill holes? Is this for ROIs with a particular integer value for each region type, or are you trying to fill holes of function with floating point values.
Yes, we are trying to fill holes based on neighbouring voxels, for instance a sphere but considering a mask within that region. And we don’t want to take the average value as in 3dLocalstat, but would prefer some kind of high-order interpolation. They are floating point values.
It seems to me you can do something more along the lines of Rick’s suggestion then; smooth then with some program and only use the values for the holes. 3dmerge allows custom filters with “-1filter_expr” where you could compose a filter that does not include the voxel itself. It may be simpler to use a median filter, just replacing the hole voxels with the median value in the neighborhood. See “3dmerge -1filter_winsor”, “3dLocalstat -stat median”.