Fitting an implant in the vessels

Provides a system for patient-specific cardiovascular modeling and simulation.
POST REPLY
User avatar
Justin Tso
Posts: 25
Joined: Thu May 16, 2019 4:23 pm

Fitting an implant in the vessels

Post by Justin Tso » Sat Sep 28, 2019 4:49 pm

Hi, I'm interested in modeling the effect of an implant in the coronary vessels. The geometry of the implant is a simple cylinder with set dimensions of an inner and outer radius. I aim to place this implant around a vessel to constrict it and simulate stenosis--I wish to model this effect using SimVascular as a diagnostic. Is there any function in SimVascular that can allow me to superimpose or "fit" this STL file into an existing model of the coronaries, or at least orient it correctly in the image navigator so that I can segment the vessel with this implant in mind?

User avatar
David Parker
Posts: 1719
Joined: Tue Aug 23, 2005 2:43 pm

Re: Fitting an implant in the vessels

Post by David Parker » Mon Sep 30, 2019 3:38 pm

Hi Justin,

You can fit a cylinder to a path using the SV Python API. The API is not documented, I'm in the process of modifying it and will document it after that. I've attached a Python script named fit_cylinder_to_path.txt (SimTK won't let you upload a file with a .py suffix), change the .txt to .py after downloading.

For example you can use the script with the Demo project (http://simvascular.github.io/docsModelGuide.html). The following commands are used to fit a cylinder with radius 1.0 between control points 7 and 8 of the aorta path.

Code: Select all

aorta = PathFitCyl('aorta')
id1 = 7
id2 = 8
radius = 1.0
aorta.fit(id1, id2, radius)
I've put a short document on https://github.com/ktbolt/cardiovascula ... erface.pdf describing how to use the API.

Unfortunately there is a bug in the SV C++ code used to create a cylinder. I've fixed the code but I will need to integrate the fix and create a new installer for you. What OS are you using?

Cheers,
Dave
Attachments
Screen Shot 2019-09-30 at 2.27.03 PM.png
Screen Shot 2019-09-30 at 2.27.03 PM.png (489.17 KiB) Viewed 1269 times
Screen Shot 2019-09-30 at 2.27.31 PM.png
Screen Shot 2019-09-30 at 2.27.31 PM.png (401.52 KiB) Viewed 1269 times

User avatar
Justin Tso
Posts: 25
Joined: Thu May 16, 2019 4:23 pm

Re: Fitting an implant in the vessels

Post by Justin Tso » Mon Sep 30, 2019 9:24 pm

Hi David, thank you for your help. I'm using Windows 10 64-bit.

User avatar
David Parker
Posts: 1719
Joined: Tue Aug 23, 2005 2:43 pm

Re: Fitting an implant in the vessels

Post by David Parker » Wed Oct 02, 2019 2:21 pm

Hi Justin,

Rather than building you a custom SV installer I modified the Python script to work around several of the problems in the current SV Python API. I've attached the script here as a .txt file, change it to a .py file after downloading. You can find the document about how to use the script here https://github.com/ktbolt/cardiovascula ... o-path.pdf.

I don't develop on a Windows computer so I have not tested the script on Windows. What could possible go wrong? Plenty of course! A potential problem is that the script needs to write a file as a work around to the API. You need to set a directory (see documentation) that you have write permission to.

If this doesn't work then I'll figure out how to get you a custom installer.

Cheers,
Dave
Attachments
fit_cylinder_to_path.txt
(8.12 KiB) Downloaded 52 times

User avatar
Justin Tso
Posts: 25
Joined: Thu May 16, 2019 4:23 pm

Re: Fitting an implant in the vessels

Post by Justin Tso » Sun Oct 13, 2019 8:59 pm

Hi David,

When I try to click on the .txt file to download it, I get redirected to a page that says "The selected attachment does not exist anymore." Do you think you could reupload it?

User avatar
David Parker
Posts: 1719
Joined: Tue Aug 23, 2005 2:43 pm

Re: Fitting an implant in the vessels

Post by David Parker » Thu Oct 17, 2019 6:09 pm

Hi Justin,

Sorry for the late reply, I'm not getting email notifications from SimTK.

I've attached the file again.

Cheers,
Dave
Attachments
fit_cylinder_to_path.txt
(8.12 KiB) Downloaded 71 times

User avatar
Justin Tso
Posts: 25
Joined: Thu May 16, 2019 4:23 pm

Re: Fitting an implant in the vessels

Post by Justin Tso » Mon Oct 21, 2019 1:11 am

Hi David, it seems to work without a hitch! Thank you so much for your help, I really appreciate it. One last question: Is there a way to make sense of the units of the cylinder? I assume that right now, the radius is defined with respect to the coordinates of the control points. Is there any way to make a conversion from these units to a real unit (say cm or mm) without having to manually put a model in Paraview and measure it? This would enable me to control the dimensions of the cylinder much more easily. Again, thank you; you've been enormously helpful.

User avatar
David Parker
Posts: 1719
Joined: Tue Aug 23, 2005 2:43 pm

Re: Fitting an implant in the vessels

Post by David Parker » Mon Oct 21, 2019 9:04 am

Hi Justin,

Great news that things are working! The SV Python API can be very useful for performing operations not supported within SV. I am working on improving and documenting the API, hope to have that done in a couple of months.

The cylinder units are the same as the image units, which in SV are mm. In the attached image I segmented the vessel using circles with radius 1.0 and then fit a cylinder with the same radius.

Cheers,
Dave
Attachments
cyl-fit.png
cyl-fit.png (275.55 KiB) Viewed 1156 times

User avatar
Justin Tso
Posts: 25
Joined: Thu May 16, 2019 4:23 pm

Re: Fitting an implant in the vessels

Post by Justin Tso » Thu Oct 24, 2019 12:39 pm

Hi David, does scaling the image when adding the image to the project affect these coordinates? If it does, is there a way to recheck the scaling and accommodate for this? The radius for the cylinder that I'm entering seems much larger than it should be if it were in mm; also, in your example image, you define a cylinder with radius 1 on the descending aorta, but the radius of the descending aorta is probably bigger than 1 mm, and might be closer to 1 cm?

User avatar
David Parker
Posts: 1719
Joined: Tue Aug 23, 2005 2:43 pm

Re: Fitting an implant in the vessels

Post by David Parker » Thu Oct 24, 2019 8:10 pm

Hi Justin,

Image scaling does not affect the coordinates. The SV GUI (really MITK) shows units as mm but SV does not really have any default units, there are no units stored in any geometry files.

The example I showed was from the Demo Project which is not scaled correctly.

Cheers,
Dave

POST REPLY