From f6343ca948f9d9697cb414ec779ab00361ca0ca6 Mon Sep 17 00:00:00 2001 From: polarbean <harry.carey95@gmail.com> Date: Fri, 26 May 2023 22:24:48 +0200 Subject: [PATCH] removed superflous print statements --- PyNutil/coordinate_extraction.py | 12 +++--------- PyNutil/counting_and_load.py | 16 ++++++++-------- PyNutil/generate_target_slice.py | 1 - PyNutil/main.py | 1 - 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/PyNutil/coordinate_extraction.py b/PyNutil/coordinate_extraction.py index a2a4d8d..5df3143 100644 --- a/PyNutil/coordinate_extraction.py +++ b/PyNutil/coordinate_extraction.py @@ -138,14 +138,7 @@ def folder_to_atlas_space( points_len = [len(points) for points in points_list] centroids_len = [len(centroids) for centroids in centroids_list] points = np.concatenate(points_list) - print("points shape: ",points.shape) centroids = np.concatenate(centroids_list) - print("centroids shape: ",centroids.shape) - print("Number of points: ", len(points)) - print("Number of centroids: ", len(centroids)) - print("points_len: ", points_len) - print("points: ", points) - print("points first: ", points[0]) return ( np.array(points), @@ -195,7 +188,6 @@ def segmentation_to_atlas_space( ) if method in ["per_pixel", "all"]: scaled_y, scaled_x = get_scaled_pixels(segmentation, pixel_id, y_scale, x_scale) - print(f"{segmentation_path} \nNumber of objects: {len(scaled_centroidsY)}\nNumber of pixels: {len(scaled_y)}") if non_linear: if "markers" in slice: @@ -229,7 +221,9 @@ def segmentation_to_atlas_space( centroids = transform_to_atlas_space( slice["anchoring"], centroids_new_y, centroids_new_x, reg_height, reg_width ) - print(f"Finished and points len is: {len(points)} and centroids len is: {len(centroids)}") + print( + f"Finished and points len is: {len(points)} and centroids len is: {len(centroids)}" + ) points_list[index] = np.array(points) centroids_list[index] = np.array(centroids) diff --git a/PyNutil/counting_and_load.py b/PyNutil/counting_and_load.py index 1d2dfdd..2c7b46e 100644 --- a/PyNutil/counting_and_load.py +++ b/PyNutil/counting_and_load.py @@ -17,23 +17,23 @@ def label_points(points, label_volume, scale_factor=1): x = points[:, 0] y = points[:, 1] z = points[:, 2] - print(x[0], y[0], z[0]) - #make sure the points are within the volume + # make sure the points are within the volume x[x < 0] = 0 y[y < 0] = 0 z[z < 0] = 0 - mask = (x > label_volume.shape[0] - 1) | (y > label_volume.shape[1] - 1) | (z > label_volume.shape[2] - 1) + mask = ( + (x > label_volume.shape[0] - 1) + | (y > label_volume.shape[1] - 1) + | (z > label_volume.shape[2] - 1) + ) x[mask] = 0 y[mask] = 0 z[mask] = 0 - print('total mask: ') - print(np.sum(mask)) + # Get the label value for each point - print(x[0], y[0], z[0]) labels = label_volume[x, y, z] - print('label sum: ') - print(np.sum(labels)) + return labels diff --git a/PyNutil/generate_target_slice.py b/PyNutil/generate_target_slice.py index 2968338..074fcca 100644 --- a/PyNutil/generate_target_slice.py +++ b/PyNutil/generate_target_slice.py @@ -7,7 +7,6 @@ def generate_target_slice(alignment, volume): bounds = [455, 527, 319] X_size = np.sqrt(np.sum(np.square((Ux, Uy, Uz)))) Z_size = np.sqrt(np.sum(np.square((Vx, Vy, Vz)))) - print(X_size, Z_size) X_size = np.round(X_size).astype(int) Z_size = np.round(Z_size).astype(int) # make this into a grid (0,0) to (320,456) diff --git a/PyNutil/main.py b/PyNutil/main.py index c65c8a8..b494488 100644 --- a/PyNutil/main.py +++ b/PyNutil/main.py @@ -272,7 +272,6 @@ class PyNutil: self.segmentation_filenames, self.per_section_df, ): - split_fn = fn.split("/")[-1].split(".")[0] df.to_csv( f"{output_folder}/per_section_reports/{split_fn}.csv", -- GitLab