Measuring the centerline
- Nafiseh Ebrahimi
- Posts: 2
- Joined: Mon Feb 04, 2019 3:29 pm
Measuring the centerline
Hello everyone,
I have created a centerline based on a ".stl" model in Simvascular. Now, I am interested in measuring the spline length between two specific control points, like the distance between two branches of the aorta on the centerline. would you please direct me how to do it? I tried the measurement button in the software but apparently, it cannot measure the distance I am interested in.
Regards,
I have created a centerline based on a ".stl" model in Simvascular. Now, I am interested in measuring the spline length between two specific control points, like the distance between two branches of the aorta on the centerline. would you please direct me how to do it? I tried the measurement button in the software but apparently, it cannot measure the distance I am interested in.
Regards,
- David Parker
- Posts: 1718
- Joined: Tue Aug 23, 2005 2:43 pm
Re: Measuring the centerline
Hi Nafiseh,
There is currently no functionality in SimVascular GUI to measure the distance between control points along a center line.
It might be possible to do this using the SimVascular Python interface, I will look into that.
Cheers,
Dave
There is currently no functionality in SimVascular GUI to measure the distance between control points along a center line.
It might be possible to do this using the SimVascular Python interface, I will look into that.
Cheers,
Dave
- Nafiseh Ebrahimi
- Posts: 2
- Joined: Mon Feb 04, 2019 3:29 pm
Re: Measuring the centerline
Thank you so much David. I really appreciate if you could direct me how to do that in Python interface.
Regards,
Regards,
- David Parker
- Posts: 1718
- Joined: Tue Aug 23, 2005 2:43 pm
Re: Measuring the centerline
Hi Nafiseh,
I have created a Python script called contour_distance.py that is used to calculate the distance between the centers of contours created in the SimVascular SV 2D Segmentations module. It is not exactly what you want but it is close. I will be adding other scripts soon, need to create a new version of SimVascular to support some additional functionality.
You can download the script from https://github.com/ktbolt/cardiovascula ... on-scripts. There is a README there that explains how to use the script.
Let me know if you have any questions or have any problems. I am just learning how to use the Python interface so the script may need to be refined a bit.
Cheers,
Dave
I have created a Python script called contour_distance.py that is used to calculate the distance between the centers of contours created in the SimVascular SV 2D Segmentations module. It is not exactly what you want but it is close. I will be adding other scripts soon, need to create a new version of SimVascular to support some additional functionality.
You can download the script from https://github.com/ktbolt/cardiovascula ... on-scripts. There is a README there that explains how to use the script.
Let me know if you have any questions or have any problems. I am just learning how to use the Python interface so the script may need to be refined a bit.
Cheers,
Dave
- Rudolf Hellmuth
- Posts: 19
- Joined: Mon Jul 25, 2016 7:32 am
Re: Measuring the centerline
Hi,
I used to make many measures with the centreline with version 2018.08.09 and older ones. I have scripts that measure arc-length, curvature and separation angles between two branches. Separation angle as the angle a branch has compared to other branch if one branch's centreline would travel along the main vessel's centreline to meet the other branch's centreline. I also used to use the centreline to extract tangent vector and use them to slice the cross-section of blood vessels. I cannot do this with the newest version of SimVascular. The current version is giving me the a rough centreline, because it generates points that are too close from one another (please, see attached pictures). The tangent vector is very sensitive to the proximity of the points of the centreline.
Moreover, the centrelines used to be stored as PTH files rather than CSV. However, this isn't any problem.
Why is the centreline so rough now, when it used to be smooth before? Could this be fixed?
Best regards,
Rudolf
I used to make many measures with the centreline with version 2018.08.09 and older ones. I have scripts that measure arc-length, curvature and separation angles between two branches. Separation angle as the angle a branch has compared to other branch if one branch's centreline would travel along the main vessel's centreline to meet the other branch's centreline. I also used to use the centreline to extract tangent vector and use them to slice the cross-section of blood vessels. I cannot do this with the newest version of SimVascular. The current version is giving me the a rough centreline, because it generates points that are too close from one another (please, see attached pictures). The tangent vector is very sensitive to the proximity of the points of the centreline.
Moreover, the centrelines used to be stored as PTH files rather than CSV. However, this isn't any problem.
Why is the centreline so rough now, when it used to be smooth before? Could this be fixed?
Best regards,
Rudolf
- Attachments
-
- If a line segment is very short, the tangent becomes almost 90deg with the vessel. This produces slices that are practically longitudinal to the vessel.
- speciallyBadSlices.png (111.73 KiB) Viewed 1140 times
-
- Slices orthogonal to the centreline. They make cross-section if at long segments, and non-orthogonal slices at short line segments.
- slices1.png (90 KiB) Viewed 1140 times
-
- Curvature errors correlate with cross-sectional area errors, as the slice is not orthogonal (it is not the cross-section).
- curvatureAndAreaErrors.png (25.95 KiB) Viewed 1140 times
-
- If a slice is made using the tangent vector of one of the short segments, then this slice is not orthogonal to the vessel. It is not the cross-section.
- centreline_cros-sectionBetweenVeryClosePoints.png (24.44 KiB) Viewed 1140 times
-
- Centreline has segments of variable lengths. Some are long and others are short. The short ones drastically change the direction of the tangent vector.
- centreline.png (12.67 KiB) Viewed 1140 times
- Rudolf Hellmuth
- Posts: 19
- Joined: Mon Jul 25, 2016 7:32 am
Re: Measuring the centerline
The other message was no allowing me to upload more pictures. I will do it here.
We have also found out that the algorithm that makes the centreline fails when the curvature of the vessel is high. We have scanned the superficial saphenous vein with the knee bent at 120 deg. The lofted vessel is smooth, but SimVascular crashes when we try to get the centreline.
My colleague has done many segmentations with the newest version of SimVascular. We will now see if we can open a project made in a new version using an old version, just to get a proper centreline out of it. Hopefully that will work. We have a lot of data to be processed...
Best regards,
Rudolf
We have also found out that the algorithm that makes the centreline fails when the curvature of the vessel is high. We have scanned the superficial saphenous vein with the knee bent at 120 deg. The lofted vessel is smooth, but SimVascular crashes when we try to get the centreline.
My colleague has done many segmentations with the newest version of SimVascular. We will now see if we can open a project made in a new version using an old version, just to get a proper centreline out of it. Hopefully that will work. We have a lot of data to be processed...
Best regards,
Rudolf
- Attachments
-
- Approximate diameter along centreline arc-lengths. D = sqrt(4/pi*A)
- cadaver_diameter.png (139.3 KiB) Viewed 1133 times
-
- No problems measuring curvature with the centreline of an old version of SimVascular. Curvature along the arc-length of the centreline was smooth, even though it is a derivative of the tangent vector.
- cadaver_curvature.png (119.57 KiB) Viewed 1133 times
-
- This is a vessel out of which I sampled data before using an old version of SimVascular in 2017. All slices are orthogonal with the vessel.
- CP094-MI-03-03B-S1_sampling.png (21.37 KiB) Viewed 1133 times
- Rudolf Hellmuth
- Posts: 19
- Joined: Mon Jul 25, 2016 7:32 am
Re: Measuring the centerline
Hi,
I have made a merge by distance filter to handle the new centrelines. It has fixed the issue for me. I am including the filter here in case anyone needs this workaround. FYI, my vessel has an average diameter of about 5 mm, and I have merged all points in the sequence whose distance is < 0.6 mm.
I have made a merge by distance filter to handle the new centrelines. It has fixed the issue for me. I am including the filter here in case anyone needs this workaround. FYI, my vessel has an average diameter of about 5 mm, and I have merged all points in the sequence whose distance is < 0.6 mm.
Code: Select all
def mergeByDistance(pathPoints, minDistance, verbose=False):
'''
Merge path points with the neighbours in a sequence if they are at a
distance less less than 'minDistance' from each other.
Parameters
----------
pathPoints : numpy.array(n, 3)
x-, y-, and z-coordinates of the n points defining pathline.
minDistance : float
minimum Carthesian distance allowed of neighboring points to be
separated in a path.
verbose : bool
Swith to print points that are being merged.
Returns
-------
numpy.array(n, 1)
'''
points = list()
count = 0
for i, point in enumerate(pathPoints):
if i == 0:
points.append(point)
else:
delta = point - points[-1]
d = np.linalg.norm(delta)
if d < minDistance:
if verbose:
print('mergeByDistance: points {0:d} and {1:d} by distance'+
' {2:f} < {3:f}.'.format(i-1, i, d, minDistance))
points[-1] += 0.5*delta # last point moves to halfway
count += 1
else:
if verbose:
print('mergeByDistance: points {0:d} no change.'.format(i))
points.append(point)
print('mergeByDistance: {0:d} of {1:d} merged.'.format(count, i))
return np.array(points)
- Attachments
-
- Comparing the original (red) and the smoothed (blue) centrelines. The smoothed centreline was treated by the mergeByDistance function.
- smoothedCentrelineZoom.png (94.95 KiB) Viewed 1123 times
-
- With smoothed centreline, all slices represent cross-sectional planes.
- smoothedCentreline.png (62.83 KiB) Viewed 1123 times
- David Parker
- Posts: 1718
- Joined: Tue Aug 23, 2005 2:43 pm
Re: Measuring the centerline
Hi Rudolf,
There has been a lot of work done on generating better centerline geometry (e.g. https://github.com/SimVascular/SimVascular/issues/655). The centerline format is thus different from what it used to be.
We are using centerline geometry for lots of different kinds of applications and have not seen any problems. But of course there may be a problem with the particular type of vessel geometry you are dealing with. If you think the data is not correct then please open an Issue here https://github.com/SimVascular/SimVascular/issues.
Cheers,
Dave
There has been a lot of work done on generating better centerline geometry (e.g. https://github.com/SimVascular/SimVascular/issues/655). The centerline format is thus different from what it used to be.
We are using centerline geometry for lots of different kinds of applications and have not seen any problems. But of course there may be a problem with the particular type of vessel geometry you are dealing with. If you think the data is not correct then please open an Issue here https://github.com/SimVascular/SimVascular/issues.
Cheers,
Dave
- Martin Pfaller
- Posts: 60
- Joined: Tue Oct 01, 2019 10:23 am
Re: Measuring the centerline
Hi Rudolf,
That's an interesting centerline. I see how the change in discretization length can cause these problems. This could be fixed by either using multiple points in the finite difference method or regularizing the tangent.
What's curious is that in our example the points are usually somewhat equally spaced. In general, the centerline mesh resolution depends on the surface mesh resolution. I'm wondering if the surface mesh in your case is also irregular and if the centerline could be fixed by remeshing the surface?
Best,
Martin
That's an interesting centerline. I see how the change in discretization length can cause these problems. This could be fixed by either using multiple points in the finite difference method or regularizing the tangent.
What's curious is that in our example the points are usually somewhat equally spaced. In general, the centerline mesh resolution depends on the surface mesh resolution. I'm wondering if the surface mesh in your case is also irregular and if the centerline could be fixed by remeshing the surface?
Best,
Martin