Skip to content

Commit

Permalink
feat: add simulation of constant bg fluorescence
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Mar 26, 2019
1 parent 47a5047 commit b1b2d7a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- feat: new options for sinogram generation
- measurement duration (or specific times per angle)
- specify simulated imaging modalities
- simulate photobleaching
- simulate photobleaching and background fluorescence
0.2.1
- ref: migrate to flimage
0.2.0
Expand Down
5 changes: 3 additions & 2 deletions cellsino/fluorescence.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class Fluorescence(object):

def __init__(self, phantom, grid_size, pixel_size, displacement=(0, 0),
bleach_factor=1):
bleach_factor=1, background=0):
"""Fluorescence projector
Notes
Expand All @@ -27,6 +27,7 @@ def __init__(self, phantom, grid_size, pixel_size, displacement=(0, 0),
#: bleaching factor (image is multiplied by this factor
#: to simulate photobleaching)
self.bleach_factor = bleach_factor
self.background = background

def project(self):
fluor = np.zeros(self.grid_size, dtype=float)
Expand All @@ -35,7 +36,7 @@ def project(self):
fluor += self.project_sphere(element)

flifull = flimage.FLImage(
data=fluor * self.bleach_factor,
data=fluor * self.bleach_factor + self.background,
meta_data={
"pixel size": self.pixel_size,
}
Expand Down
6 changes: 5 additions & 1 deletion cellsino/sinogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def __init__(self, phantom, wavelength, pixel_size, grid_size):

def compute(self, angles, axis_roll=0, displacements=None,
times=3.0, mode=["field", "fluorescence"], propagator="rytov",
bleach_decay=0, path=None, count=None, max_count=None):
bleach_decay=0, fluorescence_background=0, path=None,
count=None, max_count=None):
"""Compute sinogram data
Parameters
Expand Down Expand Up @@ -48,6 +49,8 @@ def compute(self, angles, axis_roll=0, displacements=None,
:data:`cellsino.propagators.available`.
bleach_decay: float
Photobleaching decay constant [1/s]
fluorescence_background: float
Overall fluorescence background signal
path: str or pathlib.Path
If not None, the data will be written to this file and
a :class:`pathlib.Path` object will be returned.
Expand Down Expand Up @@ -122,6 +125,7 @@ def compute(self, angles, axis_roll=0, displacements=None,
pixel_size=self.pixel_size,
displacement=displacements[ii],
bleach_factor=bleach_factor,
background=fluorescence_background,
).project()
fli["time"] = times[ii]

Expand Down

0 comments on commit b1b2d7a

Please sign in to comment.