Skip to content

Commit

Permalink
ENH: Avoid moving the original sft when cutting invalid streamlines
Browse files Browse the repository at this point in the history
Avoid moving the original sft when cutting invalid streamlines: save the
original space/origin, and move the streamlines back to the original
space/origin.
  • Loading branch information
jhlegarreta committed Nov 2, 2021
1 parent 21a55e4 commit 6131be8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scilpy/utils/streamlines.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,11 @@ def cut_invalid_streamlines(sft):
"""
if not len(sft):
return sft, 0

# Keep track of the streamlines' original space/origin
space = sft.space
origin = sft.origin

sft.to_vox()
sft.to_corner()

Expand Down Expand Up @@ -675,4 +680,11 @@ def cut_invalid_streamlines(sft):
data_per_streamline=new_data_per_streamline,
data_per_point=new_data_per_point)

# Move the streamlines back to the original space/origin
sft.to_space(space)
sft.to_origin(origin)

new_sft.to_space(space)
new_sft.to_origin(origin)

return new_sft, cutting_counter

0 comments on commit 6131be8

Please sign in to comment.