Closed yXiangXiong closed 5 years ago
Hi,
thank you for your comments. Could you please specify the problem with the Dicom format. Is the registration or the image read function the problem?
Thank you, professor,
For png CT data: fixed_image = al.read_image_as_tensor("./data/fixed.png", dtype=dtype, device=device) fixed_image = al.read_image_as_tensor("./data/moving.png", dtype=dtype, device=device) The code above worked well with examples/affine_registered_2d.py, examples/demons_registration_2d.py, examples/diffeomorphic_registration_2d.py and examples/diffeomorphic_registration_2d.py .
For dicom CT data: fixed_image = al.read_image_as_tensor("./data/fixed.dcm", dtype=dtype, device=device) fixed_image = al.read_image_as_tensor("./data/moving.dcm", dtype=dtype, device=device) The code above worked well with examples/demons_registration_2d.py, examples/diffeomorphic_registration_2d.py and examples/kernel_registration_2d.py, but failed with examples/affine_registered_2d.py. So image read function may have no problems. For dicom CT data, it seems rotated the fixed image a little, but didn't finish the SimilarityTransformation.
Hi, thank you for this information. You can try to normalize the data before performing the registration. Depending on the intensity values you need to change some hyperparameters e.g. for the regularisation. This could be a reason why there is a difference between Dicom and png.
Thank you, professor, I have solved the problem under your instruction.
First, i set outside-of-scan pixels to 0: image[image == -2000] = 0 Then, i add some code in ''def normalize_images'' to normalize the CT dicom data: def normalize_images(fixed_image, moving_image): MIN_BOUND = -1000.0 MAX_BOUND = 400.0 fixed_image.image = (fixed_image.image - MIN_BOUND) / (MAX_BOUND - MIN_BOUND) fixed_image.image[fixed_image.image > 1] = 1. fixed_image.image[fixed_image.image < 0] = 0. moving_image.image = (moving_image.image - MIN_BOUND) / (MAX_BOUND - MIN_BOUND) moving_image.image[moving_image.image > 1] = 1. moving_image.image[moving_image.image < 0] = 0. ...
Hi, nice to hear that you could solve the problem.
Dear professor,Thank you for your contribution about image registration. I face a problem when i do some experiments on medical image via examples/affine_registration_2d.py. Left is fixed CT image, middle is moving fixed image and right is registration result. It's perfect to apply to png format from above figure. But it seems doesn't work for dicom format(pydicom read manner via python):