Skip to content

Commit

Permalink
removed hard coded voxel size of mrc output
Browse files Browse the repository at this point in the history
  • Loading branch information
milesagraham committed May 20, 2024
1 parent 460d007 commit a99a172
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/ttmask/cuboid.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def cuboid(
boxsize: int = typer.Option(...),
cuboid_sidelengths: Annotated[Tuple[float, float, float], typer.Option()] = (None, None, None),
soft_edge_size: float = typer.Option(...),
mrc_voxel_size: float = typer.Option(...),
):
c = boxsize // 2
center = np.array([c, c, c])
Expand Down Expand Up @@ -47,4 +48,4 @@ def cuboid(

mask[boundary_pixels] = (0.5 * np.cos(normalised_distance_from_edge) + 0.5)

mrcfile.write("cuboid.mrc", mask, voxel_size=4, overwrite=True)
mrcfile.write("cuboid.mrc", mask, voxel_size= mrc_voxel_size, overwrite=True)
4 changes: 3 additions & 1 deletion src/ttmask/cylinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def cylinder(
cylinder_outer_diameter: float = typer.Option(...),
cylinder_inner_diameter: float = typer.Option(0),
soft_edge_size: int = typer.Option(...),
mrc_voxel_size: float = typer.Option(...),
):
cylinder_outer_radius = cylinder_outer_diameter / 2
cylinder_inner_radius = cylinder_inner_diameter / 2
Expand Down Expand Up @@ -43,4 +44,5 @@ def cylinder(

mask[boundary_pixels] = (0.5 * np.cos(normalised_distance_from_edge) + 0.5)

mrcfile.write("cylinder.mrc", mask, voxel_size=4, overwrite=True)
mrcfile.write("cylinder.mrc", mask, voxel_size= mrc_voxel_size, overwrite=True)

3 changes: 2 additions & 1 deletion src/ttmask/sphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def sphere(
boxsize: int = typer.Option(...),
sphere_diameter: float = typer.Option(...),
soft_edge_size: int = typer.Option(...),
mrc_voxel_size: float = typer.Option(...),
):
sphere_radius = sphere_diameter / 2
c = boxsize // 2
Expand Down Expand Up @@ -38,4 +39,4 @@ def sphere(

mask[boundary_pixels] = (0.5 * np.cos(normalised_distance_from_edge) + 0.5)

mrcfile.write("sphere.mrc", mask, voxel_size=4, overwrite=True)
mrcfile.write("sphere.mrc", mask, voxel_size= mrc_voxel_size, overwrite=True)

0 comments on commit a99a172

Please sign in to comment.