Skip to content

Commit

Permalink
BUG: Ensure NumPy point set arrays are contiguous
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Jun 1, 2020
1 parent cf486f1 commit bfd319f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions itkwidgets/_transform_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ def _numpy_array_to_point_set(point_set_like):
point_values = np.asarray(point_set_like).astype(np.float32)
if len(
point_values.shape) > 1 and point_values.shape[1] == 2 or point_values.shape[1] == 3:
if not point_values.flags['CONTIGUOUS']:
point_values = np.ascontiguousarray(point_values)
if point_values.shape[1] == 2:
point_values = np.hstack(
(point_values, -5.0e-6 * np.ones((point_values.shape[0], 1)))).astype(np.float32)
Expand Down

0 comments on commit bfd319f

Please sign in to comment.