File “D:\Python\lib\site-packages\IPython\core\interactiveshell.py”, line 3460, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File “”, line 1, in
imfusion.executeAlgorithm(‘Ultrasound;Cone Calibration’,[sweeps])
TypeError: sequence item 0: Unable to cast Python instance to C++ type (compile in debug mode for details)
Obviously, the passed parameter is not correct. But I dont know what kind of variable corresponds to std::vector< UltrasoundSweep * > in C++
The error message there is indeed cryptic. The error occurs because you are passing in a list that contains a list. You can either do (notice the missing brackets in the call of the algorithm:
Thanks a lot for your help. I got new error after adapting your suggestion. However, after learning more about the ImFusionSDK, I believe the error source is the passed UltrasoundSweep data. I construct them myself wrongly. I already found other relevant posts and will look into it.
Traceback (most recent call last):
File “D:\PythonProjects\US2PCD\main.py”, line 54, in
imfusion.executeAlgorithm(‘Ultrasound;Cone Calibration’, [sweep_gt,sweep_gt])
imfusion._bindings.IncompatibleError: No algorithm called ‘Ultrasound;Cone Calibration’ is compatible with the given data.
Could you please provide some help? Currently, I don’t have two sweeps taken with a “Cone Phantom” as described in the paper “PRO-TIP: Phantom for RObust automatic ultrasound calibration by TIP detection” (Ronchetti et al. 2022). We already order the phantom, and will have it soon. But I just want to make sure the code runs well before we have it. I checked the sweep variable, there is tracking matrix in it. I didn’t expect the above code return correct results because there are no tips in it. It should be at least ‘runable’. I couldn’t find Python documentation about this algorithm. Compared to the C++ SDK documentation, many things are missing in the Python version.
I also tried to generate a UlrasoundSweep myself by providing ‘png’ images and a trackingStream. But still failed.