Borda / BIRL

BIRL: Benchmark on Image Registration methods with Landmark validations

Home Page:http://borda.github.io/BIRL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DROP2 registration and RGB output

asmagen opened this issue · comments

commented

Hello @Borda
I have followed your advice in regards to running DROP2 through BIRL and I have a couple of questions. The code generates these images and I'm not sure which one is aligned to which one? And I believe the output.jpeg file is the output from DROP2 before applying the transformations onto the RGB?
registration_visual_landmarks
output
image_refence-warped
image_ref_landmarks_warped

I tried finding the code for the transformation on the RGB image and found the following, which appears to apply a shift on the landmarks. Can you point me out to the specific code performing the transformation on the original RGB image given output_field_x.nii.gz and output_field_y.nii.gz?
shift = self.extract_landmarks_shift_from_nifty(path_deform_x, path_deform_y, lnds_)

Finally, if the application of the transformation on the RGB image ends up being difficult to resolve on my end given the info you provide above (I hope not, but I'm new to image analysis so it is possible), can I just use the BIRL functions to perform the registration and transformations on the image, without providing any landmark information?

Thanks

Hi, you are right, we do not do RGB image warping but you should be able to it with image interpolation and output deformation field...

No, the gray scaled is the warped, then there are just overlaps color and gray and the last one is obviously not warped...

commented

Thanks. I got the following interpolation working but I run out of memory even on a high performance computing node with > 64 GB just for an image of size 4k x 4k. Any advice on how to scale it without tiling and merging the image which seems very laborious?

PATH_IMG_SRC = os.path.join(PATH_REGIST, 'Li63TCD20_cropped_mask.png')
PATH_IMG_REF = os.path.join(PATH_REGIST, 'Li63TCD3_cropped_mask.png')

PATH_DEF_X = os.path.join(PATH_REGIST, 'Li63T_CD20_transformed_field_x.nii.gz')
PATH_DEF_Y = os.path.join(PATH_REGIST, 'Li63T_CD20_transformed_field_y.nii.gz')

REF = plt.imread(PATH_IMG_REF);REF.shape
SRC = plt.imread(PATH_IMG_SRC);SRC.shape

img_dx = sitk.ReadImage(PATH_DEF_X)
img_dy = sitk.ReadImage(PATH_DEF_Y)
spacing = img_dx.GetSpacing()
deform_x = sitk.GetArrayFromImage(img_dx)[0] / spacing[0]
deform_y = sitk.GetArrayFromImage(img_dy)[0] / spacing[1]
grid_y, grid_x = np.mgrid[0:deform_x.shape[0], 0:deform_x.shape[1]]

output = REF
output[:,:,:] = 0
output.shape
level=0
for level in (0,1,2):
    print(level)
    img_src = SRC[:,:,level]
    img_ref = REF[:,:,level]
    img_src_resized = resize(img_src, img_ref.shape)
    img_warp2 = griddata((grid_y.ravel(), grid_x.ravel()), img_src_resized.ravel(),(grid_y + deform_y, grid_x + deform_x), method='linear')
    output[:,:,level] = img_warp2