Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creation of pointcloud cycles many times over the points #162

Closed
paskino opened this issue Nov 30, 2022 · 1 comment · Fixed by #163
Closed

Creation of pointcloud cycles many times over the points #162

paskino opened this issue Nov 30, 2022 · 1 comment · Fixed by #163
Milestone

Comments

@paskino
Copy link
Contributor

paskino commented Nov 30, 2022

Because these loops are in Python they are extremely slow, especially for large clouds

@paskino
Copy link
Contributor Author

paskino commented Dec 5, 2022

One such loop is

while n_b < max_b:
n_c = offset[1]
while n_c < max_c:
b = (n_b / max_b) * image_spacing[0] * image_dimensions[0] #- image_origin[0] #+ int(image_dimensions[0] * density[0] * .7)
c = (n_c / max_c) * image_spacing[1] * image_dimensions[1]# - image_origin[1] #+ int(image_dimensions[1] * density[1] * .7)
if self.GetOrientation() == 0: #YZ
vtkPointCloud.InsertNextPoint( a, b, c)
# print(c)
elif self.GetOrientation() == 1: #XZ
vtkPointCloud.InsertNextPoint( b, a, c)
# print(c)
elif self.GetOrientation() == 2: #XY
vtkPointCloud.InsertNextPoint( b, c, a)
# print(a)
n_c += 1
n_b += 1
self.UpdateProgress((n_c + max_b * n_b ) / tot)

which may benefit using https://docs.python.org/3/library/itertools.html#itertools.product

@paskino paskino added this to the v23.0.0 milestone Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant