-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1_preprocess #5
Comments
Hi, the shape of the image loaded from SimpleITK is (z, y, x) with the spacing of (x, y, z). To align the shape order with the spacing, it is necessary to change the shape order. |
Thanks, I know. However, when you saved the image later, it was not transformed back. Doesn't this mean that the order of the images was changed? |
Hi, if we transform back the order of images, we should change the order again when we further process the image (as we record the spacing in the form of (x, y, z)). Hence, to make it convenient, we just save the image without changing the order. |
Thanks,I see. I have one ploblem: If the resolution is 128, then the blocks generated in the 3_block_save.py file should be changed to base = np.mgrid[:128, :128, :128], offset is set to 0, and blocks = blocks.transpose(0, 2, 1). astype(float) / 127. Is this correct modification? |
The purpose of saving CT as blocks is to accelerate the loading speed and save the memory. For example, for a data sample, we should load an array of 256^3. With blocks, we can randomly choose a block to load (i.e., 64^3), which is faster in practice. For your question, if your resolution is 128^3 and you choose the block size of 128^3, there is no need to conduct step 3. You can directly modify the dataset (https://github.com/xmed-lab/DIF-Net/blob/main/code/dataset.py#L200) to load CT (reshape the CT to [N, 1] or [N,] as block_values) and set the block_coords to np.mgrid[:128, :128, :128] (also reshape to [N, 3]). |
Yes, Is this correct modification? image = self.load_ct(name) |
It seems that you do not need to extend an additional dimension for the loaded CT. You can just reshape it as [N,] as the additional dimension of p_gt will be extended in https://github.com/xmed-lab/DIF-Net/blob/main/code/dataset.py#L226 |
Ok, I sincerely appreciate your reply. Thanks! |
Why do you need to change the order? image = image.transpose(2, 1, 0)
The text was updated successfully, but these errors were encountered: