Image-Py / sknw

build net work from skeleton image (2D-3D)
BSD 3-Clause "New" or "Revised" License
222 stars 47 forks source link

Reference Papers of the algorithm #10

Open tf1991-06 opened 4 years ago

tf1991-06 commented 4 years ago

Dear yxdragon, thank you for your great work. This library helped me a lot in my work! By the way, I want to know what algorithm is used in this library. Could you please tell me or write in readme.md about reference paper?

yxdragon commented 4 years ago

it is not difficult and I did not referent any paper here is the main step: 1 get skeleton image 2 do a 3x3 conv sum, and masked by the skeleton image. (how many neighbors) then: in the conv image 1 means endpoint 2 means pathpoint 3 or more means junction 3 trace from endpoint to junction through pathpoint one by one.

tf1991-06 commented 4 years ago

With the help of your information, I think I can read the source code. Thank you!

yxdragon commented 4 years ago

bu I use ravel index to treat different dim. eg. in 2d we have r,c. and in 3d we use r, c, z. but in topology space, we can use a 1d ravel index. and neighbors means with the specific difference idx.

eg. a 5x7 array, we use 0-34 to index, and pix[i] ,s neighbors is i-1, i+1, i-7, i+7, i-7-1, i-7+1, i+7-1, i+7+1. then all the process is based on neighbors idx. so we can treat any dim.

idx2rc, rc2idx, neighbors these three function is to get neighbors idx and transform between rc and ravel idx.

tf1991-06 commented 4 years ago

Thanks again!

But I think, the most hard point is about parse_struct() function. I think, but just an idea, fill() and trace() functions will be easier to see by recursive function.

yxdragon commented 4 years ago

not hard, just use list to iterate a graph structure. the fill should be called flood fill.

tf1991-06 commented 4 years ago

I've never heard of "flood fill algorithm". Thanks for the further information!