HieuPhan33 / MaskGAN

MaskGAN for unpaired MR-to-CT synthesis. Official implementation of MICCAI 2023
27 stars 6 forks source link

preprocess errors #6

Closed Zeay-ZZY closed 3 months ago

Zeay-ZZY commented 8 months ago

My data structure is the same as you described. The data under /root/CT and /root/MRI are 2D .nii.gz files with dimensions of 256x256, obtained by decompressing .nii data using gzip.GzipFile. After obtaining the dataobj with nibabel, it is an array of shape [1, 1, 256, 256]. However, when I run the main.py for preprocessing, I encounter the following error:

RuntimeError at D:\a\ANTsPy\ANTsPy\itksource\Modules\Core\Common\include\itkMatrix.h:268: ITK ERROR: Singular matrix. Determinant is 0.

I don't know how to resolve this issue

HieuPhan33 commented 8 months ago

Hi, my preprocessing script works on 3D data. To apply on 2D, the best way is to concatenate 2D slices to reconstruct the original 3D scans.

A sub-optimal way is to duplicate the 2D slices N times, let's say 30 times, save as NIFTI, and run the script.

Finally, the alternative solution is to modify the script for processing 2D data: https://github.com/HieuPhan33/MaskGAN/blob/55b2cd3b31f3e0dd3e4c4cfcc5ae90a9faefcef6/preprocess/main.py#L87

Zeay-ZZY commented 7 months ago

thank you