orobix / retina-unet

Retina blood vessel segmentation with a convolutional neural network
1.26k stars 468 forks source link

Equation used in `is_patch_inside_FOV` function #19

Closed jain-anshul closed 7 years ago

jain-anshul commented 7 years ago

Can you please explain how did you reach to the following equation

y_ = y - int(img_h/2)  # origin (0,0) shifted to image center
R_inside = 270 - int(patch_h*1.42) #radius is 270 (from DRIVE db docs), minus the patch diagonal (assumed it is a square #this is the limit to contain the full patch in the FOV
radius = np.sqrt((x_*x_)+(y_*y_))

According to me it the equation should be R_inside = 270 - int(patch_h/1.42) #Half of diagonal

lantiga commented 7 years ago

Considering patch_h as the height of a patch in pixels, for a patch to be fully inside the FOV we consider the worst case scenario where a patch intersects the circle of the FOV (of radius 270) along the diagonal.

But you're right, we're being too conservative: we should be using half the diagonal since we're limiting the position of the center of the patch with respect to the center of the image. The correct equation should be R_inside = 270 - int(patch_h / np.sqrt(2) * 2).

/cc @dcorti

a2tm7a commented 7 years ago

@lantiga R_inside = 270 - int(patch_h / np.sqrt(2) * 2) is the same equation as used in the code. The correct equation, according to me, should be R_inside = 270 - int(patch_h * np.sqrt(2) / 2)

dcorti commented 7 years ago

Hi,

You're right, only half diagonal should be considered and not the full one. Your equation is correct, I updated the code. Thank you for spotting the mistake!

lantiga commented 7 years ago

Hey, so: I messed up. @amitmanchanda1995, of course you're right. I apologize for the noise.