Dear all,
I have 3d image and I would like to write a dataloader with a rescale trasformation .
What is the best way to do the rescaling? I have [240,240,180] I would like to  trasform [128,128,128].
Any suggestion on  function for dataloader.
Thanks so much
class Resize(object):
   
    def __init__(self, output_size):
        assert isinstance(output_size, (int, tuple))
        self.output_size = output_size

    def __call__(self, sample):
        image, label = sample["data"], sample["label"]

        h, w = image.shape[:2]
        if isinstance(self.output_size, int):
            if h > w:
                new_h, new_w = self.output_size * h / w, self.output_size
            else:
                new_h, new_w = self.output_size, self.output_size * w / h
        else:
            new_h, new_w = self.output_size

        new_h, new_w = int(new_h), int(new_w)

        # img = transform.resize(image, (new_h, new_w))
        img = scipy.ndimage.zoom(image, 0.5)
        return {"data": img, "label": label}