taigw / GeodisTK

geodesic distance transform of 2d/3d images
MIT License
130 stars 35 forks source link

Missing one term in the geodesic distance #5

Closed John1231983 closed 5 years ago

John1231983 commented 5 years ago

In the original paper, the geodesic distance is defined: 2

while it is defined as below in your paper 1

it shows that you are missing the first term in the formular. Is it right? As mentioned in the original paper, the first term is Euclidean distance.

taigw commented 5 years ago

@John1231983 (2) can be seen as an extreme version of (1). Here (2) is fully defined based on Geodesic and (1) contains information of Euclidean distance (not purely geodesic). In my code I defined a parameter lamb which balances the two terms:

`def geodesic_distance_2d(I, S, lamb, iter):

'''

get 2d geodesic disntance by raser scanning.

I: input image

S: binary image where non-zero pixels are used as seeds

lamb: weighting betwween 0.0 and 1.0

      if lamb==0.0, return spatial euclidean distance without considering gradient

      if lamb==1.0, the distance is based on gradient only without using spatial distance

iter: number of iteration for raster scanning.

'''

return geodesic_distance.geodesic2d_raster_scan(I,S, lamb, iter)`
John1231983 commented 5 years ago

Thanks for your reply. But I did not find any lamb term in your equation (2). I mean if lamb is 0.5, then two terms contributes equally and it should be appear in the equation

taigw commented 5 years ago

equation (2) is the case of lamb == 1.0

John1231983 commented 5 years ago

@taigw : It is clear now. So, can your code can produce the results likes eq. (1) in case of lamb = 0.5? It means I want to consider the first term also.

taigw commented 5 years ago

Yes, you can set lamb to 0.5 to obtain a mixture of the two terms. I have updated the 2D example as you can see in the readme file.