thorstenwagner / ij-ridgedetection

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

Account for overlap #11

Closed hinerm closed 8 years ago

hinerm commented 8 years ago

Adds a choice for overlap resolution and a slope (straightness) based method for resolving overlap.

Closes #5

hinerm commented 8 years ago

@thorstenwagner I updated this PR to fix the merge conflicts.

thorstenwagner commented 8 years ago

@hinerm Thank you so much! I will merge it this evening or tomorrow morning. My mother came to visit me ;-)

hinerm commented 8 years ago

:+1: awesome! :smile: have fun!

thorstenwagner commented 8 years ago

@hinerm I've now merged the pull request. However, for my example it seems not to do anything: ridge_test

I've used the following settings: Line Width: 6 High contrast: 255 Low contrast: 250 Checked: Add to manager, display results, show ids, show junctions points and extend line Method for overlap resolution: Slope

What I'm doing wrong?

imagejan commented 8 years ago

@thorstenwagner Your png image has a strange LUT and scaling. I had to switch the LUT to "Grays" and scale the 0-1 intensity range to 0-255 so that your parameters worked me. In addition, I used a small Gaussian blur to avoid a bunch of small line artifacts at the line ends.

With these adjustments, I get the following result:

8882e5ac-8861-11e5-9367-0a943108ad76-3

The way the lines were joined is not how I'd expect it, however... @hinerm Any comments?

thorstenwagner commented 8 years ago

Maybe the slope it calculated too locally?

@imagejan I converted it from a tif file automatically... this one is converted by imagej: ridge_test

I thought that the small artifacts should not be a problem?

hinerm commented 8 years ago

@thorstenwagner @imagejan - I downloaded the original, converted to a tif and tried.

With no parameter adjustment I got an "incorrect" segmentation like @imagejan Setting the sigma to 3 in the ridge detection UI (and no other changes) gave me "expected" segmentation.

Maybe the slope it calculated too locally?

I think this definitely could be a problem. Right now the distance is hard-coded.

I originally thought that making a configuration option would be useful. But now I'm thinking it might be better for each fragment to do some searching and use the longest section that it can (e.g. check straightness 5 positions back from intersection.. then 10, then 15, etc.. and use the longest section possible without significant change in straightness/slope).

I'm definitely open to suggestions!

hinerm commented 8 years ago

configuration: screenshot from 2015-11-11 09 12 02

segmentation: screenshot from 2015-11-11 09 12 21

hinerm commented 8 years ago

@thorstenwagner

I've used the following settings: Line Width: 6 High contrast: 255 Low contrast: 250 Checked: Add to manager, display results, show ids, show junctions points and extend line Method for overlap resolution: Slope

What I'm doing wrong?

This particular case was a bug I believe I have fixed now.

thorstenwagner commented 8 years ago

@hinerm Perfect, I guess it works good enough to make it available as release! Thank you so much for contributing! It is now available via update size as well.

Would you be so kind to update the fiji wiki page and descripe what the slope resolver exactly does? http://fiji.sc/Ridge_Detection

I think this definitely could be a problem. Right now the distance is hard-coded.

I originally thought that making a configuration option would be useful. But now I'm thinking it might >be better for each fragment to do some searching and use the longest section that it can (e.g. >check straightness 5 positions back from intersection.. then 10, then 15, etc.. and use the longest >section possible without significant change in straightness/slope).

I'm definitely open to suggestions!

I would try to use a distance relative to the line length but not smaller as your hard corded distance.

thorstenwagner commented 8 years ago

@hinerm Another suggestion: What about updating the junctions points, when you merge two lines? For my example, the two junction points could be merged to one junction point, because no other line is using small crossing line. Do you know what I mean?

Line Width: 6 High contrast: 255 Low contrast: 250 Checked: Add to manager, display results, show ids, show junctions points and extend line Method for overlap resolution: Slope

hinerm commented 8 years ago

It is now available via update size as well.

ack, I have a couple bug fixes that need to be merged!

Would you be so kind to update the fiji wiki page and descripe what the slope resolver exactly does?

Happily!! :smile:

I would try to use a distance relative to the line length but not smaller as your hard corded distance.

I updated it to recursively search for the longest, straight section it can find.. I hope that will be more robust.

hinerm commented 8 years ago

What about updating the junctions points, when you merge two lines?

You're right.. I need to do that..

thorstenwagner commented 8 years ago

ack, I have a couple bug fixes that need to be merged!

Argh! Ok, I will merge it and release again... :smile:

hinerm commented 8 years ago

yay! thank you! I will work on the wiki page