Vmtkcenterlines -seedselector pointlist problem

Hello, Luca, Everyone,
vmtkcenterlines.py -ifile “Case1.vtk” -seedselector pointlist -sourcepoints 0.00571137 -0.01748690 -0.02422070 -targetpoints 0.00571797 -0.00042939 -0.02172360
But what I get is this:
Traceback (most recent call last):
File “C:\ProgramData\VMTK\lib\site-packages\vmtk\pypeserver.py”, line 46, in RunPypeProcess
pipe.Execute()
File “C:\ProgramData\VMTK\lib\site-packages\vmtk\pype.py”, line 324, in Execute
scriptObject.Execute()
File “C:\ProgramData\VMTK\lib\site-packages\vmtk\vmtkcenterlines.py”, line 595, in Execute
self.SeedSelector.Execute()
File “C:\ProgramData\VMTK\lib\site-packages\vmtk\vmtkcenterlines.py”, line 128, in Execute
for i in range(len(self.SourcePoints)/3):
TypeError: ‘float’ object cannot be interpreted as an integer
ANY IDEAS?
Thanks
Haim

Hi @Haim_Ezer,
you bumped into an issue related to the Python 3 port.

for i in range(len(self.SourcePoints)/3):

should instead be

for i in range(len(self.SourcePoints)//3):

Bottomline: in Python 2 division of an integer by an integer yields an integer, while the result of / between two numbers in Python 3 yields a float irrespective of the type of the operands. For that you need integer division //, which returns an integer irrespective of the type of the operands.

Anyhow, the change is came right after the last release (one more good reason to organize a new release). To patch it in the meantime, you can open your C:\ProgramData\VMTK\lib\site-packages\vmtk\vmtkcenterlines.py file with an editor and fix lines 128 and 133 by replacing /3 with //3.

This should solve it in the meantime.

Luca

Thx Luca,
This solved my problem!

Just wanted to share an observation:
It turns that when I scale may surface, the results are amazing!
I use vmtksurfacescaling - scale 5, and this solves most of the unexpected
problems.

Thanks again,
Haim