thorstenwagner / ij-ridgedetection

Detect ridges / lines with imagej
GNU General Public License v2.0
42 stars 27 forks source link

Potential issue in Link->compute_contours #38

Closed lucalusn closed 5 years ago

lucalusn commented 5 years ago

In the first infinitive loop (https://github.com/thorstenwagner/ij-ridgedetection/blob/master/src/main/java/de/biomedical_imaging/ij/steger/Link.java#L365) when you look for the 'Line' objs you save some values in the row,col,angle and resp Arrays and at the end of the loop you saved it in a Line obj.

You init these Arrays before the loop (https://github.com/thorstenwagner/ij-ridgedetection/blob/master/src/main/java/de/biomedical_imaging/ij/steger/Link.java#L322) and you resize them into the loop ...anyway you rewrite them in every iteration.

I suppose that different Line can have different number of values in the row/col/etc. Array. If the Line 'm' has less row values than Line 'n' (with m>n) you will not rewrite the last value of these Arrays but you will still save them on the line 'm' arrays.

e.g.: Line1 has 80 value in its row. Line2 has 60 value in its row Hence Line2 will have 80 value in its row: the 60 real value + the last 20 value of Line1.

Is it an error or we are sure that the next Line will have at least the same number of elements (of rows for example) that the precedent?

lucalusn commented 5 years ago

I noted that when you save these Line you consider only the correct amount of points. (https://github.com/thorstenwagner/ij-ridgedetection/blob/master/src/main/java/de/biomedical_imaging/ij/steger/Link.java#L839) Sorry for the spam