diff --git a/invesalius/data/coordinates.py b/invesalius/data/coordinates.py index 68aa56fee..82f14cc10 100644 --- a/invesalius/data/coordinates.py +++ b/invesalius/data/coordinates.py @@ -621,7 +621,7 @@ def dynamic_reference(probe, reference): # a: rotation of plane (X, Y) around Z axis (azimuth) # b: rotation of plane (X', Z) around Y' axis (elevation) # a: rotation of plane (Y', Z') around X'' axis (roll) - m_rot = np.mat( + m_rot = np.asmatrix( [ [ cos(a) * cos(b), diff --git a/invesalius/data/imagedata_utils.py b/invesalius/data/imagedata_utils.py index 071706358..0a47e43e6 100644 --- a/invesalius/data/imagedata_utils.py +++ b/invesalius/data/imagedata_utils.py @@ -713,10 +713,10 @@ def create_spherical_grid(radius=10, subdivision=1): def random_sample_sphere(radius=3, size=100): - uvw = np.random.normal(0, 1, (size, 3)) + uvw = np.random.default_rng().normal(0, 1, (size, 3)) norm = np.linalg.norm(uvw, axis=1, keepdims=True) # Change/remove **(1./3) to make samples more concentrated around the center - r = np.random.uniform(0, 1, (size, 1)) ** 1.5 + r = np.random.default_rng().uniform(0, 1, (size, 1)) ** 1.5 scale = radius * np.divide(r, norm) xyz = scale * uvw return xyz diff --git a/invesalius/data/tractography.py b/invesalius/data/tractography.py index de97bea72..6bd2b88d3 100644 --- a/invesalius/data/tractography.py +++ b/invesalius/data/tractography.py @@ -467,7 +467,7 @@ def run(self): # Spherical sampling of seed coordinates --- # compute the samples of a sphere centered on seed coordinate offset by the grid # given in the invesalius-vtk space - samples = np.random.choice(coord_list_sphere.shape[1], size=100) + samples = np.random.default_rng().choice(coord_list_sphere.shape[1], size=100) m_seed[:-1, -1] = coord_offset.copy() # translate the spherical grid samples to the coil location in invesalius-vtk space seed_trk_r_inv = m_seed @ coord_list_sphere[:, samples] diff --git a/invesalius/data/transformations.py b/invesalius/data/transformations.py index b50ecb1ea..1c6604a44 100644 --- a/invesalius/data/transformations.py +++ b/invesalius/data/transformations.py @@ -1502,7 +1502,7 @@ def random_quaternion(rand=None): """ if rand is None: - rand = numpy.random.rand(3) + rand = numpy.random.default_rng().random(3) else: assert len(rand) == 3 r1 = numpy.sqrt(1.0 - rand[0]) @@ -1816,7 +1816,7 @@ def random_vector(size): False """ - return numpy.random.random(size) + return numpy.random.default_rng().random(size) def vector_product(v0, v1, axis=0): diff --git a/invesalius/gui/deep_learning_seg_dialog.py b/invesalius/gui/deep_learning_seg_dialog.py index c7f676cc0..179e64cac 100644 --- a/invesalius/gui/deep_learning_seg_dialog.py +++ b/invesalius/gui/deep_learning_seg_dialog.py @@ -363,7 +363,7 @@ def OnTickTimer(self, evt): return progress = self.ps.get_completion() - if progress == np.Inf: + if progress == np.inf: progress = 1 self.AfterSegment() progress = max(0, min(progress, 1)) diff --git a/invesalius/gui/dialogs.py b/invesalius/gui/dialogs.py index a4e44207f..b103441be 100644 --- a/invesalius/gui/dialogs.py +++ b/invesalius/gui/dialogs.py @@ -6731,7 +6731,7 @@ def LoadRegistration(self, evt: wx.CommandEvent) -> None: reader = csv.reader(file, delimiter="\t") content = [row for row in reader] - self.matrix_tracker_to_robot = np.vstack(list(np.float_(content))) + self.matrix_tracker_to_robot = np.vstack(list(np.float64(content))) # Send registration to robot. Publisher.sendMessage( diff --git a/invesalius/segmentation/deep_learning/segment.py b/invesalius/segmentation/deep_learning/segment.py index 2e296a37e..8df9e1304 100644 --- a/invesalius/segmentation/deep_learning/segment.py +++ b/invesalius/segmentation/deep_learning/segment.py @@ -92,7 +92,7 @@ def segment_keras(image, weights_file, overlap, probability_array, comm_array, p sums[iz:ez, iy:ey, ix:ex] += 1 probability_array /= sums - comm_array[0] = np.Inf + comm_array[0] = np.inf def download_callback(comm_array): @@ -131,7 +131,7 @@ def segment_torch( sums[iz:ez, iy:ey, ix:ex] += 1 probability_array /= sums - comm_array[0] = np.Inf + comm_array[0] = np.inf def segment_torch_jit( @@ -194,7 +194,7 @@ def segment_torch_jit( probability_array, output_shape=old_shape, preserve_range=True ) - comm_array[0] = np.Inf + comm_array[0] = np.inf ctx = multiprocessing.get_context("spawn")