# Partial Volume and (linear) interpolation

**URL:** https://discourse.itk.org/t/partial-volume-and-linear-interpolation/6254
**Category:** Algorithms
**Tags:** simpleitk
**Created:** [October 17, 2023, 7:48am UTC](https://discourse.itk.org/t/partial-volume-and-linear-interpolation/6254 "2023-10-17T07:48:03Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Romain\_Valabregue](https://discourse.itk.org/user_avatar/discourse.itk.org/romain_valabregue/32/2393_2.png) [@Romain\_Valabregue](https://discourse.itk.org/u/Romain_Valabregue)
#### Post date: [October 17, 2023, 7:48am UTC](https://discourse.itk.org/t/partial-volume-and-linear-interpolation/6254/1 "2023-10-17T07:48:03Z")

</div>

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 4_4_4 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 …

Many thanks for your insight

---

<div class="post-metadata">

### Author: ![Romain\_Valabregue](https://discourse.itk.org/user_avatar/discourse.itk.org/romain_valabregue/32/2393_2.png) [@Romain\_Valabregue](https://discourse.itk.org/u/Romain_Valabregue)
#### Post date: [October 17, 2023, 1:41pm UTC](https://discourse.itk.org/t/partial-volume-and-linear-interpolation/6254/2 "2023-10-17T13:41:45Z")

</div>

sorry for the multiple post, but I also ask the same quesiton on the nibable forum (since nibable and itk has the same interpolation)

let’s keep the discussion over there if you are interested

> **[Partial Volume and (linear) interpolation · nipy/nibabel · Discussion #1264](https://github.com/nipy/nibabel/discussions/1264)**
>
> Hi there I just posted the same question on the itk forum, but I copy past it there, in case you have an other insight (and because resample\_from\_to (like itk resample) produce weird results) I am ...
