Skip to content

Commit

Permalink
Merge pull request #76 from MPI-Dortmund/fix-selected-slices-tomo
Browse files Browse the repository at this point in the history
fix issue that the ticked checkboxes of tomo slices are ignored
  • Loading branch information
thorstenwagner authored Oct 29, 2024
2 parents 41ad867 + 375d18a commit 9e0df6b
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/box_manager/io/io_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,22 +527,35 @@ def _write_particle_data(
orignal_filename=filename, output_path=path, suffix=suffix
)
empty_slices = []

# Generating mask
mask = np.ones(len(coordinates), dtype=bool)
for z in meta["metadata"]:
if not isinstance(z, int):
continue
if meta["metadata"][z]["write"] is False:
mask[coordinates[:, 0] == z] = False

slices_with_coords = np.unique(coordinates[:, 0]).tolist()
for z in meta["metadata"]:
print('z',z)
if isinstance(z,int):
print(meta["metadata"][z]["write"] )
if (
not isinstance(z, int)
or meta["metadata"][z]["write"] is not True
):
continue
if z in slices_with_coords:

if z in slices_with_coords and meta["metadata"][z]["write"] is not False:
continue
empty_slices.append(z)
if not is_3d:
coordinates = coordinates[:,1:]

print(empty_slices)
export_data[output_file] = (
format_func(
coordinates=coordinates,
coordinates=coordinates[mask],
box_size=boxsize,
features=features,
metadata=meta["metadata"],
Expand Down

0 comments on commit 9e0df6b

Please sign in to comment.