Skip to content

Commit

Permalink
Update data_utils.py
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzLamm authored Jul 27, 2023
1 parent 638576b commit a5cece6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/membrain_seg/segmentation/dataloading/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ def load_tomogram(
"""
with mrcfile.open(filename, permissive=True) as tomogram:
data = tomogram.data.copy()
data = np.transpose(data, (2, 1, 0))
header = tomogram.header
if normalize_data:
data = img_as_float32(data)
Expand Down Expand Up @@ -273,6 +274,7 @@ def store_tomogram(
with mrcfile.new(filename, overwrite=True) as out_mrc:
if tomogram.dtype == bool:
tomogram = tomogram.astype("ubyte")
tomogram = np.transpose(tomogram, (2, 1, 0))
out_mrc.set_data(tomogram)
if header is not None:
attributes = header.dtype.names
Expand Down

0 comments on commit a5cece6

Please sign in to comment.