diff --git a/.gitignore b/.gitignore index eff9447..590fa7d 100644 --- a/.gitignore +++ b/.gitignore @@ -106,4 +106,7 @@ venv.bak/ /site # mypy -.mypy_cache/ \ No newline at end of file +.mypy_cache/ + +# vscode +.vscode \ No newline at end of file diff --git a/conda/meta.yaml b/conda/meta.yaml index e00e612..3e6b70a 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -1,6 +1,6 @@ package: name: openalea.phenomenal - version: "1.9.2" + version: "1.9.3" source: path: .. @@ -10,12 +10,12 @@ build: preserve_egg_dir: True string: phenomenal script: - - {{PYTHON}} setup.py build_ext -j{{ CPU_COUNT }} - {{ PYTHON }} -m pip install . -vv requirements: host: - python + - setuptools - numpy - scipy - cython diff --git a/src/openalea/phenomenal/calibration/transformations.py b/src/openalea/phenomenal/calibration/transformations.py index 10f14ab..93ee850 100644 --- a/src/openalea/phenomenal/calibration/transformations.py +++ b/src/openalea/phenomenal/calibration/transformations.py @@ -338,7 +338,7 @@ def rotation_matrix(angle, direction, point=None): M[:3, :3] = R if point is not None: # rotation not around origin - point = numpy.array(point[:3], dtype=numpy.float64, copy=False) + point = numpy.array(point[:3], dtype=numpy.float64) M[:3, 3] = point - numpy.dot(R, point) return M @@ -356,7 +356,7 @@ def rotation_from_matrix(matrix): True """ - R = numpy.array(matrix, dtype=numpy.float64, copy=False) + R = numpy.array(matrix, dtype=numpy.float64) R33 = R[:3, :3] # direction: unit eigenvector of R33 corresponding to eigenvalue of 1 w, W = numpy.linalg.eig(R33.T) @@ -491,12 +491,11 @@ def projection_matrix(point, normal, direction=None, """ M = numpy.identity(4) - point = numpy.array(point[:3], dtype=numpy.float64, copy=False) + point = numpy.array(point[:3], dtype=numpy.float64) normal = unit_vector(normal[:3]) if perspective is not None: # perspective projection - perspective = numpy.array(perspective[:3], dtype=numpy.float64, - copy=False) + perspective = numpy.array(perspective[:3], dtype=numpy.float64) M[0, 0] = M[1, 1] = M[2, 2] = numpy.dot(perspective-point, normal) M[:3, :3] -= numpy.outer(perspective, normal) if pseudo: @@ -509,7 +508,7 @@ def projection_matrix(point, normal, direction=None, M[3, 3] = numpy.dot(perspective, normal) elif direction is not None: # parallel projection - direction = numpy.array(direction[:3], dtype=numpy.float64, copy=False) + direction = numpy.array(direction[:3], dtype=numpy.float64) scale = numpy.dot(direction, normal) M[:3, :3] -= numpy.outer(direction, normal) / scale M[:3, 3] = direction * (numpy.dot(point, normal) / scale) @@ -552,7 +551,7 @@ def projection_from_matrix(matrix, pseudo=False): True """ - M = numpy.array(matrix, dtype=numpy.float64, copy=False) + M = numpy.array(matrix, dtype=numpy.float64) M33 = M[:3, :3] w, V = numpy.linalg.eig(M) i = numpy.where(abs(numpy.real(w) - 1.0) < 1e-8)[0] diff --git a/src/openalea/phenomenal/mesh/algorithms.py b/src/openalea/phenomenal/mesh/algorithms.py index 38639f5..f85872c 100644 --- a/src/openalea/phenomenal/mesh/algorithms.py +++ b/src/openalea/phenomenal/mesh/algorithms.py @@ -10,7 +10,7 @@ from __future__ import division, print_function, absolute_import import vtk -import vtk.util.numpy_support +import vtkmodules.util.numpy_support import numpy import math import skimage.measure diff --git a/src/openalea/phenomenal/mesh/formats.py b/src/openalea/phenomenal/mesh/formats.py index c4ae52b..1607ed0 100644 --- a/src/openalea/phenomenal/mesh/formats.py +++ b/src/openalea/phenomenal/mesh/formats.py @@ -10,7 +10,8 @@ from __future__ import division, print_function, absolute_import import vtk -import vtk.util.numpy_support +import vtkmodules.util.numpy_support +import vtkmodules from .vtk_transformation import (from_vertices_faces_to_vtk_poly_data) # ============================================================================== @@ -47,17 +48,17 @@ def read_ply_to_vertices_faces(filename): vtk_poly_data = ply_reader.GetOutput() - vertices = vtk.util.numpy_support.vtk_to_numpy( + vertices = vtkmodules.util.numpy_support.vtk_to_numpy( vtk_poly_data.GetPoints().GetData()) - faces = vtk.util.numpy_support.vtk_to_numpy( + faces = vtkmodules.util.numpy_support.vtk_to_numpy( vtk_poly_data.GetPolys().GetData()) faces = faces.reshape((len(faces) // 4, 4)) colors = vtk_poly_data.GetPointData().GetScalars() if colors is not None: - colors = vtk.util.numpy_support.vtk_to_numpy(colors) + colors = vtkmodules.util.numpy_support.vtk_to_numpy(colors) return vertices, faces[:, 1:], colors diff --git a/src/openalea/phenomenal/mesh/vtk_transformation.py b/src/openalea/phenomenal/mesh/vtk_transformation.py index 5ee9a1b..b2ac3df 100644 --- a/src/openalea/phenomenal/mesh/vtk_transformation.py +++ b/src/openalea/phenomenal/mesh/vtk_transformation.py @@ -10,7 +10,7 @@ from __future__ import division, print_function, absolute_import import vtk -import vtk.util.numpy_support +import vtkmodules.util.numpy_support import operator # ============================================================================== @@ -105,10 +105,10 @@ def make_vtk_id_list(it): def from_vtk_poly_data_to_vertices_faces(vtk_poly_data): - vertices = vtk.util.numpy_support.vtk_to_numpy( + vertices = vtkmodules.util.numpy_support.vtk_to_numpy( vtk_poly_data.GetPoints().GetData()) - faces = vtk.util.numpy_support.vtk_to_numpy( + faces = vtkmodules.util.numpy_support.vtk_to_numpy( vtk_poly_data.GetPolys().GetData()) faces = faces.reshape((len(faces) // 4, 4)) @@ -126,12 +126,12 @@ def from_numpy_matrix_to_vtk_image_data(data_matrix): image_data.SetSpacing(1.0, 1.0, 1.0) if vtk.VTK_MAJOR_VERSION < 6: - image_data.SetScalarType(vtk.util.numpy_support.get_vtk_array_type( + image_data.SetScalarType(vtkmodules.util.numpy_support.get_vtk_array_type( data_matrix.dtype)) image_data.SetNumberOfScalarComponents(1) image_data.AllocateScalars() else: - image_data.AllocateScalars(vtk.util.numpy_support.get_vtk_array_type( + image_data.AllocateScalars(vtkmodules.util.numpy_support.get_vtk_array_type( data_matrix.dtype), 1) lx, ly, lz = image_data.GetDimensions() diff --git a/src/openalea/phenomenal/segmentation/maize_stem_detection.py b/src/openalea/phenomenal/segmentation/maize_stem_detection.py index e2e10fb..3efb44b 100644 --- a/src/openalea/phenomenal/segmentation/maize_stem_detection.py +++ b/src/openalea/phenomenal/segmentation/maize_stem_detection.py @@ -109,7 +109,7 @@ def stem_detection(stem_segment_voxel, stem_segment_path, voxels_size, window_length = max(4, len(nodes_length) // 8) window_length = window_length + 1 if window_length % 2 == 0 else window_length smooth_distances = scipy.signal.savgol_filter( - numpy.array(distances, dtype=numpy.uint8), + numpy.array(distances, dtype=numpy.uint16), window_length=window_length, polyorder=2) diff --git a/src/openalea/phenomenal/tracking/alignment.py b/src/openalea/phenomenal/tracking/alignment.py index 7a95132..7b73751 100644 --- a/src/openalea/phenomenal/tracking/alignment.py +++ b/src/openalea/phenomenal/tracking/alignment.py @@ -181,9 +181,9 @@ def insert_gaps(all_sequences, seq_indexes, alignment): for gi in gap_indexes: if all_sequences2[si].size == 0: - all_sequences2[si] = np.full((1, vec_len), np.NAN) + all_sequences2[si] = np.full((1, vec_len), np.nan) else: - all_sequences2[si] = np.insert(all_sequences2[si], gi, np.NAN, 0) + all_sequences2[si] = np.insert(all_sequences2[si], gi, np.nan, 0) return all_sequences2 diff --git a/src/openalea/phenomenal/version.py b/src/openalea/phenomenal/version.py index 0d6cea4..1ecc42d 100644 --- a/src/openalea/phenomenal/version.py +++ b/src/openalea/phenomenal/version.py @@ -3,7 +3,7 @@ major = 1 minor = 9 -post = 2 +post = 3 __version__ = ".".join([str(s) for s in (major, minor, post)]) # }}