Skip to content

Commit

Permalink
Fix issue where, when running 2d feature extraction with node analysi…
Browse files Browse the repository at this point in the history
…s, problems arise when trying to calculate min/max of velocity aggregate stats from voxels in the node
  • Loading branch information
aelefebv committed Oct 31, 2024
1 parent a1df7a1 commit c57b0e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions nellie/feature_extraction/hierarchical.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,9 @@ def aggregate_stats_for_class(child_class, t, list_of_idxs):

# populate the idxs_array with the values from the stat_array at the indices in idxs_array
stat_values = stat_array[idxs_array.astype(int)]
# if the shape has a second dimension of length 0, reshape it to have a second dimension of length 1, where all values are nan
if stat_values.shape[1] == 0:
stat_values = np.full((stat_values.shape[0], 1), np.nan)

# calculate various statistics for the subset
mean = np.nanmean(stat_values, axis=1)
Expand Down
5 changes: 3 additions & 2 deletions nellie/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def run(file_info, remove_edges=False, otsu_thresh_intensity=False, threshold=No
vox_reassign = VoxelReassigner(im_info)
vox_reassign.run()

hierarchy = Hierarchy(im_info)
hierarchy = Hierarchy(im_info, skip_nodes=False)
hierarchy.run()

return im_info
Expand Down Expand Up @@ -63,7 +63,8 @@ def run(file_info, remove_edges=False, otsu_thresh_intensity=False, threshold=No
# continue
# im_info = run(tif_file, remove_edges=False, ch=ch, num_t=num_t)

test_file = '/Users/austin/test_files/nellie_all_tests/yeast_3d_mitochondria.ome.tif'
# test_file = '/Users/austin/test_files/nellie_all_tests/yeast_3d_mitochondria.ome.tif'
test_file = '/Users/austin/Downloads/26598942-Pos213-t_008-y_1744-x_0329.ome.tif'
# test_file = all_paths[1]
file_info = FileInfo(test_file)
file_info.find_metadata()
Expand Down

0 comments on commit c57b0e1

Please sign in to comment.