Skip to content

Commit

Permalink
stricten the definition of block_valids
Browse files Browse the repository at this point in the history
  • Loading branch information
mikarubi committed Mar 20, 2024
1 parent d937750 commit 2c4d935
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion voluseg/_steps/step4.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def detect_cells(parameters):

# get number of voxels in each cell
n_blocks, block_valids, xyz0, xyz1 = \
define_blocks(lx, ly, lz, p.n_cells_block, n_voxels_cell, volume_mask)
define_blocks(lx, ly, lz, p.n_cells_block, n_voxels_cell, volume_mask, volume_peak)

# save number and indices of blocks
with h5py.File(fullname_volmean+hdf, 'r+') as file_handle:
Expand Down
6 changes: 4 additions & 2 deletions voluseg/_steps/step4a.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def define_blocks(lx, ly, lz, n_cells_block, n_voxels_cell, volume_mask):
def define_blocks(lx, ly, lz, n_cells_block, n_voxels_cell, volume_mask, volume_peak):
'''get coordinates of individual blocks'''

import os
Expand Down Expand Up @@ -54,6 +54,8 @@ def define_blocks(lx, ly, lz, n_cells_block, n_voxels_cell, volume_mask):
# get indices of masked blocks
block_valids = np.ones(n_blocks, dtype=bool)
for i in range(n_blocks):
block_valids[i] = np.any(volume_mask[x0[i]:x1[i], y0[i]:y1[i], z0[i]:z1[i]])
mask_i = volume_mask[x0[i]:x1[i], y0[i]:y1[i], z0[i]:z1[i]]
peak_i = volume_peak[x0[i]:x1[i], y0[i]:y1[i], z0[i]:z1[i]]
block_valids[i] = np.any(np.logical_and(mask_i, peak_i))

return n_blocks, block_valids, xyz0, xyz1

0 comments on commit 2c4d935

Please sign in to comment.