Help me with a logic puzzle? Connecting semi-random sets of lines together

1 view (last 30 days)
Brian
Brian on 8 Nov 2015
Hey, thanks for reading this,
So I'm having trouble trying to get something to work. What I want to do is find the connectivity between sets of points that are arranged randomly in a binary tree. See here for a picture of said binary tree. All of the single color lines are points that I plot, and I have n = 127 sets of lines going into this tree. The function was great, I was able to get my skeleton. The problem comes with post processing the data.
Here is how I have my data organized. I used a function online that fast marches through a 3D image, and it outputs a n length cell of points, which are connected incrementally (as in S{1}(1,:) is connected to S{1}(2,:), etc). If you use the visualize_centerline.m attached you can see the picture.
For some code I'm going to do analysis on, though, I need to find points and connectivity. My problems are thus:
  • S{1:length(S)} contains duplicate points. If S{i},(1,:) is the same as S{j}(end,:), i is the continuation of the line j and S{j}(1,:) == S{i}(end,:).
  • The lines are arrayed randomly, such that for any line i, j can range from 1:length(S). If it was always incremental, as in S{2} continues from S{1} I can understand it. The randomness throws off my thought process on how best to code it.
  • I want to arrange a connectivity matrix so I have the point indices marked. As in [1 2; 2 3] means point 1 is connected to point 2. 1D connections for a line, more or less, stored for later analysis.
  • The kicker in all of this is some lines in S are disconnected, see here. I'm going to have to connect this to create a bifurcation, I was thinking to the min distance of the closest S{i}(end,:) point. In here, im not creating any points, just a connection.
Any ideas on how best to do this? What I want to have at the end of the day is this:
  • A pointMx with non-duplicate points n_points x 3 columns for x,y,z coordinates, and
  • A faceMx with m x 2 columns, for pt1, pt2 indices for each connection.
I attached the data here so you can see/visualize my data.
Thanks for any advice you can give. I've been puzzling over this for a few hours, I was thinking first I could re-number the S{1:end} to make it coherent, 2 leading from 1, and then link it incrementally.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!