# Partial Volume and (linear) interpolation

Hello

I am trying to construct a ground truth partial volume map (of brain region)
For instance I start with a high resolution (0.25 mm³) binnary mask of Gray Matter (GM) and I want to compute the partial volume at 1mm^3 resolution
Since this is a multiple of the initial resolution I can compute the exact partial volume, simply as the average of the original binary mask (average over the 444 voxel at 0.25 mm resolution)

I computed this partial volume using torch AveragePooling

Then I compared with the resampling method as implemented by torchio (but it rely on itk ResampleImageFilter from simple itk) with the linear interpolation I obtain a very different results

Actually it is kind of similar, but all values are only in the set ( [0.0000, 0.1250, 0.2500, 0.3750, 0.5000, 0.6250, 0.7500, 0.8750, 1.0000])

Sorry if is is a bug on my side, but I double checked and I do start with a nifti f32 bit float volume. Since I average over 4^3 voxels I expect to have 64 possible values (| 0 0.0156, 0.0312 ect …]

I compared different implementation of interpolation:
_ resample_from_to from nibable give the same result as itk
_ mrgrid (from mrtrix) does give the exact same result a AveragePooling,
_ flirt gives me a similar results as mrgrid (but more partial volume !)

I am very surprise to have so much different results. How can it be that a simple linear interpolation leads to different implementation ?

My initial objective was to quantify the error when estimating the Partial volume with voxel size not being a multiple of 0.25, but I can not even get a clear answer for the simple case …