Page 1 of 1
Fitting an implant in the vessels
Posted: Sat Sep 28, 2019 4:49 pm
by justintso1199
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?
Re: Fitting an implant in the vessels
Posted: Mon Sep 30, 2019 3:38 pm
by davep
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
Re: Fitting an implant in the vessels
Posted: Mon Sep 30, 2019 9:24 pm
by justintso1199
Hi David, thank you for your help. I'm using Windows 10 64-bit.
Re: Fitting an implant in the vessels
Posted: Wed Oct 02, 2019 2:21 pm
by davep
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
Re: Fitting an implant in the vessels
Posted: Sun Oct 13, 2019 8:59 pm
by justintso1199
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?
Re: Fitting an implant in the vessels
Posted: Thu Oct 17, 2019 6:09 pm
by davep
Hi Justin,
Sorry for the late reply, I'm not getting email notifications from SimTK.
I've attached the file again.
Cheers,
Dave
Re: Fitting an implant in the vessels
Posted: Mon Oct 21, 2019 1:11 am
by justintso1199
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.
Re: Fitting an implant in the vessels
Posted: Mon Oct 21, 2019 9:04 am
by davep
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
Re: Fitting an implant in the vessels
Posted: Thu Oct 24, 2019 12:39 pm
by justintso1199
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?
Re: Fitting an implant in the vessels
Posted: Thu Oct 24, 2019 8:10 pm
by davep
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