Message Boards Message Boards

1
|
6678 Views
|
5 Replies
|
4 Total Likes
View groups...
Share
Share this post:

FindCurvePath doesn't give reliable results for worm images

Posted 9 years ago

Hi guys,

I'm working on worm images. After image processing, a worm looks like this:

After Image Processing

Positions of the worm points / pixels:

wormpoints = Position[Transpose@ImageData[worm, "Bit", DataReversed -> True], 1]

Here's the problem:

The points are not necessarily ordered correctly, from the worm head (left) to its tail. I've tried ordering them by:

wormpointsordered = wormpoints[[First@FindCurvePath[wormpoints]]];

Unfortunately, this step is not very reliable. It should give me all worm points, but ordered. In reality, it sometimes gives me only 10 points. Sometimes even only 3 points!

Any ideas? Thanks

David.

POSTED BY: David Thissen
5 Replies
POSTED BY: David Thissen

Hi David,

sorry for my late response - it is an interesting problem you brought up! Yes, FindCurvePath is not working correctly. I myself found this disturbing, so I eventually wrote my own routine. You can find this in the attached notebook; it should be self expaining. (The routine is not very much tested - I am not promising anything!)

You were thinking about extracting all the angles along the worm line. I can not think of anything meaningful to be done with this large amount of tiny angle values - if you do can, I am not saying anything. But how about starting with something very simple: Dividing the worm line into 4 equal (?) pieces. Then there are only 3 angle values which define the configuration of the worm (this way) completely. As the worm moves the changes of the angles in time can be represented by a 3D trajectory which can be visualized - this is always an advantage! If the motion of the worm is in some way periodic, the corresponding trajectories will most likely show a pattern. ... Well, just a suggestion!

Greetings Henrik

PS: If you ever try this simple experiment I would be interesting in seeing the result.

Attachments:
POSTED BY: Henrik Schachner

Ok, I think I found the problem: FindCurvePath split the worm into several curve paths.

Not what I wanted, but just taking the longest curve path

wormpointsordered = wormpoints[[First@With[{L = Length /@ FindCurvePath@wormpoints}, 
     Pick[FindCurvePath@wormpoints, L, Max@L]]]];

Seems to work for the moment...

Thanks, and have a nice weekend everyone!

POSTED BY: David Thissen
POSTED BY: David Thissen
POSTED BY: David Thissen
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract