Skip to content

Question about how to create low-resolution images from high-resolution images to run on UniRes #20

Description

@jueqiw

Hi @brudfors ,

Thanks for this wonderful work! I am working on a project which solves a similar problem to UniRes and uses UniRes as a comparison method. However, I think there is something wrong with my code (in creating a low-resolution image or scaling before computing the SSIM metric) that I cannot achieve a similar result in your paper. I would really appreciate it if you could help me check whether anything I did was wrong.

I use the following code to generate a low-resolution image (4mm thick axial sliced) from a high-resolution one ($1\times1\times1 mm^3$):

import nibabel as nib
from nibabel.affines import rescale_affine
from nilearn.image import resample_img

img = nib.load("HR_mri.nii.gz")
new_zooms = np.array(img.header.get_zooms()) * [1, 1, 4]
new_shape = np.array(img.shape) // [1, 1, 4]
new_affine = rescale_affine(img.affine, img.shape, new_zooms, new_shape)
new_img = resample_img(
    img,
    target_affine=new_affine,
    target_shape=new_shape,
    interpolation="nearest",
)
near_new_img = resample_img(
    new_img,
    target_affine=img.affine,
    target_shape=img.affine,
    interpolation="nearest",
)
new_nib = nib.Nifti1Image(near_new_img.get_fdata(), img.affine)
nib.save(
    new_nib,
    "LR_mri.nii.gz",
)

Then I let UniRes run on the LR_mri.nii.gz to generate a high-resolution one. However, this is the result I get: (Input, UniRes)
image.
To draw this image, I cropped out an area ($160\times224\times160$) around the brain. I compute the SSIM value on this area after scaling both volumes into [0, 1]. The SSIM I computed is only around 0.48, which is lower than the value reported in the paper.

It also would be really helpful if you could show me the code for how you create low-resolution images.

Thank you for this wonderful project again!

Jueqi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions