Skip to content

Commit

Permalink
update visualization script
Browse files Browse the repository at this point in the history
  • Loading branch information
talonchandler committed Sep 9, 2024
1 parent 0fa4bbe commit 63dd98c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions examples/models/inplane_oriented_thick_pol3d_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Parameters
# all lengths must use consistent units e.g. um
oversample_factor = 2
zyx_shape = (100, 256, 256)
zyx_shape = (50, 128, 128) # (100, 256, 256)
swing = 0.1
scheme = "5-State"
yx_pixel_size = 0.325 / oversample_factor # 0.325
Expand All @@ -26,7 +26,7 @@
)

# Calculate transfer function
sfZYX_transfer_function, intensity_to_stokes_matrix = (
singular_system, sfZYX_transfer_function, intensity_to_stokes_matrix = (
inplane_oriented_thick_pol3d_vector.calculate_transfer_function(
swing,
scheme,
Expand All @@ -49,7 +49,7 @@
zyx_scale=(z_pixel_size, yx_pixel_size, yx_pixel_size),
)

# input("Showing transfer functions. Press <enter> to continue...")
input("Showing transfer functions. Press <enter> to continue...")
viewer.layers.select_all()
viewer.layers.remove_selected()

Expand All @@ -64,7 +64,7 @@
fzyx_object_recon = (
inplane_oriented_thick_pol3d_vector.apply_inverse_transfer_function(
szyx_data,
sfZYX_transfer_function,
singular_system,
intensity_to_stokes_matrix,
regularization_strength=1e-1,
)
Expand Down
7 changes: 4 additions & 3 deletions waveorder/models/inplane_oriented_thick_pol3d_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,16 @@ def calculate_transfer_function(

# transfer function
return (
singular_system,
singular_system, # (3 stokes, 3 object, Z, Y, X)
sfZYX_transfer_function,
intensity_to_stokes_matrix,
) # (3 stokes, 3 object, Z, Y, X)

)

def visualize_transfer_function(viewer, sfZYX_transfer_function, zyx_scale):
shift_dims = (-3, -2, -1)
lim = torch.max(torch.abs(sfZYX_transfer_function)) * 0.9


viewer.add_image(
torch.fft.ifftshift(
torch.real(sfZYX_transfer_function), dim=shift_dims
Expand Down

0 comments on commit 63dd98c

Please sign in to comment.