@@ -45,7 +45,6 @@ def get_centroids_and_area(segmentation, pixel_cut_off=0):
45
45
return centroids , area , coords
46
46
47
47
48
-
49
48
def create_threads (
50
49
segmentations ,
51
50
slices ,
@@ -144,8 +143,8 @@ def folder_to_atlas_space(
144
143
slices = load_visualign_json (quint_alignment )
145
144
segmentations = get_segmentations (folder )
146
145
flat_files , flat_file_nrs = get_flat_files (folder , use_flat )
147
- points_list , centroids_list , region_areas_list , centroids_labels , points_labels = initialize_lists (
148
- len (segmentations )
146
+ points_list , centroids_list , region_areas_list , centroids_labels , points_labels = (
147
+ initialize_lists ( len (segmentations ) )
149
148
)
150
149
threads = create_threads (
151
150
segmentations ,
@@ -165,8 +164,8 @@ def folder_to_atlas_space(
165
164
use_flat ,
166
165
)
167
166
start_and_join_threads (threads )
168
- points , centroids , points_labels , centroids_labels , points_len , centroids_len = process_results (
169
- points_list , centroids_list , points_labels , centroids_labels
167
+ points , centroids , points_labels , centroids_labels , points_len , centroids_len = (
168
+ process_results ( points_list , centroids_list , points_labels , centroids_labels )
170
169
)
171
170
return (
172
171
points ,
@@ -180,9 +179,6 @@ def folder_to_atlas_space(
180
179
)
181
180
182
181
183
-
184
-
185
-
186
182
def initialize_lists (length ):
187
183
"""
188
184
Initializes lists for storing points, centroids, and region areas.
@@ -195,8 +191,8 @@ def initialize_lists(length):
195
191
"""
196
192
points_list = [np .array ([])] * length
197
193
centroids_list = [np .array ([])] * length
198
- centroids_labels = [np .array ([])] * length
199
- points_labels = [np .array ([])] * length
194
+ centroids_labels = [np .array ([])] * length
195
+ points_labels = [np .array ([])] * length
200
196
201
197
region_areas_list = [
202
198
pd .DataFrame (
@@ -213,7 +209,13 @@ def initialize_lists(length):
213
209
}
214
210
)
215
211
] * length
216
- return points_list , centroids_list , region_areas_list , centroids_labels , points_labels
212
+ return (
213
+ points_list ,
214
+ centroids_list ,
215
+ region_areas_list ,
216
+ centroids_labels ,
217
+ points_labels ,
218
+ )
217
219
218
220
219
221
def create_threads (
@@ -427,11 +429,16 @@ def segmentation_to_atlas_space(
427
429
)
428
430
scaled_y , scaled_x = get_scaled_pixels (segmentation , pixel_id , y_scale , x_scale )
429
431
if scaled_x is not None :
430
- per_point_labels = atlas_map [np .round (scaled_x ).astype (int ), np .round (scaled_y ).astype (int )]
432
+ per_point_labels = atlas_map [
433
+ np .round (scaled_x ).astype (int ), np .round (scaled_y ).astype (int )
434
+ ]
431
435
else :
432
436
per_point_labels = np .array ([])
433
437
if scaled_centroidsX is not None :
434
- per_centroid_labels = atlas_map [np .round (scaled_centroidsX ).astype (int ), np .round (scaled_centroidsY ).astype (int )]
438
+ per_centroid_labels = atlas_map [
439
+ np .round (scaled_centroidsX ).astype (int ),
440
+ np .round (scaled_centroidsY ).astype (int ),
441
+ ]
435
442
else :
436
443
per_centroid_labels = np .array ([])
437
444
@@ -458,9 +465,12 @@ def segmentation_to_atlas_space(
458
465
points_list [index ] = np .array (points if points is not None else [])
459
466
centroids_list [index ] = np .array (centroids if centroids is not None else [])
460
467
region_areas_list [index ] = region_areas
461
- centroids_labels [index ] = np .array (per_centroid_labels if centroids is not None else [])
468
+ centroids_labels [index ] = np .array (
469
+ per_centroid_labels if centroids is not None else []
470
+ )
462
471
points_labels [index ] = np .array (per_point_labels if points is not None else [])
463
472
473
+
464
474
def get_triangulation (slice_dict , reg_width , reg_height , non_linear ):
465
475
"""
466
476
Gets the triangulation for the slice.
0 commit comments