Skip to content

Commit

Permalink
Update Field Synthesis code for publication in Nature Methods:
Browse files Browse the repository at this point in the history
1. Document python code in README.txt
2. Update abstract in README.txt
3. Fix python code to run on Windows
4. Allow later half of FieldSynthesisTheorem.m to run if more than 3 arguments are output
  • Loading branch information
Mark Kittisopikul committed Jan 15, 2019
1 parent 8f54da0 commit 4b1229d
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 11 deletions.
4 changes: 3 additions & 1 deletion FieldSynthesis/FieldSynthesisTheorem.m
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@

% disp('Press any key');
% pause;
return;
if(nargout > 3)

%% Explanation of the profile of individual line scans
% T represents a selected column in the spectral field selected by the scan
Expand Down Expand Up @@ -260,3 +260,5 @@
% end;

end

end
98 changes: 93 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ We introduce Field Synthesis, a theorem and method that can be used to synthesiz
## Manuscript


Bo-Jui Chang<sup>1</sup>, Mark Kittisopikul<sup>2,4</sup>, Kevin M. Dean<sup>1,3</sup>, Phillipe Roudot<sup>1,3</sup>, Erik Welf<sup>1,3</sup> and Reto Fiolka<sup>1,3</sup>.
Bo-Jui Chang<sup>1,*</sup>, Mark Kittisopikul<sup>2,4,*</sup>, Kevin M. Dean<sup>1,3</sup>, Phillipe Roudot<sup>1,3</sup>, Erik Welf<sup>1,3</sup> and Reto Fiolka<sup>1,3</sup>.
"Universal Light-Sheet Generation with Field Synthesis."

### Affiliations
Expand All @@ -15,6 +15,8 @@ Bo-Jui Chang<sup>1</sup>, Mark Kittisopikul<sup>2,4</sup>, Kevin M. Dean<sup>1,3
3. Lyda Hill Department of Bioinformatics, UT Southwestern Medical Center, Dallas, TX, USA.
4. Department of Cell and Molecular Biology, Feinberg School of Medicine, Northwestern University, Chicago, IL, USA.

*These authors contributed equally to this work

### BioRxiv Preprint
[https://www.biorxiv.org/content/early/2018/09/26/427468](https://www.biorxiv.org/content/early/2018/09/26/427468)

Expand All @@ -27,10 +29,19 @@ A more [general Field Synthesis Theorem proof for the an arbitrary, non-ideal li

## System Requirements

To retrieve code:
* Git 2.18.0 or above

For MATLAB code:
* [MATLAB (2017a or above), Mathworks, Natick, MA](https://www.mathworks.com/support/sysreq.html)
* Image Processing Toolbox
* Follow MATLAB link above for operating system requirements
* Git 2.18.0 or above

For Python code:
* Python 3.6.2 or above
* NumPy
* SciPy
* Matplotlib

## Installation and Demo

Expand All @@ -40,7 +51,7 @@ git clone https://github.com/AdvancedImagingUTSW/FieldSynthesis.git

See below documentation for demonstration. Typical run time: 10 minutes

## Code
## MATLAB Code

### FieldSynthesisTheorem.m

Expand Down Expand Up @@ -204,13 +215,90 @@ FieldSynthesisVersusLattice.m
Lab of Robert D. Goldman
Northwestern University


### Python code - fieldSynthesis.py

#### USAGE

From a shell:
```shell
python fieldSynthesis.py
```

From inside IPython:
```python
from fieldSynthesis.py import *
demoFieldSynthesis()
```

![Top row (left to right): F(x,z) beam illumination pattern in front focal plane, L(x)\delta(z) line scan profile in front focal plane, square modulus of line scan profile in front focal plane, \hat{L}(k_x) line scan profile in back focal plane; Bottom row (left to right): Scanned light-sheet, Convolved light-sheet, Convolved light-sheet using Fourier Transform, Field Synthesis light-sheet](images/fieldSynthesisPy.png)

#### createAnnulus
```python
def createAnnulus(n=256, r=32, w=4):
''' createAnnulus - create a ring-like structure
INPUT
n - size of square array or vector
r - radius of the ring
w - width of the ring
OUTPUT
an array n x n
'''
```

#### doConventionalScan
```python
'''Simulate Conventional digital scanning / dithering
INPUT
F_sqmod - Square modulus of F at the front focal plane
L_sqmod - Square modulus of L at the front focal plane
OUTPUT
scanned - Scanned (dithered) intensity of Fsqmod by Lsqmod
'''
```

#### doConventionalScanHat
```python
def doConventionalScanHat(F_hat,L_hat):
'''Simulate Conventional digital scanning / dithering from frequency space representations
INPUT
F_hat - Mask at back focal plane
L_hat - Line scan profile in frequency space at the back focal plane
OUTPUT
scanned - Scanned (dithered) intensity of Fsqmod by Lsqmod at front focal plane
'''
```

#### doFieldSynthesisLineScan
```python
def doFieldSynthesisLineScan(F_hat,L_hat):
'''Simulate Field Synthesis Method
INPUT
F_hat - Frequency space representation of illumination pattern, mask at back focal plane
L_hat - Line scan profile in frequency space at the back focal plane
OUTPUT
fieldSynthesis - Field synthesis construction by doing a line scan in the back focal plane
'''
```

#### demoFieldSynthesis
```python
def demoFieldSynthesis():
'''Demonstrate Field Synthesis Method with Plots
INPUT
None
OUTPUT
None
'''
```

## License

See LICENSE.txt

Field Synthesis Demonstration - MATLAB code to demonstrate field synthesis light sheet microscopy
Copyright (C) 2018 Reto Fioka, University of Texas Southwestern Medical Center
Copyright (C) 2018 Mark Kittisopikul, Northwestern University
Copyright (C) 2019 Reto Fioka, University of Texas Southwestern Medical Center
Copyright (C) 2019 Mark Kittisopikul, Northwestern University

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
Binary file added images/fieldSynthesisPy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 12 additions & 5 deletions python/fieldSynthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,14 @@ def doFieldSynthesisLineScan(F_hat,L_hat):

return fieldSynthesis

def main():
plt.rc('text', usetex=True)
def demoFieldSynthesis():
'''Demonstrate Field Synthesis Method with Plots
INPUT
None
OUTPUT
None
'''
# plt.rc('text', usetex=True)
fig, ax = plt.subplots(2,4,sharey=True,sharex=True,figsize=(16,9))

# Create F, the illumination pattern
Expand Down Expand Up @@ -158,15 +164,16 @@ def main():
convolvedft = np.real(convolvedft)

ax[1,2].imshow(convolvedft, cmap='plasma')
ax[1,2].set_title(r'Convolved FT: $ \mathcal{F}^{-1} \{ \mathcal{F}\{|F|^2\} \mathcal{F}\{|L\delta(z)|^2\} \} $')
ax[1,2].set_title(r'Convolved FT: $ \mathcal{F}^{-1} \{ \mathcal{F}\{|F|^2\} \mathcal{F}\{|L(x)\delta(z)|^2\} \} $')

# Do the Field Synthesis method of performing a line scan at the back focal plane
fieldSynthesis = doFieldSynthesisLineScan(F_hat,L_hat)

ax[1,3].imshow(fieldSynthesis, cmap='plasma')
ax[1,3].set_title('Field Synthesis: $ \sum_a |\mathcal{F}^{-1}\{ \hat{F}(k_x,k_z)\hat{L}(k_x-a) \}|^2 $')

plt.show(block=True)
plt.ion()
plt.show()

if __name__ == "__main__":
main()
demoFieldSynthesis()

0 comments on commit 4b1229d

Please sign in to comment.