Skip to content

Commit

Permalink
feat: allow to set measurement duration in sinogram computation
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Mar 22, 2019
1 parent ac3f225 commit 9d58a6d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
0.3.0
- feat: allow to define a measurement duration when generating sinograms
0.2.1
- ref: migrate to flimage
0.2.0
Expand Down
15 changes: 13 additions & 2 deletions cellsino/sinogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def __init__(self, phantom, wavelength, pixel_size, grid_size):
self.grid_size = grid_size

def compute(self, angles, axis_roll=0, displacements=None,
propagator="rytov", path=None, count=None, max_count=None):
duration=3.0, propagator="rytov",
path=None, count=None, max_count=None):
"""Compute sinogram data
Parameters
Expand All @@ -38,6 +39,10 @@ def compute(self, angles, axis_roll=0, displacements=None,
:func:`numpy.random.normal`) in pixels.
A 2d array directly specifies the x-y-displacement for each
frame in pixels.
duration: float
Measurement time of the full sinogram [s]. The frame rate is
always constant. Use the `angles` argument to simulate
varying rotation speeds.
propagator: str
The propagator to use. Must be in
:data:`cellsino.propagators.available`.
Expand Down Expand Up @@ -80,20 +85,26 @@ def compute(self, angles, axis_roll=0, displacements=None,
self.grid_size[1]),
dtype=float)

frame_times = np.linspace(0, duration, len(angles), endpoint=False)

for ii, ang in enumerate(angles):
ph = self.phantom.transform(rot_main=ang, rot_in_plane=axis_roll)

# QPI
pp = prop_dict[propagator](phantom=ph,
grid_size=self.grid_size,
pixel_size=self.pixel_size,
wavelength=self.wavelength,
displacement=displacements[ii])
qpi = pp.propagate()
# Fluorescence
fli = Fluorescence(phantom=ph,
grid_size=self.grid_size,
pixel_size=self.pixel_size,
displacement=displacements[ii]
).project()
# recording time of each sinogram slice
qpi["time"] = frame_times[ii]
fli["time"] = frame_times[ii]

if write:
with h5py.File(path, "a") as h5:
Expand Down

0 comments on commit 9d58a6d

Please sign in to comment.