Skip to content

Commit

Permalink
#5 More uint8 > uint16 related changes
Browse files Browse the repository at this point in the history
  • Loading branch information
carljohnsen committed Apr 10, 2024
1 parent 101f049 commit c3cfb0c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/processing_steps/0900_generate_gauss_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ def gauss_kernel(sigma):

if verbose >= 1: print(f"Loading implant_solid mask from {hdf5_root}/masks/{scale}x/{sample}.h5")
with h5py.File(f"{hdf5_root}/masks/{scale}x/{sample}.h5","r") as f:
implant_mask = f['implant_solid/mask'][:]
implant_solid = f['implant_solid/mask']
nz,ny,nx = implant_solid.shape
implant_mask = implant_solid[:]

nz,ny,nx = implant_mask.shape
if verbose >= 1: print(f"Implant mask has shape {implant_mask.shape}")
if verbose >= 1: print(f"Implant mask has shape {(nz,ny,nx)}")

if verbose >= 2:
print(f"Writing PNGs of implant mask slices to {output_dir}")
Expand All @@ -79,9 +80,9 @@ def gauss_kernel(sigma):
# Dump the mask
masks_dir = f"{binary_root}/masks/{scale}x"
pathlib.Path(masks_dir).mkdir(parents=True, exist_ok=True)
input_path = f"{masks_dir}/{sample}-implant_solid.{np.dtype(result_type).name}"
output_path = f"{output_dir}/{sample}.{np.dtype(result_type).name}"
write_slice(implant_mask.astype(result_type), input_path, (0,0,0), implant_mask.shape)
input_path = f"{masks_dir}/{sample}-implant_solid.{np.dtype(np.uint8).name}"
output_path = f"{output_dir}/{sample}.{np.dtype(np.uint8).name}"
write_slice(implant_mask.astype(np.uint8), input_path, (0,0,0), implant_mask.shape)

gigabyte = 1024**3
gigabyte_internal = gigabyte / np.dtype(internal_type).itemsize
Expand Down

0 comments on commit c3cfb0c

Please sign in to comment.