Hello, I’m new to simpleITK and have a question about resizing the image. In my understanding, spacing is the distance between the pixels. So I thought if I reduce the spacing by half, I can get a new half-size image without pixel data loss. However, when I run the code below, I needed to increase spacing twice to get a half-size image. Also, the new file size was much smaller than the original, so I was worried about the data loss. Am I doing something wrong here?
dicom_names = reader.GetGDCMSeriesFileNames(data_directory) reader.SetFileNames(dicom_names) image = reader.Execute() size = image.GetSize() spacing = image.GetSpacing() print("Original image size:", size) print("Original image spacing:", spacing) new_spacing = np.array(spacing) * 2 new_size = (np.round(size * (np.array(spacing)/new_spacing))).astype(int).tolist() resampled_image = sitk.Resample(image, new_size, sitk.Transform(), sitk.sitkNearestNeighbor, image.GetOrigin(), new_spacing, image.GetDirection(), 0.0, image.GetPixelID()) resampled_image_size = resampled_image.GetSize() resampled_image_spacing = resampled_image.GetSpacing() print("Resampled image size:", resampled_image_size) print("Resampled image spacing:", resampled_image_spacing)