Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions examples/article_figures/figS_NPC_quantification.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
probe_template = "GFP_w_nanobody"
probe_target_type = "Sequence"
probe_target_value = "ELAVGSL" # Sequence in the C-terminal of Nup96
modalities = ["STED_Thev2016", ]
modalities = ["STED", ]

# fetch experimental image from URL
STED_example = "https://ftp.ebi.ac.uk/biostudies/fire/S-BIAD/S-BIAD0-99/S-BIAD8/Files/Library/Gallery%20Fig%201/STED/GFP_Gallery-STED_181026_1.tif"
Expand All @@ -36,7 +36,6 @@
probe_target_type=probe_target_type,
probe_target_value=probe_target_value,
multimodal=modalities,
STED_Thev2016={"exp_time": 0.0002},
clear_experiment=True,
run_simulation=False,
random_seed=random_seed
Expand Down Expand Up @@ -66,7 +65,19 @@
min_distance=min_distance)

# Run simulation
experiment.set_modality_acq(modality_name="STED_Thev2016", exp_time=0.0002)
## Modality parameter of pixelsize_nm is set to match Thevathasan et al. 2019.
## All other parameters are estimations to emulate Thevathasan et al. 2019 STED modality
experiment.update_modality(
modality_name="STED",
lateral_resolution_nm=15,
axial_resolution_nm=20,
psf_voxel_nm=5,
depth_of_field_nm=100,
pixelsize_nm=15)
experiment.set_modality_acq(
modality_name="STED",
exp_time=0.0002)
experiment.imager.modalities["STED"]["detector"]["noise_model"]["binomial"]["p"] = 0.7
images, noiselsess = experiment.run_simulation()

# Analyse images: fit circles
Expand All @@ -79,13 +90,13 @@
maxRadius_round = np.ceil(MAX_radius_px).astype('int64')
minDist = minRadius_round

if images["STED_Thev2016"]["ch0"][0].min() < 0:
images["STED_Thev2016"]["ch0"][0] += -images["STED_Thev2016"]["ch0"][0].min()
if images["STED"]["ch0"][0].min() < 0:
images["STED"]["ch0"][0] += -images["STED"]["ch0"][0].min()

#### Simulated Data
HCparams = dict(dp=1, minDist=maxRadius_round,
param1=10, param2=7, minRadius=minRadius_round, maxRadius=maxRadius_round)
circles_sim, img_blurred_sim, c_params_sim = metrics.get_circles(images["STED_Thev2016"]["ch0"][0].astype(np.uint8), **HCparams)
circles_sim, img_blurred_sim, c_params_sim = metrics.get_circles(images["STED"]["ch0"][0].astype(np.uint8), **HCparams)
radii_simulated= []
for (x, y, r) in circles_sim[0]:
radii_simulated.append((r*pixelsize))
Expand All @@ -103,7 +114,7 @@
fig, axs = plt.subplots(1, 3)
axs[0].imshow(experimental_img_processed, cmap="grey")
axs[0].set_title("Modified from Thevathasan et al. 2019. Nature Methods.")
axs[1].imshow(images["STED_Thev2016"]["ch0"][0], cmap="grey")
axs[1].imshow(images["STED"]["ch0"][0], cmap="grey")
axs[1].set_title("VLab4Mic simulated image")

df = pd.DataFrame({
Expand All @@ -115,7 +126,7 @@

length_nm = 1000
nm = 1e-09
pixelsize = (experiment.imaging_modalities["STED_Thev2016"]["detector"]["scale"] / nm) * experiment.imaging_modalities["STED_Thev2016"]["detector"]["pixelsize"]
pixelsize = (experiment.imaging_modalities["STED"]["detector"]["scale"] / nm) * experiment.imaging_modalities["STED"]["detector"]["pixelsize"]
pixelsize = np.ceil(pixelsize)
length_px = length_nm / pixelsize
hight_px = length_px / 10
Expand Down
22 changes: 18 additions & 4 deletions examples/real_vs_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
import matplotlib.font_manager as fm

random_seed = 24
# parameters for simulation
structure = "7R5K"
probe_template = "GFP_w_nanobody"
probe_target_type = "Sequence"
probe_target_value = "ELAVGSL" # Sequence in the C-terminal of Nup96
modalities = ["STED_Thev2016", ]
modalities = ["STED", ]

# fetch experimental image from URL
STED_example = "https://ftp.ebi.ac.uk/biostudies/fire/S-BIAD/S-BIAD0-99/S-BIAD8/Files/Library/Gallery%20Fig%201/STED/GFP_Gallery-STED_181026_1.tif"
Expand Down Expand Up @@ -44,9 +44,10 @@
probe_target_type=probe_target_type,
probe_target_value=probe_target_value,
multimodal=modalities,
STED_Thev2016={"exp_time": 0.0004},
STED={"exp_time": 0.0004},
clear_experiment=True,
run_simulation=False,
random_seed=random_seed
)

# Use experimental image for positioning
Expand All @@ -60,6 +61,19 @@
min_distance=min_distance)

# Run simulation
## Modality parameter of pixelsize_nm is set to match Thevathasan et al. 2019.
## All other parameters are estimations to emulate Thevathasan et al. 2019 STED modality
experiment.update_modality(
modality_name="STED",
lateral_resolution_nm=15,
axial_resolution_nm=20,
psf_voxel_nm=5,
depth_of_field_nm=100,
pixelsize_nm=15)
experiment.set_modality_acq(
modality_name="STED",
exp_time=0.0004)
experiment.imager.modalities["STED"]["detector"]["noise_model"]["binomial"]["p"] = 0.7
images, noiselsess = experiment.run_simulation()

# Plot experimental vs simulated image
Expand All @@ -70,7 +84,7 @@
fig, axs = plt.subplots(1, 2)
axs[0].imshow(experimental_img_processed, cmap="grey")
axs[0].set_title("Modified from Thevathasan et al. 2019. Nature Methods.")
axs[1].imshow(images["STED_Thev2016"]["ch0"][0], cmap="grey")
axs[1].imshow(images["STED"]["ch0"][0], cmap="grey")
axs[1].set_title("VLab4Mic simulated image")

fontprops = fm.FontProperties(size=20)
Expand Down
29 changes: 0 additions & 29 deletions src/vlab4mic/configs/modalities/AiryScan_Thev2016.yaml

This file was deleted.

29 changes: 0 additions & 29 deletions src/vlab4mic/configs/modalities/Confocal_Thev2016.yaml

This file was deleted.

29 changes: 0 additions & 29 deletions src/vlab4mic/configs/modalities/STED_Thev2016.yaml

This file was deleted.

29 changes: 0 additions & 29 deletions src/vlab4mic/configs/modalities/STORM_Thev2016.yaml

This file was deleted.

29 changes: 0 additions & 29 deletions src/vlab4mic/configs/modalities/Widefield_Thev2016.yaml

This file was deleted.

Loading