Closed bashkanov closed 5 years ago
sorry @bashkanov i overlooked your ticket un till closed it just now :p Do you still have the questions or it is solved now?
The implementation part is clear to me now :+1:. Could you please elaborate on advantageous of calculating the image gradient with a step size of two (as you did) instead of taking it for neighboring pixels? Maybe there is a paper explaining it well?
sorry @bashkanov i overlooked your ticket un till closed it just now :p Do you still have the questions or it is solved now?
There is nothing fancy - this is standard gradient calculation using finite difference. You can use more than one pixels in each direction if not for computational efficiency. You can also convolve with derivatives of Gaussian using efficient FFT. The implemented is only one of the numerical solutions for computing gradient.
Thank you for answering my question to satisfy my curiosity!
Dear @YipengHu,
thank you for sharing this code with us! I'm trying to understand your
local_displacement_energy
function. In your paper you refer to (Rueckert et al. 1999) where bending energy is clearly defined. Implementation of L1, L2 gradient norms are also pretty straightforward. But I still cannot get the intuition behind yourgradient_dx/y/z
functions.It's clear to me why gradient_dx/y/z returns the vol shape less by 2 for x,y,z, axes, e.g. the input shape
[batch, 90, 90, 90, 3]
will result into shape[batch, 88, 88, 88, 3]
for dx, dy, dz. If we want to preserve the original shape we should append zeroes accordingly as it states in this tf.doc image_gradients:I’m eager to receive your response!