From d6a9b3a9ff8db638824e1d9c2fc41cb7b859e715 Mon Sep 17 00:00:00 2001
From: polarbean <harry.carey95@gmail.com>
Date: Mon, 17 Feb 2025 16:48:58 +0100
Subject: [PATCH] update to use 64 bit floats

---
 PyNutil/processing/visualign_deformations.py | 11 ++++++-----
 workflows/basic_example_custom_atlas.py      |  6 +++---
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/PyNutil/processing/visualign_deformations.py b/PyNutil/processing/visualign_deformations.py
index 3cb6317..7d504f8 100644
--- a/PyNutil/processing/visualign_deformations.py
+++ b/PyNutil/processing/visualign_deformations.py
@@ -4,13 +4,14 @@ import numpy as np
 
 
 def triangulate(w, h, markers):
+
     vertices = [
         [-0.1 * w, -0.1 * h, -0.1 * w, -0.1 * h],
         [1.1 * w, -0.1 * h, 1.1 * w, -0.1 * h],
         [-0.1 * w, 1.1 * h, -0.1 * w, 1.1 * h],
         [1.1 * w, 1.1 * h, 1.1 * w, 1.1 * h],
     ]
-
+    
     edges = [0] * ((len(markers) + 4) * (len(markers) + 4 - 1) // 2)
     triangles = [Triangle(0, 1, 2, vertices, edges), Triangle(1, 2, 3, vertices, edges)]
     edges[0] = edges[1] = edges[4] = edges[5] = 2
@@ -59,8 +60,8 @@ def transform(triangulation, x, y):
 
 
 def transform_vec(triangulation, x, y):
-    xPrime = np.zeros(x.shape, float)
-    yPrime = np.zeros(y.shape, float)
+    xPrime = np.zeros(x.shape, np.float64)
+    yPrime = np.zeros(y.shape, np.float64)
     for triangle in triangulation:
         triangle.intriangle_vec(x, y, xPrime, yPrime)
     return (xPrime, yPrime)
@@ -82,8 +83,8 @@ def forwardtransform(triangulation, x, y):
 
 # xy: 2-dimensional array with one xy-pair per row
 def forwardtransform_vec(triangulation, x, y):
-    xPrime = np.zeros(x.shape, float)
-    yPrime = np.zeros(y.shape, float)
+    xPrime = np.zeros(x.shape, np.float64)
+    yPrime = np.zeros(y.shape, np.float64)
     for triangle in triangulation:
         triangle.inforward_vec(x, y, xPrime, yPrime)
     return (xPrime, yPrime)
diff --git a/workflows/basic_example_custom_atlas.py b/workflows/basic_example_custom_atlas.py
index da3cd80..78bdf97 100644
--- a/workflows/basic_example_custom_atlas.py
+++ b/workflows/basic_example_custom_atlas.py
@@ -15,12 +15,12 @@ from PyNutil import PyNutil
 ### get_coordinates, if use_flat=True, place flat files in folder titled "flat_files" at same level as "segmentations" folder 
 
 pnt = PyNutil(
-    segmentation_folder="../tests/test_data/nonlinear_allen_mouse/",
-    alignment_json="../tests/test_data/nonlinear_allen_mouse/alignment.json",
+    segmentation_folder="../tests/test_data/linear_allen_mouse/",
+    alignment_json="../tests/test_data/linear_allen_mouse/alignment_linear.json",
     colour=[0, 0, 0],
     atlas_path="../tests/test_data/allen_mouse_2017_atlas/annotation_25_reoriented_2017.nrrd",
     label_path="../tests/test_data/allen_mouse_2017_atlas//allen2017_colours.csv",
 )
 pnt.get_coordinates(object_cutoff=0, use_flat=False)
 pnt.quantify_coordinates()
-pnt.save_analysis("../test_result/test_nonlinear_allen_mouse")
+pnt.save_analysis("../test_result/test_linear_allen_mouse")
-- 
GitLab