Hi @J-b, welcome to this community.

First, I’d like to point out that you don’t want to *rescale* your image, you want to *regrid* or *upsample* (more generally, *resample*) your data.

Currently, you can’t do that with nibabel alone (the library currently does not interpolate -in general-, for you). I would suggest to use nilearn for this.

There are two factors here. One is the sampling matrix, which you have already specified (data is currently on a 260 x 311 x 260 grid, and you want to resample it to 520 x 622 x 520.

The second factor is the location of data in physical coordinates w.r.t. some coordinate system (typically scanner coordinates). This information is encoded in the affine matrix corresponding to the image. Nibabel provides it very nicely:

```
import nibabel as nb
nii = nb.load('your_nifti.nii.gz')
print(nii.affine)
```

You’ll need to build a corresponding affine matrix that has double resolution (half pixel size) and covers almost exactly the same physical extent (i.e. you need to calculate a new origin).

Then, you can use nilearn.resample_img setting the arguments `target_affine=newaffine`

and `target_shape=(520, 622, 520)`

.