├── .classpath ├── .gitignore ├── .project ├── LICENSE ├── README.md ├── build.xml ├── plugins.config ├── resources ├── PSFGenerator.png ├── PSFGenerator_icon.png └── PSFGenerator_icon.xml └── src ├── PSFGenerator.java ├── PSF_Generator.java ├── matlab └── Converter.java ├── plugins └── sage │ └── psfgenerator │ ├── PSFGenerator.java │ └── PSFGeneratorIcyFrame.java ├── psf ├── .svn │ ├── all-wcprops │ ├── entries │ └── text-base │ │ ├── DefocussingPSF.java.svn-base │ │ ├── GaussianPSF.java.svn-base │ │ ├── KoehlerPSF.java.svn-base │ │ └── MainDialog.java.svn-base ├── Data3D.java ├── PSF.java ├── Point3D.java ├── bornwolf │ ├── .svn │ │ ├── all-wcprops │ │ ├── entries │ │ └── text-base │ │ │ ├── BornWolf.java.svn-base │ │ │ ├── BornWolfPSF.java.svn-base │ │ │ ├── BornWolfParameters.java.svn-base │ │ │ └── KirchhoffDiffractionSimpson.java.svn-base │ ├── BornWolfPSF.java │ └── KirchhoffDiffractionSimpson.java ├── defocusplane │ ├── DefocusPlanePSF.java │ ├── ZFunction.java │ └── lateral │ │ ├── Astigmatism.java │ │ ├── CardinalSin.java │ │ ├── CircularPupil.java │ │ ├── Cosine.java │ │ ├── DoubleHelix.java │ │ ├── Gaussian.java │ │ ├── LateralFunction.java │ │ ├── Lorentz.java │ │ └── OrientedGaussian.java ├── defocussing │ └── DefocussingPSF.java ├── gibsonlanni │ ├── .svn │ │ ├── all-wcprops │ │ ├── entries │ │ └── text-base │ │ │ ├── GibsonLanni.java.svn-base │ │ │ ├── GibsonLanniPSF.java.svn-base │ │ │ ├── GibsonLanniParameters.java.svn-base │ │ │ ├── KirchhoffDiffractionRiemann.java.svn-base │ │ │ └── KirchhoffDiffractionSimpson.java.svn-base │ ├── GibsonLanniPSF.java │ ├── GibsonLanniParameters.java │ ├── KirchhoffDiffractionRiemann.java │ └── KirchhoffDiffractionSimpson.java ├── koehler │ └── KoehlerPSF.java ├── richardswolf │ ├── .svn │ │ ├── all-wcprops │ │ ├── entries │ │ └── text-base │ │ │ ├── KirchhoffDiffractionSimpson.java.svn-base │ │ │ ├── RichardsWolf.java.svn-base │ │ │ ├── RichardsWolfPSF.java.svn-base │ │ │ └── RichardsWolfParameters.java.svn-base │ ├── KirchhoffDiffractionSimpson.java │ └── RichardsWolfPSF.java ├── torgovarga │ ├── .svn │ │ ├── all-wcprops │ │ ├── entries │ │ └── text-base │ │ │ ├── KirchhoffDiffractionSimpson.java.svn-base │ │ │ ├── TorokVarga.java.svn-base │ │ │ ├── TorokVargaPSF.java.svn-base │ │ │ └── TorokVargaParameters.java.svn-base │ ├── KirchhoffDiffractionSimpson.java │ ├── TorokVargaPSF.java │ └── TorokVargaParameters.java └── vri_gibsonlanni │ ├── .svn │ ├── all-wcprops │ ├── entries │ └── text-base │ │ ├── KirchhoffDiffractionSimpson.java.svn-base │ │ ├── ModifiedGL.java.svn-base │ │ ├── ModifiedGLPSF.java.svn-base │ │ └── ModifiedGLParameters.java.svn-base │ ├── KirchhoffDiffractionSimpson.java │ ├── VRIGLPSF.java │ └── VRIGLParameters.java └── psfgenerator ├── About.java ├── CollectionPSF.java ├── MainPanel.java ├── ResultPlanesTable.java └── SummaryPanel.java /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | /bin/ 25 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | PSFGenerator 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | PSFGenerator 2 | ============ 3 | 4 | [**A Java software package to generate realistic 3D microscope Point-Spread Function (PSF)**](http://bigwww.epfl.ch/algorithms/psfgenerator/) 5 | 6 | _Written by Hagai Kirshner and Daniel Sage at the Biomedical Image Group (BIG), EPFL, Switzerland_ 7 | 8 | ## Outline 9 | PSF Generator is a Java software package that allows one to generate and visualize various 3D models of a microscope PSF. The current version has more than fifteen different models: 10 | * 3D diffractive models: scalar-based diffraction model Born & Wolf, scalar-based diffraction model with 3 layers Gibson & Lanni, and vectorial-based model Richards & Wolf, and Variable Refractive Index Gibson & Lanni model. 11 | * Defocussing a 2D lateral function with 1D axial function: the available lateral functions are: "Gaussian", "Lorentz", "Cardinale-Sine", "Cosine", "Circular-Pupil", "Astigmatism", "Oriented-Gaussian", "Double-Helix". 12 | * Optical Transfer Function generated in the Fourier domain: Koehler simulation, defocus simulation. 13 | 14 | PSF Generator is provided for several environments: as ImageJ/Fiji plugin, as an Icy plugin, and as a Java standalone application. The program requires only few parameters which are readily-available for microscopy practitioners. Our Java implementation achieves fast execution times, as it is based on multi-threading the computational tasks and on a numerical method that adapts to the oscillatory nature of the required integrands. Potential applications are 3D deconvolution, 3D particle localization and tracking, and extended depth of field estimation to name a few. 15 | 16 | ## References 17 | 18 | * H. Kirshner, F. Aguet, D. Sage, M. Unser [3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application](http://bigwww.epfl.ch/publications/kirshner1301.html) Journal of Microscopy, 2013. 19 | * A. Griffa, N. Garin and D. Sage, [Comparison of Deconvolution Software in 3D Microscopy. A User Point of View](http://bigwww.epfl.ch/publications/griffa1001.html), G.I.T. Imaging & Microscopy, 2010. 20 | * D. Sage, L. Donati, F. Soulez, D. Fortun, G. Schmit, A. Seitz, R. Guiet, C. Vonesch, M. Unser [DeconvolutionLab2: An Open-Source Software for Deconvolution Microscopy](http://bigwww.epfl.ch/publications/sage1701.html) Methods—Image Processing for Biologists, 2017. -------------------------------------------------------------------------------- /build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /plugins.config: -------------------------------------------------------------------------------- 1 | # Name: PSF Generator 2 | 3 | # Daniel Sage 4 | # Biomedical Imaging Group 5 | # Ecole Polytechnique Federale de Lausanne (EPFL), Lausanne, Switzerland 6 | 7 | # Date: 12 Avril 2011 8 | 9 | Plugins>PSF Generator, "PSF Generator", PSF_Generator 10 | 11 | -------------------------------------------------------------------------------- /resources/PSFGenerator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Biomedical-Imaging-Group/PSFGenerator/70ca576bd685aeed43b185d8ace8e295cc29a2e0/resources/PSFGenerator.png -------------------------------------------------------------------------------- /resources/PSFGenerator_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Biomedical-Imaging-Group/PSFGenerator/70ca576bd685aeed43b185d8ace8e295cc29a2e0/resources/PSFGenerator_icon.png -------------------------------------------------------------------------------- /resources/PSFGenerator_icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PSFGenerator_icon.png 4 | 5 | 1 6 | 1 7 | 1 8 | 0.1 9 | ch 0 10 | ch 1 11 | ch 2 12 | ch 3 13 | 14 | 15 | 16 | 4 17 | 18 | false 19 | true 20 | 0 21 | 255 22 | 0 23 | 255 24 | 0 25 | 255 26 | 27 | 28 | Custom 29 | true 30 | RGB 31 | 32 | 33 | 0 34 | 0 35 | 36 | 37 | 255 38 | 255 39 | 40 | 41 | 42 | 43 | 0 44 | 0 45 | 46 | 47 | 255 48 | 0 49 | 50 | 51 | 52 | 53 | 0 54 | 0 55 | 56 | 57 | 255 58 | 0 59 | 60 | 61 | 62 | 63 | 0 64 | 0 65 | 66 | 67 | 255 68 | 85 69 | 70 | 71 | 72 | 73 | 0 74 | 255 75 | 76 | 77 | 255 78 | 255 79 | 80 | 81 | 82 | 83 | false 84 | true 85 | 0 86 | 255 87 | 0 88 | 255 89 | 0 90 | 255 91 | 92 | 93 | Custom 94 | true 95 | RGB 96 | 97 | 98 | 0 99 | 0 100 | 101 | 102 | 255 103 | 0 104 | 105 | 106 | 107 | 108 | 0 109 | 0 110 | 111 | 112 | 255 113 | 255 114 | 115 | 116 | 117 | 118 | 0 119 | 0 120 | 121 | 122 | 255 123 | 0 124 | 125 | 126 | 127 | 128 | 0 129 | 0 130 | 131 | 132 | 255 133 | 85 134 | 135 | 136 | 137 | 138 | 0 139 | 255 140 | 141 | 142 | 255 143 | 255 144 | 145 | 146 | 147 | 148 | false 149 | true 150 | 0 151 | 255 152 | 0 153 | 255 154 | 0 155 | 255 156 | 157 | 158 | Custom 159 | true 160 | RGB 161 | 162 | 163 | 0 164 | 0 165 | 166 | 167 | 255 168 | 0 169 | 170 | 171 | 172 | 173 | 0 174 | 0 175 | 176 | 177 | 255 178 | 0 179 | 180 | 181 | 182 | 183 | 0 184 | 0 185 | 186 | 187 | 255 188 | 255 189 | 190 | 191 | 192 | 193 | 0 194 | 0 195 | 196 | 197 | 255 198 | 85 199 | 200 | 201 | 202 | 203 | 0 204 | 255 205 | 206 | 207 | 255 208 | 255 209 | 210 | 211 | 212 | 213 | false 214 | true 215 | 0 216 | 255 217 | 0 218 | 255 219 | 0 220 | 255 221 | 222 | 223 | Custom 224 | true 225 | ALPHA 226 | 227 | 228 | 0 229 | 0 230 | 231 | 232 | 255 233 | 0 234 | 235 | 236 | 237 | 238 | 0 239 | 0 240 | 241 | 242 | 255 243 | 0 244 | 245 | 246 | 247 | 248 | 0 249 | 0 250 | 251 | 252 | 255 253 | 0 254 | 255 | 256 | 257 | 258 | 0 259 | 0 260 | 261 | 262 | 255 263 | 0 264 | 265 | 266 | 267 | 268 | 0 269 | 0 270 | 271 | 272 | 255 273 | 255 274 | 275 | 276 | 277 | 278 | 279 | -------------------------------------------------------------------------------- /src/PSF_Generator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | import java.awt.event.ActionEvent; 46 | import java.awt.event.ActionListener; 47 | import java.util.ArrayList; 48 | import java.util.HashMap; 49 | 50 | import javax.swing.JButton; 51 | import javax.swing.JFrame; 52 | import javax.swing.JTabbedPane; 53 | 54 | import bilib.commons.buttons.ButtonFactory; 55 | import bilib.commons.job.JobEvent; 56 | import bilib.commons.job.runnable.Pool; 57 | import bilib.commons.job.runnable.PoolResponder; 58 | import bilib.commons.settings.Settings; 59 | import ij.IJ; 60 | import ij.ImagePlus; 61 | import ij.ImageStack; 62 | import ij.gui.GUI; 63 | import ij.plugin.PlugIn; 64 | import ij.process.ByteProcessor; 65 | import ij.process.FloatProcessor; 66 | import ij.process.ShortProcessor; 67 | import psf.Data3D; 68 | import psf.PSF; 69 | import psfgenerator.About; 70 | import psfgenerator.CollectionPSF; 71 | import psfgenerator.MainPanel; 72 | import psfgenerator.ResultPlanesTable; 73 | import psfgenerator.SummaryPanel; 74 | 75 | public class PSF_Generator implements PoolResponder, PlugIn, ActionListener { 76 | 77 | private Settings settings = new Settings("PSFGenerator", IJ.getDirectory("plugins") + "PSFGenerator.txt"); 78 | private String[] types = new String[] { "32-bits", "8-bits", "16-bits" }; 79 | private String[] luts = new String[] { "Fire", "Spectrum", "Grays", "Green" }; 80 | private MainPanel panel; 81 | private JFrame frame; 82 | 83 | private HashMap buttons = new HashMap(); 84 | 85 | @Override 86 | public void run(String arg) { 87 | ArrayList psfs = CollectionPSF.getStandardCollection(); 88 | buildButtons(); 89 | panel = new MainPanel(settings, buttons, psfs, luts, types, this); 90 | frame = new JFrame(About.title()); 91 | frame.getContentPane().add(panel); 92 | frame.setResizable(false); 93 | frame.pack(); 94 | GUI.center(frame); 95 | frame.setVisible(true); 96 | } 97 | 98 | private void buildButtons() { 99 | buttons.clear(); 100 | buttons.put("run", ButtonFactory.run(false)); 101 | buttons.put("stop", ButtonFactory.stop(false)); 102 | buttons.put("settings", ButtonFactory.prefs(false)); 103 | buttons.put("help", ButtonFactory.help(false)); 104 | buttons.put("about", ButtonFactory.about(false)); 105 | buttons.put("close", ButtonFactory.close(false)); 106 | 107 | buttons.get("close").addActionListener(this); 108 | } 109 | 110 | public void close() { 111 | if (panel != null) { 112 | settings.storeValue("PSF-shortname", panel.getSelectedPSFShortname()); 113 | panel.onClosed(); 114 | } 115 | if (frame != null) 116 | frame.dispose(); 117 | settings.storeRecordedItems(); 118 | } 119 | 120 | @Override 121 | public void actionPerformed(ActionEvent event) { 122 | JButton bn = (JButton) event.getSource(); 123 | if (bn == buttons.get("close")) 124 | close(); 125 | } 126 | 127 | @Override 128 | public void onFailure(Pool pool, JobEvent event) { 129 | panel.setEnabledRun(true); 130 | Exception ex = event.getException(); 131 | if (ex != null) { 132 | IJ.log(" POOL " + pool.getName() + " " + pool.size()); 133 | // event.getJob().getPool().die(); 134 | StackTraceElement elements[] = ex.getStackTrace(); 135 | IJ.log("" + event); 136 | for (StackTraceElement element : elements) 137 | IJ.log(element.toString()); 138 | } 139 | } 140 | 141 | @Override 142 | public void onEvent(Pool pool, JobEvent event) { 143 | } 144 | 145 | @Override 146 | public void onSuccess(Pool pool, JobEvent event) { 147 | if (event.getJob() instanceof PSF) { 148 | int type = panel.getSelectedType(); 149 | int lut = panel.getSelectedLUT(); 150 | PSF psf = (PSF) event.getSource(); 151 | panel.finish(); 152 | 153 | ImagePlus imp = createImagePlus(psf, type); 154 | display(psf, imp, lut); 155 | JFrame frame = new JFrame("Characterization of PSF"); 156 | JTabbedPane tab = new JTabbedPane(); 157 | tab.add("Summary", new SummaryPanel(psf)); 158 | tab.add("Plane by plane", new ResultPlanesTable(psf)); 159 | frame.getContentPane().add(tab); 160 | frame.pack(); 161 | frame.setVisible(true); 162 | } 163 | panel.setEnabledRun(true); 164 | } 165 | 166 | public ImagePlus createImagePlus(PSF psf, int type) { 167 | String name = psf.getShortname(); 168 | Data3D data = psf.getData(); 169 | int nx = data.nx; 170 | int ny = data.ny; 171 | int nz = data.nz; 172 | 173 | ImageStack stack = new ImageStack(nx, ny); 174 | for (int z = 0; z < nz; z++) { 175 | if (type == 0) 176 | stack.addSlice(new FloatProcessor(nx, ny, data.createAsFloat(z))); 177 | else if (type == 2) 178 | stack.addSlice(new ShortProcessor(nx, ny, data.createAsShort(z), null)); 179 | else if (type == 1) 180 | stack.addSlice(new ByteProcessor(nx, ny, data.createAsByte(z))); 181 | } 182 | return new ImagePlus("PSF " + name, stack); 183 | } 184 | 185 | private void display(PSF psf, ImagePlus imp, int lut) { 186 | imp.show(); 187 | imp.setSlice(imp.getStackSize() / 2); 188 | imp.getCalibration().pixelHeight = psf.resLateral; 189 | imp.getCalibration().pixelWidth = psf.resLateral; 190 | imp.getCalibration().pixelDepth = psf.resAxial; 191 | imp.getCalibration().setUnit("nm"); 192 | try { 193 | IJ.run((String) luts[lut]); 194 | } 195 | catch (Exception e) { 196 | IJ.error("Unknown LUT " + (String) luts[lut]); 197 | } 198 | } 199 | 200 | } 201 | -------------------------------------------------------------------------------- /src/matlab/Converter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package matlab; 46 | 47 | import ij.ImagePlus; 48 | import ij.ImageStack; 49 | import ij.process.ByteProcessor; 50 | import ij.process.ColorProcessor; 51 | import ij.process.FloatProcessor; 52 | import ij.process.ShortProcessor; 53 | 54 | public class Converter { 55 | 56 | /** 57 | * Get an image. 58 | * 59 | * @param imageplus 60 | * image 61 | * @return an N x M array representing the input image 62 | */ 63 | public static Object get(ImagePlus imageplus) { 64 | if (imageplus == null) 65 | return null; 66 | int width = imageplus.getWidth(); 67 | int height = imageplus.getHeight(); 68 | int stackSize = imageplus.getStackSize(); 69 | int counter = 0; 70 | ImageStack imagestack = imageplus.getStack(); 71 | switch (imageplus.getType()) { 72 | 73 | case ImagePlus.COLOR_256: { 74 | ; 75 | } 76 | case ImagePlus.GRAY8: { 77 | short[][][] is = new short[height][width][stackSize]; 78 | for (int sz = 0; sz < stackSize; sz++) { 79 | ByteProcessor byteprocessor = (ByteProcessor) imagestack.getProcessor(sz + 1); 80 | byte[] pixels = (byte[]) byteprocessor.getPixels(); 81 | counter = 0; 82 | int h = 0; 83 | while (h < height) { 84 | int w = 0; 85 | while (w < width) { 86 | is[h][w][sz] = (short) (pixels[counter] & 0xff); 87 | w++; 88 | counter++; 89 | } 90 | counter = ++h * width; 91 | } 92 | } 93 | return is; 94 | } 95 | case ImagePlus.GRAY16: { 96 | int[][][] is = new int[height][width][stackSize]; 97 | for (int sz = 0; sz < stackSize; sz++) { 98 | counter = 0; 99 | ShortProcessor shortprocessor = (ShortProcessor) imagestack.getProcessor(sz + 1); 100 | short[] spixels = (short[]) shortprocessor.getPixels(); 101 | int h = 0; 102 | while (h < height) { 103 | int w = 0; 104 | while (w < width) { 105 | is[h][w][sz] = (int) (spixels[counter] & 0xffff); 106 | w++; 107 | counter++; 108 | } 109 | counter = ++h * width; 110 | } 111 | } 112 | return is; 113 | } 114 | case ImagePlus.GRAY32: { 115 | double[][][] fs = new double[height][width][stackSize]; 116 | for (int sz = 0; sz < stackSize; sz++) { 117 | FloatProcessor floatprocessor = (FloatProcessor) imagestack.getProcessor(sz + 1); 118 | float[] fpixels = (float[]) floatprocessor.getPixels(); 119 | counter = 0; 120 | int i = 0; 121 | while (i < height) { 122 | int j = 0; 123 | while (j < width) { 124 | fs[i][j][sz] = (double) fpixels[counter]; 125 | j++; 126 | counter++; 127 | } 128 | counter = ++i * width; 129 | } 130 | } 131 | return fs; 132 | } 133 | case ImagePlus.COLOR_RGB: { 134 | if (stackSize == 1) { 135 | short[][][] is = new short[height][width][3]; 136 | ColorProcessor colorprocessor = (ColorProcessor) imagestack.getProcessor(1); 137 | byte[] red = new byte[width * height]; 138 | byte[] green = new byte[width * height]; 139 | byte[] blue = new byte[width * height]; 140 | colorprocessor.getRGB(red, green, blue); 141 | counter = 0; 142 | int h = 0; 143 | while (h < height) { 144 | int w = 0; 145 | while (w < width) { 146 | is[h][w][0] = (short) (red[counter] & 0xff); 147 | is[h][w][1] = (short) (green[counter] & 0xff); 148 | is[h][w][2] = (short) (blue[counter] & 0xff); 149 | w++; 150 | counter++; 151 | } 152 | counter = ++h * width; 153 | } 154 | return is; 155 | } 156 | short[][][][] is = new short[height][width][stackSize][3]; 157 | for (int sz = 0; sz < stackSize; sz++) { 158 | ColorProcessor colorprocessor = (ColorProcessor) imagestack.getProcessor(sz + 1); 159 | byte[] red = new byte[width * height]; 160 | byte[] green = new byte[width * height]; 161 | byte[] blue = new byte[width * height]; 162 | colorprocessor.getRGB(red, green, blue); 163 | counter = 0; 164 | int h = 0; 165 | while (h < height) { 166 | int w = 0; 167 | while (w < width) { 168 | is[h][w][sz][0] = (short) red[counter]; 169 | is[h][w][sz][1] = (short) green[counter]; 170 | is[h][w][sz][2] = (short) blue[counter]; 171 | w++; 172 | counter++; 173 | } 174 | counter = ++h * width; 175 | } 176 | } 177 | return is; 178 | } 179 | default: 180 | System.out.println("MIJ Error message: Unknow type of volumes."); 181 | return null; 182 | } 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /src/plugins/sage/psfgenerator/PSFGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package plugins.sage.psfgenerator; 46 | 47 | import icy.plugin.abstract_.PluginActionable; 48 | 49 | public class PSFGenerator extends PluginActionable { 50 | 51 | @Override 52 | public void run() { 53 | new PSFGeneratorIcyFrame(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/psf/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 50 4 | /svn/psfgenerator/!svn/ver/32/PSFGenerator/src/psf 5 | END 6 | DefocussingPSF.java 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 70 10 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/DefocussingPSF.java 11 | END 12 | GaussianPSF.java 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 67 16 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/GaussianPSF.java 17 | END 18 | KoehlerPSF.java 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 66 22 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/KoehlerPSF.java 23 | END 24 | MainDialog.java 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 66 28 | /svn/psfgenerator/!svn/ver/32/PSFGenerator/src/psf/MainDialog.java 29 | END 30 | -------------------------------------------------------------------------------- /src/psf/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 32 5 | https://svn.epfl.ch/svn/psfgenerator/PSFGenerator/src/psf 6 | https://svn.epfl.ch/svn/psfgenerator 7 | 8 | 9 | 10 | 2012-11-27T10:25:13.249218Z 11 | 32 12 | kirshner 13 | 14 | 15 | svn:special svn:externals svn:needs-lock 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28c35a94-be80-47a4-8420-aa990001146c 28 | 29 | DefocussingPSF.java 30 | file 31 | 32 | 33 | 34 | 35 | 2012-11-27T10:45:32.000000Z 36 | 32071db1c4f9bbfd0325900246ee85fc 37 | 2012-07-05T06:31:32.932295Z 38 | 29 39 | dsage 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 6925 62 | 63 | GaussianPSF.java 64 | file 65 | 66 | 67 | 68 | 69 | 2012-11-27T10:45:32.000000Z 70 | 24e90f391d6fb75f48590f1ca3c4ff86 71 | 2012-07-05T06:31:32.932295Z 72 | 29 73 | dsage 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 4549 96 | 97 | KoehlerPSF.java 98 | file 99 | 100 | 101 | 102 | 103 | 2012-11-27T10:45:32.000000Z 104 | 0ea1027cd34dd632991d8a10a80455ee 105 | 2012-07-05T06:31:32.932295Z 106 | 29 107 | dsage 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 6311 130 | 131 | MainDialog.java 132 | file 133 | 134 | 135 | 136 | 137 | 2012-11-27T10:45:32.000000Z 138 | e56dd70950055a9272b295c9ac0e119d 139 | 2012-11-27T10:25:13.249218Z 140 | 32 141 | kirshner 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 13477 164 | 165 | bw 166 | dir 167 | 168 | gl 169 | dir 170 | 171 | mgl 172 | dir 173 | 174 | rw 175 | dir 176 | 177 | tv 178 | dir 179 | 180 | utils 181 | dir 182 | 183 | -------------------------------------------------------------------------------- /src/psf/.svn/text-base/GaussianPSF.java.svn-base: -------------------------------------------------------------------------------- 1 | //===================================================================================== 2 | // Project: PSF Generator 3 | // 4 | // Organization: Biomedical Imaging Group (BIG) 5 | // Ecole Polytechnique Federale de Lausanne (EPFL) 6 | // Lausanne, Switzerland 7 | // 8 | // Information: http://bigwww.epfl.ch/deconvolution/ 9 | // 10 | // Reference: 11 | // Alessandra Griffa, Nathalie Garin, Daniel Sage, 12 | // Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 13 | // G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 14 | // Available: http://bigwww.epfl.ch/publications/griffa1001.html 15 | // 16 | // Conditions of use: 17 | // You'll be free to use this software for research purposes, but you 18 | // should not redistribute it without our consent. In addition, we 19 | // expect you to include a citation or acknowledgment whenever 20 | // you present or publish results that are based on it. 21 | //===================================================================================== 22 | 23 | package psf; 24 | 25 | import imageware.Builder; 26 | import imageware.ImageWare; 27 | 28 | import javax.swing.JLabel; 29 | import javax.swing.JPanel; 30 | 31 | import psf.utils.PSF; 32 | import additionaluserinterface.GridToolbar; 33 | import additionaluserinterface.Settings; 34 | import additionaluserinterface.SpinnerDouble; 35 | 36 | /** 37 | * This class generates Gaussian PSF. 38 | * 39 | * @author Daniel Sage, Biomedical Imaging Group, Ecole Polytechnique Federale de Lausanne (EPFL). 40 | */ 41 | public class GaussianPSF extends PSF { 42 | 43 | static private double sigmaFocus_Default = 2; 44 | static private double sigmaDefocus_Default = 10; 45 | private double sigmaFocus = sigmaFocus_Default;; 46 | private double sigmaDefocus = sigmaDefocus_Default; 47 | static private SpinnerDouble spnFocus = new SpinnerDouble(sigmaFocus_Default, 0, 10000, 1); 48 | static private SpinnerDouble spnDefocus = new SpinnerDouble(sigmaDefocus_Default, 0, 10000, 1); 49 | 50 | /** 51 | * Constructor. 52 | */ 53 | public GaussianPSF() { 54 | super(); 55 | name = "Gaussian function"; 56 | shortName = "Gauss"; 57 | } 58 | 59 | /** 60 | * Check the size. 61 | */ 62 | public String checkSize(int nx, int ny, int nz) { 63 | if (nz < 3) return ("nz should be greater than 3."); 64 | if (nx < 4) return ("nx should be greater than 4."); 65 | if (ny < 4) return ("ny should be greater than 4."); 66 | return ""; 67 | } 68 | 69 | /** 70 | * Reset the parameters as default. 71 | */ 72 | public void resetParameters() { 73 | spnFocus.set(sigmaFocus_Default); 74 | spnDefocus.set(sigmaDefocus_Default); 75 | } 76 | 77 | /** 78 | * Returns the number of blank lines in the description. 79 | */ 80 | public int getNumberBlankLines() { 81 | return 2; 82 | } 83 | 84 | /** 85 | * Read the parameters for the user interface 86 | */ 87 | public void readParameters() { 88 | this.sigmaFocus = spnFocus.get(); 89 | this.sigmaDefocus = spnDefocus.get(); 90 | } 91 | 92 | /** 93 | * Build the panel for the user parameters. 94 | */ 95 | 96 | public JPanel getParametersPanel() { 97 | GridToolbar pn = new GridToolbar(false); 98 | pn.place(01, 0, new JLabel("σfocus")); 99 | pn.place(02, 0, new JLabel("σdefocus")); 100 | pn.place(01, 1, spnFocus); 101 | pn.place(02, 1, spnDefocus); 102 | JPanel panel = new JPanel(); 103 | panel.add(pn); 104 | return panel; 105 | } 106 | 107 | /** 108 | * 109 | */ 110 | public String getDescription() { 111 | String desc = ""; 112 | desc = "

Simulates a blurring effect using a 2D Gaussian function:

"; 113 | desc += "

G(x,y) = exp(-(x2+y2)/2σ2))/σ2

"; 114 | desc += "

The value of &sigma changes linearly with z, starting with σfocus.

"; 115 | desc += "

The final value of &sigma is σdefocus.

"; 116 | return desc; 117 | } 118 | 119 | /** 120 | * getLink. 121 | */ 122 | public String getLink() { 123 | return "http://bigwww.epfl.ch/algorithms/psfgenerator/#g"; 124 | } 125 | 126 | 127 | /** 128 | * Record the parameters in the settings file 129 | */ 130 | public void recordSettings(Settings settings) { 131 | settings.record(name + "spnFocus", spnFocus, "" + sigmaFocus_Default); 132 | settings.record(name + "spnDefocus", spnDefocus, "" + sigmaDefocus_Default); 133 | } 134 | 135 | /** 136 | * Create the 3D PSF. 137 | */ 138 | public void generate() { 139 | 140 | // Center of the stack 141 | double x0 = (nx-1)/2.0; 142 | double y0 = (ny-1)/2.0; 143 | double z0 = (nz-1)/2.0; 144 | 145 | double sigma, value; 146 | ImageWare slice; 147 | double delSigma = (sigmaDefocus-sigmaFocus)/z0; 148 | 149 | for(int z=0; zRefractive index ν0")); 122 | pn.place(02, 0, new JLabel("Refractive index ν1")); 123 | pn.place(03, 0, new JLabel("Out-of-focus - top")); 124 | pn.place(04, 0, new JLabel("Out-of-focus - middle")); 125 | pn.place(05, 0, new JLabel("Out-of-focus - bottom")); 126 | pn.place(01, 1, spnN0); 127 | pn.place(02, 1, spnN1); 128 | pn.place(03, 1, spnDTop); 129 | pn.place(04, 1, spnDMid); 130 | pn.place(05, 1, spnDBot); 131 | pn.place(01, 2, new JLabel("")); 132 | pn.place(02, 2, new JLabel("")); 133 | pn.place(03, 2, new JLabel("[μm]")); 134 | pn.place(04, 2, new JLabel("[μm]")); 135 | pn.place(05, 2, new JLabel("[μm]")); 136 | JPanel panel = new JPanel(); 137 | panel.add(pn); 138 | return panel; 139 | } 140 | 141 | /** 142 | * 143 | */ 144 | public String getDescription() { 145 | String desc = ""; 146 | desc += "

Simulates a defocussing effect due to the Köhler

"; 147 | desc += "

illumination in a brightfield microscope. The

"; 148 | desc += "

optical transfer function in the Fourier domain is

"; 149 | desc += "

OTF(ω) = exp(-ω2σ2/2),

"; 150 | desc += "

where σ = ν0 + ν1.(d+z)

"; 151 | return desc; 152 | } 153 | 154 | /** 155 | * getLink. 156 | */ 157 | public String getLink() { 158 | return "http://bigwww.epfl.ch/algorithms/psfgenerator/#k"; 159 | } 160 | 161 | 162 | /** 163 | * Record the parameters in the settings file 164 | */ 165 | public void recordSettings(Settings settings) { 166 | settings.record(name + "spnN0", spnN0, "" + n0_Default); 167 | settings.record(name + "spnN1", spnN1, "" + n1_Default); 168 | settings.record(name + "spnDTop", spnDTop, "" + dTop_Default); 169 | settings.record(name + "spnDMid", spnDMid, "" + dMid_Default); 170 | settings.record(name + "spnDBot", spnDBot, "" + dBot_Default); 171 | } 172 | 173 | /** 174 | * 175 | */ 176 | public double getProgressInformation() { 177 | return progress; 178 | } 179 | 180 | /** 181 | * Create the 3D PSF. 182 | */ 183 | public void generate() { 184 | double z0 = (nz-1)/2.0; 185 | double d = 0; 186 | for(int z=0; z= z0){ 193 | double r = (z-z0) / z0; 194 | d = dMid * (1.0-r) + dBot * r; 195 | } 196 | ImageWare slice = create(d+z); 197 | FFT.shift(slice); 198 | psf.putXY(0, 0, z, slice); 199 | } 200 | unitary(); 201 | } 202 | 203 | /** 204 | * Create one slice of the PSF. 205 | */ 206 | private ImageWare create(double d) { 207 | double sigma = n0 + n1 * Math.abs(d); 208 | int xsize = nx/2; 209 | int ysize = ny/2; 210 | double ampl = 1.0; //1.0/(2.0*Math.PI*sigma*sigma); 211 | double function[][] = new double[xsize+1][ysize+1]; 212 | double wx, wy, wr; 213 | for (int y=0; y<=ysize; y++) 214 | for (int x=0; x<=xsize; x++) { 215 | wx = Math.PI * x / xsize; 216 | wy = Math.PI * y / ysize; 217 | wr = Math.sqrt(wx*wx + wy*wy); 218 | function[x][y] = ampl*Math.exp(-wr*wr*sigma*sigma/2.0); 219 | } 220 | FourierSpace G = new FourierSpace(function); 221 | return G.inverse(); 222 | } 223 | } 224 | -------------------------------------------------------------------------------- /src/psf/PSF.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psf; 46 | 47 | import javax.swing.JPanel; 48 | 49 | import bilib.commons.job.ExecutionMode; 50 | import bilib.commons.job.JobEvent; 51 | import bilib.commons.job.runnable.Job; 52 | import bilib.commons.job.runnable.Pool; 53 | import bilib.commons.job.runnable.PoolResponder; 54 | import bilib.commons.settings.Settings; 55 | 56 | abstract public class PSF extends Job implements PoolResponder { 57 | 58 | protected Data3D data; 59 | protected String fullname = "Untitled"; 60 | protected String shortname = "..."; 61 | public int nx; 62 | public int ny; 63 | public int nz; 64 | protected int type; 65 | private int scale; 66 | 67 | public double resLateral; // in nm 68 | public double resAxial; // in nm 69 | public double NA; 70 | public double lambda; // in nm 71 | private Pool pool; 72 | 73 | public Data3D getData() { 74 | return data; 75 | } 76 | 77 | public void setOpticsParameters(double NA, double lambdaNM) { 78 | this.NA = NA; 79 | this.lambda = lambdaNM * 1E-9; 80 | } 81 | 82 | public void setResolutionParameters(double resLateral, double resAxial) { 83 | this.resLateral = resLateral; 84 | this.resAxial = resAxial; 85 | } 86 | 87 | public void setOutputParameters(int nx, int ny, int nz, int type, int scale) { 88 | this.nx = nx; 89 | this.ny = ny; 90 | this.nz = nz; 91 | this.type = type; 92 | this.scale = scale; 93 | } 94 | 95 | @Override 96 | public void abort() { 97 | if (pool != null) 98 | pool.die(); 99 | super.abort(); 100 | } 101 | 102 | @Override 103 | public void process() { 104 | progress(1, "Starting " + getShortname() + "..."); 105 | rewind(); 106 | String errorSize = checkSize(nx, ny, nz); 107 | if (!errorSize.equals("")) { 108 | abort(errorSize); 109 | print(errorSize); 110 | return; 111 | } 112 | fetchParameters(); 113 | 114 | data = new Data3D(nx, ny, nz); 115 | progress(4, "Init " + getShortname() + "..."); 116 | pool = new Pool(shortname, this); 117 | generate(pool); 118 | 119 | progress(5, "Executing " + getShortname() + "..."); 120 | pool.execute(ExecutionMode.MULTITHREAD_SYNCHRONIZED); 121 | 122 | data.determineMaximumAndEnergy(); 123 | data.estimateFWHM(); 124 | data.rescale(scale, data.max.value); 125 | } 126 | 127 | public double[] getPlane(int z) { 128 | return data.getPlane(z); 129 | } 130 | 131 | public void setPlane(int z, double plane[]) { 132 | data.setPlane(z, plane); 133 | } 134 | 135 | public String getShortname() { 136 | return shortname; 137 | } 138 | 139 | public String getFullname() { 140 | return fullname; 141 | } 142 | 143 | abstract public void generate(Pool pool); 144 | 145 | abstract public String checkSize(int nx, int ny, int nz); 146 | 147 | abstract public JPanel buildPanel(Settings settings); 148 | 149 | abstract public String getDescription(); 150 | 151 | abstract public void resetParameters(); 152 | 153 | abstract public void fetchParameters(); 154 | 155 | @Override 156 | public void onFailure(Pool pool, JobEvent event) { 157 | getPool().fire(event); 158 | } 159 | 160 | @Override 161 | public void onEvent(Pool pool, JobEvent event) { 162 | getPool().fire(event); 163 | } 164 | 165 | @Override 166 | public void onSuccess(Pool pool, JobEvent event) { 167 | getPool().fire(event); 168 | } 169 | 170 | } 171 | -------------------------------------------------------------------------------- /src/psf/Point3D.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psf; 46 | 47 | public class Point3D { 48 | 49 | public int x; 50 | public int y; 51 | public int z; 52 | public double value; 53 | 54 | @Override 55 | public String toString() { 56 | return "" + x + " " + y + " " + z + " " + value; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/psf/bornwolf/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 53 4 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/bw 5 | END 6 | BornWolf.java 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 67 10 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/bw/BornWolf.java 11 | END 12 | BornWolfPSF.java 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 70 16 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/bw/BornWolfPSF.java 17 | END 18 | KirchhoffDiffractionSimpson.java 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 86 22 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/bw/KirchhoffDiffractionSimpson.java 23 | END 24 | BornWolfParameters.java 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 77 28 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/bw/BornWolfParameters.java 29 | END 30 | -------------------------------------------------------------------------------- /src/psf/bornwolf/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 32 5 | https://svn.epfl.ch/svn/psfgenerator/PSFGenerator/src/psf/bw 6 | https://svn.epfl.ch/svn/psfgenerator 7 | 8 | 9 | 10 | 2012-07-05T06:31:32.932295Z 11 | 29 12 | dsage 13 | 14 | 15 | svn:special svn:externals svn:needs-lock 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28c35a94-be80-47a4-8420-aa990001146c 28 | 29 | BornWolf.java 30 | file 31 | 32 | 33 | 34 | 35 | 2012-11-27T10:45:32.000000Z 36 | cd0c03b65220cee4120c60c5c4381f94 37 | 2012-07-05T06:31:32.932295Z 38 | 29 39 | dsage 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 3597 62 | 63 | BornWolfPSF.java 64 | file 65 | 66 | 67 | 68 | 69 | 2012-11-27T10:45:32.000000Z 70 | bb6b39c21bc77b1aafb30ef5e81aef08 71 | 2012-07-05T06:31:32.932295Z 72 | 29 73 | dsage 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 6353 96 | 97 | BornWolfParameters.java 98 | file 99 | 100 | 101 | 102 | 103 | 2012-11-27T10:45:32.000000Z 104 | da262ac80dc85e17c62f611d98ff39f2 105 | 2012-07-05T06:31:32.932295Z 106 | 29 107 | dsage 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 1419 130 | 131 | KirchhoffDiffractionSimpson.java 132 | file 133 | 134 | 135 | 136 | 137 | 2012-11-27T10:45:32.000000Z 138 | 70183f3e0b71ddff22903ed11c2ab5d1 139 | 2012-07-05T06:31:32.932295Z 140 | 29 141 | dsage 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 4676 164 | 165 | -------------------------------------------------------------------------------- /src/psf/bornwolf/.svn/text-base/BornWolf.java.svn-base: -------------------------------------------------------------------------------- 1 | //===================================================================================== 2 | // Project: PSF Generator 3 | // 4 | // Organization: Biomedical Imaging Group (BIG) 5 | // Ecole Polytechnique Federale de Lausanne (EPFL) 6 | // Lausanne, Switzerland 7 | // 8 | // Information: http://bigwww.epfl.ch/deconvolution/ 9 | // 10 | // Reference: 11 | // Alessandra Griffa, Nathalie Garin, Daniel Sage, 12 | // Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 13 | // G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 14 | // Available: http://bigwww.epfl.ch/publications/griffa1001.html 15 | // 16 | // Conditions of use: 17 | // You'll be free to use this software for research purposes, but you 18 | // should not redistribute it without our consent. In addition, we 19 | // expect you to include a citation or acknowledgment whenever 20 | // you present or publish results that are based on it. 21 | //===================================================================================== 22 | 23 | 24 | package psf.bw; 25 | 26 | import imageware.Builder; 27 | import imageware.ImageWare; 28 | 29 | /** 30 | * This class generates the Born & Wolf PSF. 31 | * 32 | * @author Hagai Kirshner, Biomedical Imaging Group, Ecole Polytechnique Federale de Lausanne (EPFL) 33 | */ 34 | public class BornWolf implements Runnable { 35 | 36 | static int OVER_SAMPLING = 1; 37 | 38 | private BornWolfPSF bwPSF; 39 | private BornWolfParameters p; 40 | private int nx; 41 | private int ny; 42 | private int z; 43 | private boolean running = false; 44 | 45 | /** 46 | * Constructor. 47 | */ 48 | public BornWolf(BornWolfPSF bwPSF, int z) { 49 | this.bwPSF = bwPSF; 50 | this.nx = bwPSF.nx; 51 | this.ny = bwPSF.ny; 52 | this.z = z; 53 | // making a new copy of the parameters is required, as different threads use different "defocus" values. 54 | this.p = new BornWolfParameters(bwPSF.p); 55 | } 56 | 57 | public boolean isRunning() { 58 | return running; 59 | } 60 | 61 | /** 62 | * Creates a 2D PSF image at a specified stage displacement. 63 | */ 64 | public void run() { 65 | 66 | running = true; 67 | 68 | // The center of the image in units of [pixels] 69 | double x0 = (nx-1)/2.0; 70 | double y0 = (ny-1)/2.0; 71 | 72 | // Lateral particle position in units of [pixels] 73 | double xp = x0;// 0.0/p.pixelSize; 74 | double yp = y0;// 0.0/p.pixelSize; 75 | 76 | // Radial locations. 77 | //double xpAbs = Math.abs(xp), ypAbs = Math.abs(yp); 78 | //double maxRadialDistanceInPixels = Math.round(Math.sqrt((xpAbs+nx-x0)*(xpAbs+nx-x0)+(ypAbs+ny-y0)*(ypAbs+ny-y0)))+1; 79 | int maxRadius = ((int) Math.round(Math.sqrt((nx-x0)*(nx-x0)+(ny-y0)*(ny-y0))))+1; 80 | double[] r = new double[maxRadius*OVER_SAMPLING]; 81 | double[] h = new double[r.length]; 82 | 83 | //p.defocus = stageDisplacement; 84 | //KirchhoffDiffractionRiemann I = new KirchhoffDiffractionRiemann(p,accuracy); 85 | KirchhoffDiffractionSimpson I = new KirchhoffDiffractionSimpson(p,bwPSF.accuracy); 86 | 87 | for (int n=0; nNumerical Aperture")); 140 | pn.place(02, 0, new JLabel("Refractive Index immersion")); 141 | pn.place(03, 0, new JLabel("Wavelength λ")); 142 | pn.place(04, 0, new JLabel("Pixel size")); 143 | pn.place(05, 0, new JLabel("Z-step spacing")); 144 | pn.place(01, 1, spnNA); 145 | pn.place(02, 1, spnNI); 146 | pn.place(03, 1, spnLambda); 147 | pn.place(04, 1, spnLateral); 148 | pn.place(05, 1, spnAxial); 149 | pn.place(01, 2, new JLabel("NA")); 150 | pn.place(02, 2, new JLabel("n")); 151 | pn.place(03, 2, new JLabel("[nm]")); 152 | pn.place(04, 2, new JLabel("[nm]")); 153 | pn.place(05, 2, new JLabel("[nm]")); 154 | JPanel panel = new JPanel(); 155 | panel.add(pn); 156 | return panel; 157 | } 158 | 159 | /** 160 | * getDescription() 161 | */ 162 | public String getDescription() { 163 | String desc = ""; 164 | desc += "This model describes the scalar-based
"; 165 | desc += "diffraction that occurs in the microscope
"; 166 | desc += "when the particle is in focus
"; 167 | desc += "The imaging plan need not be in focus."; 168 | return desc; 169 | } 170 | 171 | /** 172 | * getLink. 173 | */ 174 | public String getLink() { 175 | return "http://bigwww.epfl.ch/algorithms/psfgenerator/#bw"; 176 | } 177 | 178 | 179 | /** 180 | * Record the parameters in the settings file 181 | */ 182 | public void recordSettings(Settings settings) { 183 | settings.record(name + "spnNA", spnNA, "" + NA_Default); 184 | settings.record(name + "spnNI", spnNI, "" + ni_Default); 185 | settings.record(name + "spnLateral", spnLateral, "" + lateralResolution_Default); 186 | settings.record(name + "spnAxial", spnAxial, "" + axialResolution_Default); 187 | settings.record(name + "spnLambda", spnLambda, "" + lambda_Default); 188 | } 189 | 190 | /** 191 | * Create the 3D PSF z-stack. 192 | */ 193 | public void generate() { 194 | 195 | BornWolf gb[] = new BornWolf[nz]; 196 | 197 | for (int z=0; z. 43 | */ 44 | 45 | package psf.bornwolf; 46 | 47 | import javax.swing.JComboBox; 48 | import javax.swing.JLabel; 49 | import javax.swing.JPanel; 50 | 51 | import bilib.commons.components.GridToolbar; 52 | import bilib.commons.components.SpinnerRangeDouble; 53 | import bilib.commons.job.runnable.Job; 54 | import bilib.commons.job.runnable.Pool; 55 | import bilib.commons.settings.Settings; 56 | import psf.PSF; 57 | 58 | /** 59 | * @author Hagai Kirshner 60 | */ 61 | 62 | public class BornWolfPSF extends PSF { 63 | 64 | private double ni_Default = 1.5; 65 | private SpinnerRangeDouble spnNI = new SpinnerRangeDouble(ni_Default, 0, 3, 0.1); 66 | private JComboBox cmbAccuracy = new JComboBox(new String[] { "Good", "Better", "Best" }); 67 | private double ni = ni_Default; 68 | private int accuracy = 0; 69 | 70 | public BornWolfPSF() { 71 | fullname = "Born & Wolf 3D Optical Model"; 72 | shortname = "BW"; 73 | } 74 | 75 | public void setParameters(double ni, int accuracy) { 76 | this.ni = ni; 77 | this.accuracy = accuracy; 78 | } 79 | 80 | @Override 81 | public String getDescription() { 82 | String desc = "

Born and Wolf

"; 83 | desc += "

This model describes the scalar-based "; 84 | desc += "diffraction that occurs in the microscope "; 85 | desc += "when the particle is in focus "; 86 | desc += "The imaging plane need not be in focus.

"; 87 | return desc; 88 | } 89 | 90 | @Override 91 | public String checkSize(int nx, int ny, int nz) { 92 | if (nz < 3) 93 | return ("nz should be greater than 3."); 94 | if (nx < 4) 95 | return ("nz should be greater than 4."); 96 | if (ny < 4) 97 | return ("nz should be greater than 4."); 98 | return ""; 99 | } 100 | 101 | @Override 102 | public void resetParameters() { 103 | spnNI.set(ni_Default); 104 | cmbAccuracy.setSelectedIndex(0); 105 | } 106 | 107 | @Override 108 | public void fetchParameters() { 109 | ni = spnNI.get(); 110 | accuracy = cmbAccuracy.getSelectedIndex(); 111 | } 112 | 113 | @Override 114 | public JPanel buildPanel(Settings settings) { 115 | GridToolbar pn = new GridToolbar(false); 116 | pn.place(03, 0, "Refractive index immersion"); 117 | pn.place(06, 0, "Accuracy computation"); 118 | 119 | pn.place(03, 1, spnNI); 120 | pn.place(06, 1, cmbAccuracy); 121 | 122 | pn.place(03, 2, new JLabel("ni")); 123 | JPanel panel = new JPanel(); 124 | panel.add(pn); 125 | settings.record("psf-" + shortname + "-NI", spnNI, "" + ni_Default); 126 | settings.record("psf-" + shortname + "-accuracy", cmbAccuracy, (String) cmbAccuracy.getItemAt(0)); 127 | return panel; 128 | } 129 | 130 | @Override 131 | public void generate(Pool pool) { 132 | for (int z = 0; z < nz; z++) { 133 | double defocus = resAxial * 1E-9 * (z - (nz - 1.0) / 2.0); 134 | BornWolf plane = new BornWolf(z, defocus); 135 | plane.addMonitor(this); 136 | pool.register(plane); 137 | } 138 | } 139 | 140 | public class BornWolf extends Job { 141 | 142 | private int OVER_SAMPLING = 1; 143 | private int z; 144 | private double defocus; 145 | 146 | public BornWolf(int z, double defocus) { 147 | this.z = z; 148 | this.defocus = defocus; 149 | } 150 | 151 | @Override 152 | public void process() { 153 | 154 | // The center of the image in units of [pixels] 155 | double x0 = (nx - 1) / 2.0; 156 | double y0 = (ny - 1) / 2.0; 157 | 158 | // Lateral particle position in units of [pixels] 159 | double xp = x0; 160 | double yp = y0; 161 | 162 | // Radial locations. 163 | // double xpAbs = Math.abs(xp), ypAbs = Math.abs(yp); 164 | // double maxRadialDistanceInPixels = 165 | // Math.round(Math.sqrt((xpAbs+nx-x0)*(xpAbs+nx-x0)+(ypAbs+ny-y0)*(ypAbs+ny-y0)))+1; 166 | int maxRadius = ((int) Math.round(Math.sqrt((nx - x0) * (nx - x0) + (ny - y0) * (ny - y0)))) + 1; 167 | double[] r = new double[maxRadius * OVER_SAMPLING]; 168 | double[] h = new double[r.length]; 169 | 170 | KirchhoffDiffractionSimpson I = new KirchhoffDiffractionSimpson(defocus, ni, accuracy, NA, lambda); 171 | 172 | for (int n = 0; n < r.length; n++) { 173 | r[n] = ((double) n) / ((double) OVER_SAMPLING); 174 | h[n] = I.calculate(r[n] * resLateral * 1E-9); 175 | if (!live) 176 | return; 177 | } 178 | 179 | // Linear interpolation of the pixels values 180 | double[] slice = new double[nx * ny]; 181 | for (int x = 0; x < nx; x++) { 182 | for (int y = 0; y < ny; y++) { 183 | // radius of the current pixel in units of [pixels] 184 | double rPixel = Math.sqrt((x - xp) * (x - xp) + (y - yp) * (y - yp)); 185 | // Index of nearest coordinate from bellow 186 | int index = (int) Math.floor(rPixel * OVER_SAMPLING); 187 | // Interpolated value. 188 | slice[x + nx * y] = h[index] + (h[index + 1] - h[index]) * (rPixel - r[index]) * OVER_SAMPLING; 189 | } 190 | if (!live) 191 | return; 192 | } 193 | 194 | increment(90.0 / nz, "" + z + " / " + nz); 195 | data.data[z] = slice; 196 | 197 | } 198 | } 199 | } -------------------------------------------------------------------------------- /src/psf/bornwolf/KirchhoffDiffractionSimpson.java: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * PSFGenerator 4 | * 5 | * Authors: Daniel Sage and Hagai Kirshner 6 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 7 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 8 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 9 | * 10 | * References: 11 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 12 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 13 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 14 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 15 | * 16 | * [2] A. Griffa, N. Garin, D. Sage 17 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 18 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 19 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 20 | * 21 | * Conditions of use: 22 | * Conditions of use: You are free to use this software for research or 23 | * educational purposes. In addition, we expect you to include adequate 24 | * citations and acknowledgments whenever you present or publish results that 25 | * are based on it. 26 | */ 27 | 28 | /** 29 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 30 | * 31 | * This file is part of PSFGenerator. 32 | * 33 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 34 | * terms of the GNU General Public License as published by the Free Software 35 | * Foundation, either version 3 of the License, or (at your option) any later 36 | * version. 37 | * 38 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 39 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 40 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 41 | * 42 | * You should have received a copy of the GNU General Public License along with 43 | * PSFGenerator. If not, see . 44 | */ 45 | 46 | package psf.bornwolf; 47 | 48 | import bilib.commons.math.bessel.Bessel; 49 | 50 | /** 51 | * @author Hagai Kirshner 52 | */ 53 | public class KirchhoffDiffractionSimpson { 54 | 55 | // Difference between consecutive Riemann approximations. 56 | private double TOL = 1E-1; 57 | // The number of consecutive approximations that meet the TOL criterion 58 | private int K; 59 | private double NA = 1.4; 60 | private double lambda = 610; 61 | private double defocus = 1; 62 | private double ni = 1.5; 63 | 64 | // Constructor 65 | public KirchhoffDiffractionSimpson(double defocus, double ni, int accuracy, double NA, double lambda) { 66 | this.NA = NA; 67 | this.lambda = lambda; 68 | this.defocus = defocus; 69 | this.ni = ni; 70 | if (accuracy == 0) 71 | K = 5; 72 | else if (accuracy == 1) 73 | K = 7; 74 | else if (accuracy == 2) 75 | K = 9; 76 | else 77 | K = 3; 78 | } 79 | 80 | // calculate() 81 | // Simpson approximation for the Kirchhoff diffraction integral 82 | // 'r' is the radial distance of the detector relative to the optical axis. 83 | double calculate(double r) { 84 | // IJ.log("(p.ti0, p.ti) = (" + p.ti0 + ", " + p.ti + ")"); 85 | int N; // number of sub-intervals 86 | int k; // number of consecutive successful approximations 87 | double del; // integration interval 88 | int iteration; // number of iterations. 89 | double curDifference; // Stopping criterion 90 | 91 | double realSum, imagSum, rho; 92 | double[] sumOddIndex = new double[2], sumEvenIndex = new double[2]; 93 | double[] valueX0 = new double[2], valueXn = new double[2]; 94 | double[] value = new double[2]; 95 | 96 | double curI = 0.0, prevI = 0.0; 97 | 98 | // Initialization of the Simpson sum (first iteration) 99 | N = 2; 100 | del = 0.5; 101 | k = 0; 102 | iteration = 1; 103 | rho = 0.5; 104 | sumOddIndex = this.integrand(rho, r); 105 | sumEvenIndex[0] = 0.0; 106 | sumEvenIndex[1] = 0.0; 107 | 108 | valueX0 = this.integrand(0.0, r); 109 | valueXn = this.integrand(1.0, r); 110 | 111 | realSum = valueX0[0] + 2.0 * sumEvenIndex[0] + 4.0 * sumOddIndex[0] + valueXn[0]; 112 | imagSum = valueX0[1] + 2.0 * sumEvenIndex[1] + 4.0 * sumOddIndex[1] + valueXn[1]; 113 | curI = (realSum * realSum + imagSum * imagSum) * del * del; 114 | 115 | prevI = curI; 116 | curDifference = TOL; 117 | 118 | // Finer sampling grid until we meet the TOL value with the specified 119 | // number of repetitions, K 120 | while (k < K && iteration < 10000) { 121 | iteration++; 122 | N *= 2; 123 | del = del / 2; 124 | sumEvenIndex[0] = sumEvenIndex[0] + sumOddIndex[0]; 125 | sumEvenIndex[1] = sumEvenIndex[1] + sumOddIndex[1]; 126 | sumOddIndex[0] = 0.0; 127 | sumOddIndex[1] = 0.0; 128 | for (int n = 1; n < N; n = n + 2) { 129 | rho = n * del; 130 | value = this.integrand(rho, r); 131 | sumOddIndex[0] += value[0]; 132 | sumOddIndex[1] += value[1]; 133 | } 134 | realSum = valueX0[0] + 2.0 * sumEvenIndex[0] + 4.0 * sumOddIndex[0] + valueXn[0]; 135 | imagSum = valueX0[1] + 2.0 * sumEvenIndex[1] + 4.0 * sumOddIndex[1] + valueXn[1]; 136 | curI = (realSum * realSum + imagSum * imagSum) * del * del; 137 | 138 | // Relative error between consecutive approximations 139 | if (prevI == 0.0) 140 | curDifference = Math.abs((prevI - curI) / 1E-5); 141 | else 142 | curDifference = Math.abs((prevI - curI) / curI); 143 | 144 | if (curDifference <= TOL) 145 | k++; 146 | else 147 | k = 0; 148 | 149 | prevI = curI; 150 | } 151 | 152 | return curI; 153 | } 154 | 155 | private double[] integrand(double rho, double r) { 156 | 157 | // 'rho' is the integration parameter. 158 | // 'r' is the radial distance of the detector relative to the optical 159 | // axis. 160 | // NA is assumed to be less than 1.0, i.e. it assumed to be already 161 | // normalized by the refractive index of the immersion layer, ni. 162 | // The return value is a complex number. 163 | 164 | double k0 = 2 * Math.PI / lambda; 165 | double BesselValue = Bessel.J0(k0 * NA * r * rho); 166 | 167 | double OPD; // Optical path difference 168 | double W; // Phase aberrations. 169 | double[] I = new double[2]; 170 | 171 | OPD = NA * NA * defocus * rho * rho / (2.0 * ni); 172 | W = k0 * OPD; 173 | 174 | // The real part 175 | I[0] = BesselValue * Math.cos(W) * rho; 176 | // The imaginary part 177 | I[1] = -BesselValue * Math.sin(W) * rho; 178 | 179 | return I; 180 | } 181 | } -------------------------------------------------------------------------------- /src/psf/defocusplane/ZFunction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psf.defocusplane; 46 | 47 | public class ZFunction { 48 | 49 | final static public int ZFUNC_LINEAR = 0; 50 | final static public int ZFUNC_EXPO = 1; 51 | final static public int ZFUNC_PARABOLIC = 2; 52 | final static public int ZFUNC_CONSTANT = 3; 53 | 54 | static public String[] names = new String[] { "Linear", "Exponential","Parabolic", "Constant" }; 55 | 56 | private int func1D = 1; 57 | private double zdefocus = 1.0; 58 | private double zfocal = 1.0; 59 | 60 | public ZFunction(int func1D, double zdefocus, double zfocal) { 61 | this.func1D = func1D; 62 | this.zdefocus = zdefocus; 63 | this.zfocal = zfocal; 64 | } 65 | 66 | public double getDefocusFactor(double z) { 67 | double zf = z - zfocal; 68 | double za = (zf < 0 ? -zf : zf); 69 | switch (func1D) { 70 | case ZFUNC_EXPO: 71 | double K = 0.69314718056; // log(0.5) 72 | return Math.exp(-za * K / (zdefocus-zfocal)); 73 | 74 | case ZFUNC_PARABOLIC: 75 | return 1.0 + (za*za) / ((zdefocus - zfocal) * (zdefocus - zfocal)); 76 | 77 | case ZFUNC_CONSTANT: 78 | return 1.0; 79 | 80 | case ZFUNC_LINEAR: 81 | return 1.0 + za / Math.abs(zdefocus - zfocal); 82 | } 83 | return 1.0; 84 | } 85 | 86 | public String getName() { 87 | return names[func1D]; 88 | } 89 | 90 | @Override 91 | public String toString() { 92 | return names[func1D] + " " + zfocal + " " + zdefocus; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/psf/defocusplane/lateral/Astigmatism.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psf.defocusplane.lateral; 46 | 47 | public class Astigmatism extends LateralFunction { 48 | 49 | private double sigma; 50 | private double kx; 51 | private double ky; 52 | 53 | public Astigmatism(double radius, double defocusFactor) { 54 | super(); 55 | this.sigma = 0.8493218 * radius; // 1/sqrt(-2*log(0.5)) 56 | double dy = defocusFactor * 1.5 - 1; 57 | double dx = 1.0 / dy; 58 | this.kx = 1.0 / (dx * dx * sigma * sigma * 2.0); 59 | this.ky = 1.0 / (dy * dy * sigma * sigma * 2.0); 60 | } 61 | 62 | @Override 63 | public double eval(double x, double y) { 64 | return Math.exp(-x * x * kx - y * y * ky); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/psf/defocusplane/lateral/CardinalSin.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psf.defocusplane.lateral; 46 | 47 | public class CardinalSin extends LateralFunction { 48 | 49 | private double size; 50 | 51 | public CardinalSin(double radius, double defocusFactor) { 52 | super(); 53 | this.size = radius * defocusFactor; 54 | } 55 | 56 | @Override 57 | public double eval(double x, double y) { 58 | double r = Math.PI * Math.sqrt(x * x + y * y) / size; 59 | if (r <= 10e-6) 60 | return 1; 61 | return Math.sin(r) / r; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/psf/defocusplane/lateral/CircularPupil.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psf.defocusplane.lateral; 46 | 47 | public class CircularPupil extends LateralFunction { 48 | 49 | private double size; 50 | 51 | public CircularPupil(double radius, double defocusFactor) { 52 | super(); 53 | this.size = radius * defocusFactor; 54 | } 55 | 56 | @Override 57 | public double eval(double x, double y) { 58 | double r = x * x + y * y; 59 | if (r < size * size) 60 | return 1.0; 61 | return 0.0; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/psf/defocusplane/lateral/Cosine.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psf.defocusplane.lateral; 46 | 47 | public class Cosine extends LateralFunction { 48 | 49 | private double freq = Math.PI * 0.5; 50 | 51 | private double size = 1.0; 52 | 53 | public Cosine(double radius, double defocusFactor) { 54 | super(); 55 | this.size = radius * defocusFactor; 56 | } 57 | 58 | @Override 59 | public double eval(double x, double y) { 60 | if (size < 0.0000001) 61 | return 0; 62 | double r = Math.sqrt(x * x + y * y) / size; 63 | return Math.max(0, Math.cos(r * freq)); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/psf/defocusplane/lateral/DoubleHelix.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psf.defocusplane.lateral; 46 | 47 | public class DoubleHelix extends LateralFunction { 48 | 49 | private double radius; 50 | private double sigma; 51 | private double kgauss; 52 | private double cosa; 53 | private double sina; 54 | 55 | public DoubleHelix(double radius, double defocusFactor) { 56 | super(); 57 | this.radius = radius; 58 | this.sigma = 0.25 * radius; 59 | this.kgauss = 1.0 / (sigma * sigma * 2.0); 60 | this.cosa = Math.cos(defocusFactor); 61 | this.sina = Math.sin(defocusFactor); 62 | } 63 | 64 | @Override 65 | public double eval(double x, double y) { 66 | double u = x * cosa + y * sina; 67 | double v = -x * sina + y * cosa; 68 | double u1 = (u - radius * 0.5); 69 | double u2 = (u + radius * 0.5); 70 | return Math.exp(-((u1 * u1 + v * v) * kgauss)) + Math.exp(-((u2 * u2 + v * v) * kgauss)); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/psf/defocusplane/lateral/Gaussian.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psf.defocusplane.lateral; 46 | 47 | public class Gaussian extends LateralFunction { 48 | 49 | private double sigma; 50 | private double k; 51 | 52 | public Gaussian(double radius, double defocusFactor) { 53 | super(); 54 | sigma = radius; 55 | this.k = 1.0 / (defocusFactor * defocusFactor * sigma * sigma * 2.0); 56 | } 57 | 58 | @Override 59 | public double eval(double x, double y) { 60 | double r = x * x + y * y; 61 | return Math.exp(-r * k); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/psf/defocusplane/lateral/LateralFunction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psf.defocusplane.lateral; 46 | 47 | public abstract class LateralFunction { 48 | 49 | abstract public double eval(double x, double y); 50 | } 51 | -------------------------------------------------------------------------------- /src/psf/defocusplane/lateral/Lorentz.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psf.defocusplane.lateral; 46 | 47 | public class Lorentz extends LateralFunction { 48 | 49 | private double klorentz; 50 | 51 | public Lorentz(double radius, double defocusFactor) { 52 | super(); 53 | klorentz = Math.sqrt(0.5) / (defocusFactor * radius); 54 | klorentz = klorentz * klorentz; 55 | } 56 | 57 | @Override 58 | public double eval(double x, double y) { 59 | double r = x * x + y * y; 60 | return 1.0 / (1.0 + r * klorentz); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/psf/defocusplane/lateral/OrientedGaussian.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psf.defocusplane.lateral; 46 | 47 | public class OrientedGaussian extends LateralFunction { 48 | 49 | private double elongation = 2.0; 50 | 51 | private double cosa; 52 | private double sina; 53 | private double kgaussU; 54 | private double kgaussV; 55 | 56 | public OrientedGaussian(double sigma, double defocusFactor) { 57 | super(); 58 | this.kgaussU = 1.0 / (sigma * sigma * elongation); 59 | this.kgaussV = 1.0 / (sigma * sigma / elongation); 60 | this.cosa = Math.cos(defocusFactor); 61 | this.sina = Math.sin(defocusFactor); 62 | } 63 | 64 | @Override 65 | public double eval(double x, double y) { 66 | double u = x * cosa + y * sina; 67 | double v = -x * sina + y * cosa; 68 | u = u * u * kgaussU; 69 | v = v * v * kgaussV; 70 | return Math.exp(-(u + v)); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/psf/gibsonlanni/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 53 4 | /svn/psfgenerator/!svn/ver/32/PSFGenerator/src/psf/gl 5 | END 6 | KirchhoffDiffractionRiemann.java 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 86 10 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/gl/KirchhoffDiffractionRiemann.java 11 | END 12 | GibsonLanniParameters.java 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 80 16 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/gl/GibsonLanniParameters.java 17 | END 18 | KirchhoffDiffractionSimpson.java 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 86 22 | /svn/psfgenerator/!svn/ver/32/PSFGenerator/src/psf/gl/KirchhoffDiffractionSimpson.java 23 | END 24 | GibsonLanni.java 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 70 28 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/gl/GibsonLanni.java 29 | END 30 | GibsonLanniPSF.java 31 | K 25 32 | svn:wc:ra_dav:version-url 33 | V 73 34 | /svn/psfgenerator/!svn/ver/32/PSFGenerator/src/psf/gl/GibsonLanniPSF.java 35 | END 36 | -------------------------------------------------------------------------------- /src/psf/gibsonlanni/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 32 5 | https://svn.epfl.ch/svn/psfgenerator/PSFGenerator/src/psf/gl 6 | https://svn.epfl.ch/svn/psfgenerator 7 | 8 | 9 | 10 | 2012-11-27T10:25:13.249218Z 11 | 32 12 | kirshner 13 | 14 | 15 | svn:special svn:externals svn:needs-lock 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28c35a94-be80-47a4-8420-aa990001146c 28 | 29 | GibsonLanni.java 30 | file 31 | 32 | 33 | 34 | 35 | 2012-11-27T10:45:32.000000Z 36 | 521efdf8c4fe85ac3b086efd2832e58b 37 | 2012-07-05T06:31:32.932295Z 38 | 29 39 | dsage 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 3350 62 | 63 | GibsonLanniPSF.java 64 | file 65 | 66 | 67 | 68 | 69 | 2012-11-27T10:45:32.000000Z 70 | 210afcf992d97afe3384b0396fa8b927 71 | 2012-11-27T10:25:13.249218Z 72 | 32 73 | kirshner 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 7287 96 | 97 | GibsonLanniParameters.java 98 | file 99 | 100 | 101 | 102 | 103 | 2012-11-27T10:45:32.000000Z 104 | d9b2c69bb5b9f358734443db3d007d58 105 | 2012-07-05T06:31:32.932295Z 106 | 29 107 | dsage 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 2789 130 | 131 | KirchhoffDiffractionRiemann.java 132 | file 133 | 134 | 135 | 136 | 137 | 2012-11-27T10:45:32.000000Z 138 | 716305ea87f63d585afe24ecc9c00b95 139 | 2012-07-05T06:31:32.932295Z 140 | 29 141 | dsage 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 4636 164 | 165 | KirchhoffDiffractionSimpson.java 166 | file 167 | 168 | 169 | 170 | 171 | 2012-11-27T10:45:32.000000Z 172 | 64fa7b8bbacbea88b1b5970454dbfd3e 173 | 2012-11-27T10:25:13.249218Z 174 | 32 175 | kirshner 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 5472 198 | 199 | -------------------------------------------------------------------------------- /src/psf/gibsonlanni/.svn/text-base/GibsonLanni.java.svn-base: -------------------------------------------------------------------------------- 1 | //===================================================================================== 2 | // Project: PSF Generator 3 | // 4 | // Organization: Biomedical Imaging Group (BIG) 5 | // Ecole Polytechnique Federale de Lausanne (EPFL) 6 | // Lausanne, Switzerland 7 | // 8 | // Information: http://bigwww.epfl.ch/deconvolution/ 9 | // 10 | // Reference: 11 | // Alessandra Griffa, Nathalie Garin, Daniel Sage, 12 | // Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 13 | // G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 14 | // Available: http://bigwww.epfl.ch/publications/griffa1001.html 15 | // 16 | // Conditions of use: 17 | // You'll be free to use this software for research purposes, but you 18 | // should not redistribute it without our consent. In addition, we 19 | // expect you to include a citation or acknowledgment whenever 20 | // you present or publish results that are based on it. 21 | //===================================================================================== 22 | 23 | 24 | package psf.gl; 25 | 26 | 27 | import imageware.Builder; 28 | import imageware.ImageWare; 29 | 30 | /** 31 | * This class generates the Gibson-Lanni PSF. 32 | * 33 | * @author Hagai Kirshner, Biomedical Imaging Group, Ecole Polytechnique Federale de Lausanne (EPFL) 34 | */ 35 | public class GibsonLanni implements Runnable { 36 | 37 | static int OVER_SAMPLING = 2; 38 | 39 | private GibsonLanniPSF glPSF; 40 | private GibsonLanniParameters p; 41 | private int nx; 42 | private int ny; 43 | private int z; 44 | 45 | /** 46 | * Constructor. 47 | */ 48 | public GibsonLanni(GibsonLanniPSF glPSF, int z) { 49 | this.glPSF = glPSF; 50 | this.nx = glPSF.nx; 51 | this.ny = glPSF.ny; 52 | this.z = z; 53 | // making a new copy of the parameters is required, as different threads use different "ti" values. 54 | this.p = new GibsonLanniParameters(glPSF.p); 55 | } 56 | 57 | /** 58 | * Creates a 2D PSF image at a specified z location. 59 | */ 60 | public void run() { 61 | 62 | // The center of the image in units of [pixels] 63 | double x0 = (nx-1)/2.0; 64 | double y0 = (ny-1)/2.0; 65 | 66 | // Lateral particle position in units of [pixels] 67 | double xp = x0;// 0.0/p.pixelSize; 68 | double yp = y0;// 0.0/p.pixelSize; 69 | 70 | // Radial locations. 71 | // double xpAbs = Math.abs(xp), ypAbs = Math.abs(yp); 72 | // double maxRadialDistanceInPixels = Math.round(Math.sqrt((xpAbs+nx-x0)*(xpAbs+nx-x0)+(ypAbs+ny-y0)*(ypAbs+ny-y0)))+1; 73 | int maxRadius = ((int) Math.round(Math.sqrt((nx-x0)*(nx-x0)+(ny-y0)*(ny-y0))))+1; 74 | double[] r = new double[maxRadius*OVER_SAMPLING]; 75 | double[] h = new double[r.length]; 76 | 77 | KirchhoffDiffractionSimpson I = new KirchhoffDiffractionSimpson(p, glPSF.accuracy); 78 | for (int n=0; n1) 149 | IJ.log("p.NA*rho/p.ns is bigger than 1. (ns,NA,rho)=(" + p.ns + ", " + p.NA + ", " + rho); 150 | 151 | // Saving some computation time 152 | OPD1 = p.ns*p.particleAxialPosition*Math.sqrt(1-(p.NA*rho/p.ns)*(p.NA*rho/p.ns)); 153 | OPD3 = p.ni*(p.ti-p.ti0)*Math.sqrt(1-(p.NA*rho/p.ni)*(p.NA*rho/p.ni)); 154 | OPD = OPD1+OPD3; 155 | 156 | double W = k0*OPD; 157 | 158 | // The real part 159 | I[0] = BesselValue*Math.cos(W)*rho; 160 | // The imaginary part 161 | I[1] = BesselValue*Math.sin(W)*rho; 162 | 163 | return I; 164 | } 165 | } 166 | 167 | -------------------------------------------------------------------------------- /src/psf/gibsonlanni/GibsonLanniParameters.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psf.gibsonlanni; 46 | 47 | public class GibsonLanniParameters { 48 | 49 | /** 50 | * Working distance of the objective (design value). This is also the width 51 | * of the immersion layer. 52 | */ 53 | public double ti0; 54 | 55 | /** 56 | * Working distance of the objective (experimental value). influenced by the 57 | * stage displacement. 58 | */ 59 | public double ti; 60 | 61 | /** Immersion medium refractive index (design value). */ 62 | public double ni0; 63 | 64 | /** Immersion medium refractive index (experimental value). */ 65 | public double ni; 66 | 67 | /** Coverslip thickness (design value). */ 68 | public double tg0; 69 | 70 | /** Coverslip thickness (experimental value). */ 71 | public double tg; 72 | 73 | /** Coverslip refractive index (design value). */ 74 | public double ng0 = 1.5; 75 | 76 | /** Coverslip refractive index (experimental value). */ 77 | public double ng = 1.5; 78 | 79 | /** Sample refractive index. */ 80 | public double ns; 81 | 82 | /** Axial position of the particle. */ 83 | public double particleAxialPosition; 84 | 85 | public GibsonLanniParameters() { 86 | } 87 | 88 | public GibsonLanniParameters(GibsonLanniParameters p) { 89 | this.ng = p.ng; 90 | this.ng0 = p.ng0; 91 | this.ni = p.ni; 92 | this.ni0 = p.ni0; 93 | this.ns = p.ns; 94 | this.particleAxialPosition = p.particleAxialPosition; 95 | this.tg = p.tg; 96 | this.tg0 = p.tg0; 97 | this.ti = p.ti; 98 | this.ti0 = p.ti0; 99 | } 100 | } -------------------------------------------------------------------------------- /src/psf/gibsonlanni/KirchhoffDiffractionRiemann.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psf.gibsonlanni; 46 | 47 | import bilib.commons.math.bessel.Bessel; 48 | 49 | /** 50 | * @author Hagai Kirshner 51 | */ 52 | public class KirchhoffDiffractionRiemann { 53 | 54 | // Gibson & Lanni parameters of the acquisition 55 | private GibsonLanniParameters p; 56 | 57 | // Stopping conditions: 58 | // Difference between consecutive Riemann approximations. 59 | private double TOL = 1E-1; 60 | // The number of consecutive approximations that meet the TOL criterion 61 | private int K; 62 | private double NA = 1.4; 63 | private double lambda = 610; 64 | 65 | // Constructor 66 | public KirchhoffDiffractionRiemann(GibsonLanniParameters p, int accuracy, double NA, double lambda) { 67 | this.NA = NA; 68 | this.lambda = lambda; 69 | this.p = p; 70 | if (accuracy == 0) 71 | K = 3; 72 | else if (accuracy == 1) 73 | K = 5; 74 | else if (accuracy == 2) 75 | K = 7; 76 | else 77 | K = 3; 78 | } 79 | 80 | // calculate() 81 | // Riemann approximation for the Kirchhoff diffraction integral 82 | // 'r' is the radial distance of the detector relative to the optical axis. 83 | double calculate(double r) { 84 | 85 | // IJ.log("(p.ti0, p.ti) = (" + p.ti0 + ", " + p.ti + ")"); 86 | double a = 0.0, b = 1.0; // Lower and upper limits of the integral 87 | int N; // number of sub-intervals 88 | int k; // number of consecutive successful approximations 89 | double del; // integration interval 90 | int iteration; // number of iterations. 91 | double curDifference; // Stopping criterion 92 | 93 | double realSum, imagSum, rho; 94 | double[] value = new double[2]; 95 | 96 | double curI = 0.0, prevI = 0.0; 97 | 98 | // Initialization of the Riemann sum (first iteration) 99 | N = 1; 100 | del = 1; 101 | k = 0; 102 | iteration = 1; 103 | rho = 0.0; 104 | value = this.integrand(rho, r); // left Riemann sum 105 | realSum = value[0]; 106 | imagSum = value[1]; 107 | curI = (realSum * realSum + imagSum * imagSum); 108 | prevI = curI; 109 | curDifference = TOL; 110 | 111 | // Finer sampling grid until we meet the TOL value with the specified 112 | // number of repetitions, K 113 | while (k < K && iteration < 10000) { 114 | iteration++; 115 | N *= 2; 116 | // Riemann sum: right Riemann sum 117 | del = (b - a) / N; 118 | for (int n = 1; n < N; n = n + 2) { 119 | rho = n * del; 120 | value = this.integrand(rho, r); 121 | realSum += value[0]; 122 | imagSum += value[1]; 123 | } 124 | curI = (realSum * realSum + imagSum * imagSum) * del * del; 125 | 126 | // Relative error between consecutive approximations 127 | if (prevI == 0.0) 128 | curDifference = Math.abs((prevI - curI) / 1E-5); 129 | else 130 | curDifference = Math.abs((prevI - curI) / curI); 131 | 132 | if (curDifference <= TOL) 133 | k++; 134 | else 135 | k = 0; 136 | 137 | prevI = curI; 138 | } 139 | return curI; 140 | } 141 | 142 | double[] integrand(double rho, double r) { 143 | 144 | // 'rho' is the integration parameter. 145 | // 'r' is the radial distance of the detector relative to the optical 146 | // axis. 147 | // NA is assumed to be less than 1.0, i.e. it assumed to be already 148 | // normalized by the refractive index of the immersion layer, ni. 149 | // The return value is a complex number. 150 | 151 | double k0 = 2 * Math.PI / lambda; 152 | double BesselValue = Bessel.J0(k0 * NA * r * rho); 153 | 154 | double OPD, OPD1, OPD3; // Optical path differences 155 | double[] I = new double[2]; 156 | 157 | // OPD1 = 158 | // p.ns*p.particleAxialPosition*Math.sqrt(1-(p.NA*rho/p.ns)*(p.NA*rho/p.ns)); 159 | // OPD2 = p.ng*p.tg*Math.sqrt(1-(p.NA*rho/p.ng)*(p.NA*rho/p.ng)); 160 | // OPD3 = p.ni*p.ti*Math.sqrt(1-(p.NA*rho/p.ni)*(p.NA*rho/p.ni)); 161 | // OPD4 = -p.ng0*p.tg0*Math.sqrt(1-(p.NA*rho/p.ng0)*(p.NA*rho/p.ng0)); 162 | // OPD5 = -p.ni0*p.ti0*Math.sqrt(1-(p.NA*rho/p.ni0)*(p.NA*rho/p.ni0)); 163 | // OPD = OPD1+OPD2+OPD3+OPD4+OPD5; 164 | 165 | // Saving some computation time 166 | OPD1 = p.ns * p.particleAxialPosition * Math.sqrt(1 - (NA * rho / p.ns) * (NA * rho / p.ns)); 167 | OPD3 = p.ni * (p.ti - p.ti0) * Math.sqrt(1 - (NA * rho / p.ni) * (NA * rho / p.ni)); 168 | OPD = OPD1 + OPD3; 169 | 170 | double W = k0 * OPD; 171 | 172 | // The real part 173 | I[0] = BesselValue * Math.cos(W) * rho; 174 | // The imaginary part 175 | I[1] = BesselValue * Math.sin(W) * rho; 176 | 177 | return I; 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /src/psf/gibsonlanni/KirchhoffDiffractionSimpson.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psf.gibsonlanni; 46 | 47 | import bilib.commons.math.bessel.Bessel; 48 | 49 | /** 50 | * @author Hagai Kirshner 51 | */ 52 | public class KirchhoffDiffractionSimpson { 53 | 54 | // Gibson & Lanni parameters of the acquisition 55 | private GibsonLanniParameters p; 56 | 57 | // Stopping conditions: 58 | // Difference between consecutive Riemann approximations. 59 | double TOL = 1E-1; 60 | // The number of consecutive approximations that meet the TOL criterion 61 | int K; 62 | 63 | private double NA = 1.4; 64 | private double lambda = 610; 65 | 66 | // Constructor 67 | public KirchhoffDiffractionSimpson(GibsonLanniParameters p, int accuracy, double NA, double lambda) { 68 | this.p = new GibsonLanniParameters(p); 69 | this.NA = NA; 70 | this.lambda = lambda; 71 | if (accuracy == 0) 72 | K = 4; 73 | else if (accuracy == 1) 74 | K = 5; 75 | else if (accuracy == 2) 76 | K = 6; 77 | else 78 | K = 3; 79 | } 80 | 81 | // calculate() 82 | // Simpson approximation for the Kirchhoff diffraction integral 83 | // 'r' is the radial distance of the detector relative to the optical axis. 84 | double calculate(double r) { 85 | double a = 0.0; // Lower and upper limits of the integral 86 | double b = Math.min(1, p.ns / NA); // 1.0 87 | int N; // number of sub-intervals 88 | int k; // number of consecutive successful approximations 89 | double del; // integration interval 90 | int iteration; // number of iterations. 91 | double curDifference; // Stopping criterion 92 | 93 | double realSum, imagSum, rho; 94 | double[] sumOddIndex = new double[2], sumEvenIndex = new double[2]; 95 | double[] valueX0 = new double[2], valueXn = new double[2]; 96 | double[] value = new double[2]; 97 | 98 | double curI = 0.0, prevI = 0.0; 99 | 100 | // Initialization of the Simpson sum (first iteration) 101 | N = 2; 102 | del = (b - a) / 2.0; 103 | k = 0; 104 | iteration = 1; 105 | rho = (b - a) / 2.0; 106 | sumOddIndex = this.integrand(rho, r); 107 | sumEvenIndex[0] = 0.0; 108 | sumEvenIndex[1] = 0.0; 109 | 110 | valueX0 = this.integrand(a, r); 111 | valueXn = this.integrand(b, r); 112 | 113 | realSum = valueX0[0] + 2.0 * sumEvenIndex[0] + 4.0 * sumOddIndex[0] + valueXn[0]; 114 | imagSum = valueX0[1] + 2.0 * sumEvenIndex[1] + 4.0 * sumOddIndex[1] + valueXn[1]; 115 | curI = (realSum * realSum + imagSum * imagSum) * del * del; 116 | 117 | prevI = curI; 118 | curDifference = TOL; 119 | 120 | // Finer sampling grid until we meet the TOL value with the specified 121 | // number of repetitions, K 122 | while (k < K && iteration < 10000) { 123 | iteration++; 124 | N *= 2; 125 | del = del / 2; 126 | sumEvenIndex[0] = sumEvenIndex[0] + sumOddIndex[0]; 127 | sumEvenIndex[1] = sumEvenIndex[1] + sumOddIndex[1]; 128 | sumOddIndex[0] = 0.0; 129 | sumOddIndex[1] = 0.0; 130 | for (int n = 1; n < N; n = n + 2) { 131 | rho = n * del; 132 | value = this.integrand(rho, r); 133 | sumOddIndex[0] += value[0]; 134 | sumOddIndex[1] += value[1]; 135 | } 136 | realSum = valueX0[0] + 2.0 * sumEvenIndex[0] + 4.0 * sumOddIndex[0] + valueXn[0]; 137 | imagSum = valueX0[1] + 2.0 * sumEvenIndex[1] + 4.0 * sumOddIndex[1] + valueXn[1]; 138 | curI = (realSum * realSum + imagSum * imagSum) * del * del; 139 | 140 | // Relative error between consecutive approximations 141 | if (prevI == 0.0) 142 | curDifference = Math.abs((prevI - curI) / 1E-5); 143 | else 144 | curDifference = Math.abs((prevI - curI) / curI); 145 | 146 | if (curDifference <= TOL) 147 | k++; 148 | else 149 | k = 0; 150 | 151 | prevI = curI; 152 | } 153 | return curI; 154 | } 155 | 156 | double[] integrand(double rho, double r) { 157 | 158 | // 'rho' is the integration parameter. 159 | // 'r' is the radial distance of the detector relative to the optical 160 | // axis. 161 | // NA is assumed to be less than 1.0, i.e. it assumed to be already 162 | // normalized by the refractive index of the immersion layer, ni. 163 | // The return value is a complex number. 164 | 165 | double k0 = 2 * Math.PI / lambda; 166 | double BesselValue = Bessel.J0(k0 * NA * r * rho); 167 | 168 | double OPD, OPD1, OPD3; // Optical path differences 169 | double[] I = new double[2]; 170 | 171 | if ((NA * rho / p.ns) > 1) 172 | System.out.println("p.NA*rho/p.ns is bigger than 1. (ns,NA,rho)=(" + p.ns + ", " + NA + ", " + rho); 173 | 174 | // Saving some computation time 175 | OPD1 = p.ns * p.particleAxialPosition * Math.sqrt(1 - (NA * rho / p.ns) * (NA * rho / p.ns)); 176 | OPD3 = p.ni * (p.ti - p.ti0) * Math.sqrt(1 - (NA * rho / p.ni) * (NA * rho / p.ni)); 177 | OPD = OPD1 + OPD3; 178 | 179 | double W = k0 * OPD; 180 | 181 | // The real part 182 | I[0] = BesselValue * Math.cos(W) * rho; 183 | // The imaginary part 184 | I[1] = BesselValue * Math.sin(W) * rho; 185 | 186 | return I; 187 | } 188 | } 189 | -------------------------------------------------------------------------------- /src/psf/richardswolf/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 53 4 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/rw 5 | END 6 | RichardsWolf.java 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 71 10 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/rw/RichardsWolf.java 11 | END 12 | RichardsWolfParameters.java 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 81 16 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/rw/RichardsWolfParameters.java 17 | END 18 | KirchhoffDiffractionSimpson.java 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 86 22 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/rw/KirchhoffDiffractionSimpson.java 23 | END 24 | RichardsWolfPSF.java 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 74 28 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/rw/RichardsWolfPSF.java 29 | END 30 | -------------------------------------------------------------------------------- /src/psf/richardswolf/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 32 5 | https://svn.epfl.ch/svn/psfgenerator/PSFGenerator/src/psf/rw 6 | https://svn.epfl.ch/svn/psfgenerator 7 | 8 | 9 | 10 | 2012-07-05T06:31:32.932295Z 11 | 29 12 | dsage 13 | 14 | 15 | svn:special svn:externals svn:needs-lock 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28c35a94-be80-47a4-8420-aa990001146c 28 | 29 | KirchhoffDiffractionSimpson.java 30 | file 31 | 32 | 33 | 34 | 35 | 2012-11-27T10:45:32.000000Z 36 | e3fadfea65061e5decb70512efc97dac 37 | 2012-07-05T06:31:32.932295Z 38 | 29 39 | dsage 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 8410 62 | 63 | RichardsWolf.java 64 | file 65 | 66 | 67 | 68 | 69 | 2012-11-27T10:45:32.000000Z 70 | 4fa0c851e41c256a0f5506d1cad742e3 71 | 2012-07-05T06:31:32.932295Z 72 | 29 73 | dsage 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 3563 96 | 97 | RichardsWolfPSF.java 98 | file 99 | 100 | 101 | 102 | 103 | 2012-11-27T10:45:32.000000Z 104 | 56e62e9aeefa402868941a9a937772e8 105 | 2012-07-05T06:31:32.932295Z 106 | 29 107 | dsage 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 10142 130 | 131 | RichardsWolfParameters.java 132 | file 133 | 134 | 135 | 136 | 137 | 2012-11-27T10:45:32.000000Z 138 | 7fbd84730f6a4ef7a6c8b6fc7d6481ca 139 | 2012-07-05T06:31:32.932295Z 140 | 29 141 | dsage 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 1718 164 | 165 | -------------------------------------------------------------------------------- /src/psf/richardswolf/.svn/text-base/RichardsWolf.java.svn-base: -------------------------------------------------------------------------------- 1 | //===================================================================================== 2 | // Project: PSF Generator 3 | // 4 | // Organization: Biomedical Imaging Group (BIG) 5 | // Ecole Polytechnique Federale de Lausanne (EPFL) 6 | // Lausanne, Switzerland 7 | // 8 | // Information: http://bigwww.epfl.ch/deconvolution/ 9 | // 10 | // Reference: 11 | // Alessandra Griffa, Nathalie Garin, Daniel Sage, 12 | // Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 13 | // G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 14 | // Available: http://bigwww.epfl.ch/publications/griffa1001.html 15 | // 16 | // Conditions of use: 17 | // You'll be free to use this software for research purposes, but you 18 | // should not redistribute it without our consent. In addition, we 19 | // expect you to include a citation or acknowledgment whenever 20 | // you present or publish results that are based on it. 21 | //===================================================================================== 22 | 23 | 24 | package psf.rw; 25 | 26 | import imageware.Builder; 27 | import imageware.ImageWare; 28 | 29 | /** 30 | * This class generates the Gibson-Lanni PSF. 31 | * 32 | * @author Hagai Kirshner, Biomedical Imaging Group, Ecole Polytechnique Federale de Lausanne (EPFL) 33 | */ 34 | public class RichardsWolf implements Runnable { 35 | 36 | static int OVER_SAMPLING = 2; 37 | 38 | private RichardsWolfPSF rwPSF; 39 | private RichardsWolfParameters p; 40 | private int nx; 41 | private int ny; 42 | private int z; 43 | private boolean running = false; 44 | 45 | /** 46 | * Constructor. 47 | */ 48 | public RichardsWolf(RichardsWolfPSF rwPSF, int z) { 49 | this.rwPSF = rwPSF; 50 | this.nx = rwPSF.nx; 51 | this.ny = rwPSF.ny; 52 | this.z = z; 53 | // making a new copy of the parameters is required, as different threads use different "ti" values. 54 | this.p = new RichardsWolfParameters(rwPSF.p); 55 | } 56 | 57 | public boolean isRunning() { 58 | return running; 59 | } 60 | 61 | /** 62 | * Creates a 2D PSF image at a specified z location. 63 | */ 64 | public void run() { 65 | 66 | 67 | running = true; 68 | 69 | // The center of the image in units of [pixels] 70 | double x0 = (nx-1)/2.0; 71 | double y0 = (ny-1)/2.0; 72 | 73 | // Lateral particle position in units of [pixels] 74 | double xp = x0;// 0.0/p.pixelSize; 75 | double yp = y0;// 0.0/p.pixelSize; 76 | 77 | // Radial locations. 78 | //double xpAbs = Math.abs(xp), ypAbs = Math.abs(yp); 79 | //double maxRadialDistanceInPixels = Math.round(Math.sqrt((xpAbs+nx-x0)*(xpAbs+nx-x0)+(ypAbs+ny-y0)*(ypAbs+ny-y0)))+1; 80 | int maxRadius = ((int) Math.round(Math.sqrt((nx-x0)*(nx-x0)+(ny-y0)*(ny-y0))))+1; 81 | double[] r = new double[maxRadius*OVER_SAMPLING]; 82 | double[] h = new double[r.length]; 83 | 84 | KirchhoffDiffractionSimpson I = new KirchhoffDiffractionSimpson(p,rwPSF.accuracy); 85 | //KirchhoffDiffraction I = new KirchhoffDiffraction(p,accuracy); 86 | for (int n=0; n. 43 | */ 44 | 45 | package psf.richardswolf; 46 | 47 | import javax.swing.JComboBox; 48 | import javax.swing.JLabel; 49 | import javax.swing.JPanel; 50 | 51 | import bilib.commons.components.GridToolbar; 52 | import bilib.commons.components.SpinnerRangeDouble; 53 | import bilib.commons.job.runnable.Job; 54 | import bilib.commons.job.runnable.Pool; 55 | import bilib.commons.settings.Settings; 56 | import psf.PSF; 57 | 58 | public class RichardsWolfPSF extends PSF { 59 | 60 | private double ni_Default = 1.5; 61 | 62 | private SpinnerRangeDouble spnNI = new SpinnerRangeDouble(ni_Default, 0, 3, 0.1, 5); 63 | private JComboBox cmbAccuracy = new JComboBox(new String[] { "Good", "Better", "Best" }); 64 | 65 | private double ni = 1.5; 66 | private int accuracy = 0; 67 | 68 | public RichardsWolfPSF() { 69 | fullname = "Richards & Wolf 3D Optical Model"; 70 | shortname = "RW"; 71 | } 72 | 73 | @Override 74 | public String getDescription() { 75 | String desc = "

" + fullname + "

"; 76 | desc += "

This model describes the vectorial-based. "; 77 | desc += "The phase aberration is given by the the Gibson & Lanni model. "; 78 | desc += "The 3 electric field components are evaluated independently.

"; 79 | return desc; 80 | } 81 | 82 | @Override 83 | public String checkSize(int nx, int ny, int nz) { 84 | if (nz < 3) 85 | return ("nz should be greater than 3."); 86 | if (nx < 4) 87 | return ("nx should be greater than 4."); 88 | if (ny < 4) 89 | return ("ny should be greater than 4."); 90 | return ""; 91 | } 92 | 93 | @Override 94 | public void resetParameters() { 95 | spnNI.set(ni_Default); 96 | cmbAccuracy.setSelectedIndex(0); 97 | } 98 | 99 | @Override 100 | public void fetchParameters() { 101 | ni = spnNI.get(); 102 | accuracy = cmbAccuracy.getSelectedIndex(); 103 | } 104 | 105 | @Override 106 | public JPanel buildPanel(Settings settings) { 107 | GridToolbar pn = new GridToolbar(false); 108 | pn.place(03, 0, "Refractive index immersion"); 109 | pn.place(06, 0, "Accuracy computation"); 110 | 111 | pn.place(03, 1, spnNI); 112 | pn.place(06, 1, cmbAccuracy); 113 | 114 | pn.place(03, 2, new JLabel("ni")); 115 | JPanel panel = new JPanel(); 116 | panel.add(pn); 117 | settings.record("psf-" + shortname + "-NI", spnNI, "" + ni_Default); 118 | settings.record("psf-" + shortname + "-accuracy", cmbAccuracy, (String) cmbAccuracy.getItemAt(0)); 119 | return panel; 120 | } 121 | 122 | @Override 123 | public void generate(Pool pool) { 124 | for (int z = 0; z < nz; z++) { 125 | double defocus = resAxial * 1E-9 * (z - (nz - 1.0) / 2.0); 126 | RichardsWolf plane = new RichardsWolf(z, defocus); 127 | plane.addMonitor(this); 128 | pool.register(plane); 129 | } 130 | } 131 | 132 | public class RichardsWolf extends Job { 133 | 134 | private int OVER_SAMPLING = 2; 135 | private int z; 136 | private double defocus; 137 | 138 | public RichardsWolf(int z, double defocus) { 139 | this.defocus = defocus; 140 | this.z = z; 141 | } 142 | 143 | @Override 144 | public void process() { 145 | 146 | // The center of the image in units of [pixels] 147 | double x0 = (nx - 1) / 2.0; 148 | double y0 = (ny - 1) / 2.0; 149 | 150 | // Lateral particle position in units of [pixels] 151 | double xp = x0;// 0.0/p.pixelSize; 152 | double yp = y0;// 0.0/p.pixelSize; 153 | 154 | // Radial locations. 155 | // double xpAbs = Math.abs(xp), ypAbs = Math.abs(yp); 156 | // double maxRadialDistanceInPixels = 157 | // Math.round(Math.sqrt((xpAbs+nx-x0)*(xpAbs+nx-x0)+(ypAbs+ny-y0)*(ypAbs+ny-y0)))+1; 158 | int maxRadius = ((int) Math.round(Math.sqrt((nx - x0) * (nx - x0) + (ny - y0) * (ny - y0)))) + 1; 159 | double[] r = new double[maxRadius * OVER_SAMPLING]; 160 | double[] h = new double[r.length]; 161 | 162 | KirchhoffDiffractionSimpson I = new KirchhoffDiffractionSimpson(defocus, ni, accuracy, NA, lambda); 163 | // KirchhoffDiffraction I = new KirchhoffDiffraction(p,accuracy); 164 | for (int n = 0; n < r.length; n++) { 165 | r[n] = ((double) n) / ((double) OVER_SAMPLING); 166 | // h[n] = I.calculate(r[n] * p.lateralResolution); 167 | h[n] = I.calculate(r[n] * resLateral * 1E-9); 168 | if (!live) 169 | return; 170 | } 171 | 172 | // Linear interpolation of the pixels values 173 | double[] slice = new double[nx * ny]; 174 | double rPixel, value; 175 | int index; 176 | for (int x = 0; x < nx; x++) { 177 | for (int y = 0; y < ny; y++) { 178 | rPixel = Math.sqrt((x - xp) * (x - xp) + (y - yp) * (y - yp)); 179 | index = (int) Math.floor(rPixel * OVER_SAMPLING); 180 | value = h[index] + (h[index + 1] - h[index]) * (rPixel - r[index]) * OVER_SAMPLING; 181 | 182 | slice[x + nx * y] = value; 183 | } 184 | if (!live) 185 | return; 186 | } 187 | 188 | data.data[z] = slice; 189 | increment(90.0 / nz, "" + z + " / " + nz); 190 | } 191 | } 192 | } 193 | -------------------------------------------------------------------------------- /src/psf/torgovarga/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 53 4 | /svn/psfgenerator/!svn/ver/32/PSFGenerator/src/psf/tv 5 | END 6 | TorokVarga.java 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 69 10 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/tv/TorokVarga.java 11 | END 12 | TorokVargaParameters.java 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 79 16 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/tv/TorokVargaParameters.java 17 | END 18 | KirchhoffDiffractionSimpson.java 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 86 22 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/tv/KirchhoffDiffractionSimpson.java 23 | END 24 | TorokVargaPSF.java 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 72 28 | /svn/psfgenerator/!svn/ver/32/PSFGenerator/src/psf/tv/TorokVargaPSF.java 29 | END 30 | -------------------------------------------------------------------------------- /src/psf/torgovarga/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 32 5 | https://svn.epfl.ch/svn/psfgenerator/PSFGenerator/src/psf/tv 6 | https://svn.epfl.ch/svn/psfgenerator 7 | 8 | 9 | 10 | 2012-11-27T10:25:13.249218Z 11 | 32 12 | kirshner 13 | 14 | 15 | svn:special svn:externals svn:needs-lock 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28c35a94-be80-47a4-8420-aa990001146c 28 | 29 | KirchhoffDiffractionSimpson.java 30 | file 31 | 32 | 33 | 34 | 35 | 2012-11-27T10:45:32.000000Z 36 | 354f7050688d2fca9921c0942e7c62a0 37 | 2012-07-05T06:31:32.932295Z 38 | 29 39 | dsage 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 8324 62 | 63 | TorokVarga.java 64 | file 65 | 66 | 67 | 68 | 69 | 2012-11-27T10:45:32.000000Z 70 | 2fd322d617a2ac6902993739683e603f 71 | 2012-07-05T06:31:32.932295Z 72 | 29 73 | dsage 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 3540 96 | 97 | TorokVargaPSF.java 98 | file 99 | 100 | 101 | 102 | 103 | 2012-11-27T10:45:32.000000Z 104 | 754fff6e5f709dc20ec63e6dd05ae76e 105 | 2012-11-27T10:25:13.249218Z 106 | 32 107 | kirshner 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 6982 130 | 131 | TorokVargaParameters.java 132 | file 133 | 134 | 135 | 136 | 137 | 2012-11-27T10:45:32.000000Z 138 | c21b9d9585df86cf006514391beba0f4 139 | 2012-07-05T06:31:32.932295Z 140 | 29 141 | dsage 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 3115 164 | 165 | -------------------------------------------------------------------------------- /src/psf/torgovarga/.svn/text-base/TorokVarga.java.svn-base: -------------------------------------------------------------------------------- 1 | //===================================================================================== 2 | // Project: PSF Generator 3 | // 4 | // Organization: Biomedical Imaging Group (BIG) 5 | // Ecole Polytechnique Federale de Lausanne (EPFL) 6 | // Lausanne, Switzerland 7 | // 8 | // Information: http://bigwww.epfl.ch/deconvolution/ 9 | // 10 | // Reference: 11 | // Alessandra Griffa, Nathalie Garin, Daniel Sage, 12 | // Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 13 | // G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 14 | // Available: http://bigwww.epfl.ch/publications/griffa1001.html 15 | // 16 | // Conditions of use: 17 | // You'll be free to use this software for research purposes, but you 18 | // should not redistribute it without our consent. In addition, we 19 | // expect you to include a citation or acknowledgment whenever 20 | // you present or publish results that are based on it. 21 | //===================================================================================== 22 | 23 | 24 | package psf.tv; 25 | 26 | import imageware.Builder; 27 | import imageware.ImageWare; 28 | 29 | /** 30 | * This class generates the Gibson-Lanni PSF. 31 | * 32 | * @author Hagai Kirshner, Biomedical Imaging Group, Ecole Polytechnique Federale de Lausanne (EPFL) 33 | */ 34 | public class TorokVarga implements Runnable { 35 | 36 | static int OVER_SAMPLING = 2; 37 | 38 | private TorokVargaPSF tvPSF; 39 | private TorokVargaParameters p; 40 | private int nx; 41 | private int ny; 42 | private int z; 43 | private boolean running = false; 44 | 45 | /** 46 | * Constructor. 47 | */ 48 | public TorokVarga(TorokVargaPSF tvPSF, int z) { 49 | this.tvPSF = tvPSF; 50 | this.nx = tvPSF.nx; 51 | this.ny = tvPSF.ny; 52 | this.z = z; 53 | // making a new copy of the parameters is required, as different threads use different "ti" values. 54 | this.p = new TorokVargaParameters(tvPSF.p); 55 | } 56 | 57 | public boolean isRunning() { 58 | return running; 59 | } 60 | 61 | /** 62 | * Creates a 2D PSF image at a specified z location. 63 | */ 64 | public void run() { 65 | 66 | running = true; 67 | 68 | // The center of the image in units of [pixels] 69 | double x0 = (nx-1)/2.0; 70 | double y0 = (ny-1)/2.0; 71 | 72 | // Lateral particle position in units of [pixels] 73 | double xp = x0;// 0.0/p.pixelSize; 74 | double yp = y0;// 0.0/p.pixelSize; 75 | 76 | // Radial locations. 77 | //double xpAbs = Math.abs(xp), ypAbs = Math.abs(yp); 78 | //double maxRadialDistanceInPixels = Math.round(Math.sqrt((xpAbs+nx-x0)*(xpAbs+nx-x0)+(ypAbs+ny-y0)*(ypAbs+ny-y0)))+1; 79 | int maxRadius = ((int) Math.round(Math.sqrt((nx-x0)*(nx-x0)+(ny-y0)*(ny-y0))))+1; 80 | double[] r = new double[maxRadius*OVER_SAMPLING]; 81 | double[] h = new double[r.length]; 82 | 83 | KirchhoffDiffractionSimpson I = new KirchhoffDiffractionSimpson(p,tvPSF.accuracy); 84 | //KirchhoffDiffraction I = new KirchhoffDiffraction(p,accuracy); 85 | for (int n=0; n. 43 | */ 44 | 45 | package psf.torgovarga; 46 | 47 | import javax.swing.JPanel; 48 | 49 | import bilib.commons.components.GridToolbar; 50 | import bilib.commons.components.SpinnerRangeDouble; 51 | import bilib.commons.job.runnable.Job; 52 | import bilib.commons.job.runnable.Pool; 53 | import bilib.commons.settings.Settings; 54 | import psf.PSF; 55 | 56 | /** 57 | * @author Hagai Kirshner 58 | */ 59 | public class TorokVargaPSF extends PSF { 60 | 61 | private double ni_Default = 1.5; 62 | private double ns_Default = 1.0; 63 | private double ti_Default = 150; 64 | private double zpos_Default = 2000; 65 | 66 | private SpinnerRangeDouble spnNI = new SpinnerRangeDouble(ni_Default, 0, 3, 0.1); 67 | private SpinnerRangeDouble spnNS = new SpinnerRangeDouble(ns_Default, 0, 3, 0.1); 68 | private SpinnerRangeDouble spnTI = new SpinnerRangeDouble(ti_Default, 0, 999999.0, 100); 69 | private SpinnerRangeDouble spnZPos = new SpinnerRangeDouble(zpos_Default, -99999999.0, 99999999.0, 10); 70 | 71 | protected TorokVargaParameters p; 72 | 73 | public TorokVargaPSF() { 74 | fullname = "Torok & Varga 3D Optical Model"; 75 | shortname = "TV"; 76 | p = new TorokVargaParameters(); 77 | } 78 | 79 | @Override 80 | public String getDescription() { 81 | return "

Török & Varga PSF Model

"; 82 | } 83 | 84 | @Override 85 | public String checkSize(int nx, int ny, int nz) { 86 | if (nz < 3) 87 | return ("nz should be greater than 3."); 88 | if (nx < 4) 89 | return ("nx should be greater than 4."); 90 | if (ny < 4) 91 | return ("ny should be greater than 4."); 92 | return ""; 93 | } 94 | 95 | @Override 96 | public void resetParameters() { 97 | spnNI.set(ni_Default); 98 | spnNS.set(ns_Default); 99 | spnTI.set(ti_Default); 100 | spnZPos.set(zpos_Default); 101 | } 102 | 103 | public int getNumberBlankLines() { 104 | return 0; 105 | } 106 | 107 | @Override 108 | public void fetchParameters() { 109 | p.ni = spnNI.get(); 110 | p.ns = spnNS.get(); 111 | p.ti0 = spnTI.get() * 1E-6; 112 | p.particleAxialPosition = spnZPos.get() * 1E-9; 113 | } 114 | 115 | @Override 116 | public JPanel buildPanel(Settings settings) { 117 | GridToolbar pn = new GridToolbar(false, 1); 118 | pn.place(02, 0, "Refractive index immersion"); 119 | pn.place(03, 0, "Refractive index sample"); 120 | pn.place(04, 0, "Working distance (ti)"); 121 | pn.place(11, 0, "Particle position Z"); 122 | pn.place(02, 1, spnNI); 123 | pn.place(03, 1, spnNS); 124 | pn.place(04, 1, spnTI); 125 | pn.place(11, 1, spnZPos); 126 | pn.place(02, 2, "ni"); 127 | pn.place(03, 2, "ns"); 128 | pn.place(04, 2, "[μm]"); 129 | pn.place(11, 2, "[nm]"); 130 | JPanel panel = new JPanel(); 131 | panel.add(pn); 132 | settings.record("psf-" + shortname + "-NI", spnNI, "" + ni_Default); 133 | settings.record("psf-" + shortname + "-NS", spnNS, "" + ns_Default); 134 | settings.record("psf-" + shortname + "-TI", spnTI, "" + ti_Default); 135 | settings.record("psf-" + shortname + "-ZPos", spnZPos, "" + zpos_Default); 136 | return panel; 137 | } 138 | 139 | @Override 140 | public void generate(Pool pool) { 141 | for (int z = 0; z < nz; z++) { 142 | TorokVargaParameters param = new TorokVargaParameters(p); 143 | param.ti = p.ti0 + resAxial * 1E-9 * (z - (nz - 1.0) / 2.0); 144 | TorokVarga plane = new TorokVarga(param, z); 145 | plane.addMonitor(this); 146 | pool.register(plane); 147 | } 148 | } 149 | 150 | public class TorokVarga extends Job { 151 | 152 | private int OVER_SAMPLING = 2; 153 | private TorokVargaParameters p; 154 | private int z; 155 | 156 | public TorokVarga(TorokVargaParameters p, int z) { 157 | this.z = z; 158 | this.p = p; 159 | } 160 | 161 | @Override 162 | public void process() { 163 | 164 | // The center of the image in units of [pixels] 165 | double x0 = (nx - 1) / 2.0; 166 | double y0 = (ny - 1) / 2.0; 167 | 168 | // Lateral particle position in units of [pixels] 169 | double xp = x0;// 0.0/p.pixelSize; 170 | double yp = y0;// 0.0/p.pixelSize; 171 | 172 | // Radial locations. 173 | // double xpAbs = Math.abs(xp), ypAbs = Math.abs(yp); 174 | // double maxRadialDistanceInPixels = 175 | // Math.round(Math.sqrt((xpAbs+nx-x0)*(xpAbs+nx-x0)+(ypAbs+ny-y0)*(ypAbs+ny-y0)))+1; 176 | int maxRadius = ((int) Math.round(Math.sqrt((nx - x0) * (nx - x0) + (ny - y0) * (ny - y0)))) + 1; 177 | double[] r = new double[maxRadius * OVER_SAMPLING]; 178 | double[] h = new double[r.length]; 179 | 180 | KirchhoffDiffractionSimpson I = new KirchhoffDiffractionSimpson(p, 0); 181 | // KirchhoffDiffraction I = new KirchhoffDiffraction(p,accuracy); 182 | for (int n = 0; n < r.length; n++) { 183 | r[n] = ((double) n) / ((double) OVER_SAMPLING); 184 | h[n] = I.calculate(r[n] * resLateral * 1E-9); 185 | if (!live) 186 | return; 187 | } 188 | 189 | // Linear interpolation of the pixels values 190 | double slice[] = new double[nx * ny]; 191 | double rPixel, value; 192 | int index; 193 | for (int x = 0; x < nx; x++) { 194 | for (int y = 0; y < ny; y++) { 195 | rPixel = Math.sqrt((x - xp) * (x - xp) + (y - yp) * (y - yp)); 196 | index = (int) Math.floor(rPixel * OVER_SAMPLING); 197 | value = h[index] + (h[index + 1] - h[index]) * (rPixel - r[index]) * OVER_SAMPLING; 198 | slice[x + nx * y] = value; 199 | } 200 | if (!live) 201 | return; 202 | } 203 | setPlane(z, slice); 204 | increment(90.0 / nz, "" + z + " / " + nz); 205 | } 206 | } 207 | 208 | } 209 | -------------------------------------------------------------------------------- /src/psf/torgovarga/TorokVargaParameters.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psf.torgovarga; 46 | 47 | /** 48 | * @author Hagai Kirshner 49 | */ 50 | 51 | public class TorokVargaParameters { 52 | 53 | /** 54 | * Working distance of the objective (design value). This is also the width 55 | * of the immersion layer. 56 | */ 57 | public double ti0; 58 | 59 | /** 60 | * Working distance of the objective (experimental value). influenced by the 61 | * stage displacement. 62 | */ 63 | public double ti; 64 | 65 | /** Immersion medium refractive index (design value). */ 66 | public double ni0; 67 | 68 | /** Immersion medium refractive index (experimental value). */ 69 | public double ni; 70 | 71 | /** Coverslip thickness (design value). */ 72 | public double tg0 = 0.0; 73 | 74 | /** Coverslip thickness (experimental value). */ 75 | public double tg = 0.0; 76 | 77 | /** Coverslip refractive index (design value). */ 78 | public double ng0 = 1.5; 79 | 80 | /** Coverslip refractive index (experimental value). */ 81 | public double ng = 1.5; 82 | 83 | /** Sample refractive index. */ 84 | public double ns; 85 | 86 | /** Axial position of the particle. */ 87 | public double particleAxialPosition; 88 | 89 | /* Constants */ 90 | public double alpha; // aperture in [radians] 91 | public double k; // wave number 92 | public double kni; 93 | 94 | TorokVargaParameters() { 95 | } 96 | 97 | TorokVargaParameters(TorokVargaParameters p) { 98 | this.ng = p.ng; 99 | this.ng0 = p.ng0; 100 | this.ni = p.ni; 101 | this.ni0 = p.ni0; 102 | this.ns = p.ns; 103 | this.particleAxialPosition = p.particleAxialPosition; 104 | this.tg = p.tg; 105 | this.tg0 = p.tg0; 106 | this.ti = p.ti; 107 | this.ti0 = p.ti0; 108 | this.alpha = p.alpha; 109 | this.k = p.k; 110 | this.kni = p.kni; 111 | } 112 | 113 | public void calculateConstants(double NA, double lambda) { 114 | alpha = Math.asin(NA); 115 | k = 2 * Math.PI / lambda; 116 | kni = k * ni; 117 | } 118 | } -------------------------------------------------------------------------------- /src/psf/vri_gibsonlanni/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 54 4 | /svn/psfgenerator/!svn/ver/32/PSFGenerator/src/psf/mgl 5 | END 6 | ModifiedGL.java 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 70 10 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/mgl/ModifiedGL.java 11 | END 12 | ModifiedGLParameters.java 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 80 16 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/mgl/ModifiedGLParameters.java 17 | END 18 | KirchhoffDiffractionSimpson.java 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 87 22 | /svn/psfgenerator/!svn/ver/29/PSFGenerator/src/psf/mgl/KirchhoffDiffractionSimpson.java 23 | END 24 | ModifiedGLPSF.java 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 73 28 | /svn/psfgenerator/!svn/ver/32/PSFGenerator/src/psf/mgl/ModifiedGLPSF.java 29 | END 30 | -------------------------------------------------------------------------------- /src/psf/vri_gibsonlanni/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 32 5 | https://svn.epfl.ch/svn/psfgenerator/PSFGenerator/src/psf/mgl 6 | https://svn.epfl.ch/svn/psfgenerator 7 | 8 | 9 | 10 | 2012-11-27T10:25:13.249218Z 11 | 32 12 | kirshner 13 | 14 | 15 | svn:special svn:externals svn:needs-lock 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28c35a94-be80-47a4-8420-aa990001146c 28 | 29 | KirchhoffDiffractionSimpson.java 30 | file 31 | 32 | 33 | 34 | 35 | 2012-11-27T10:45:32.000000Z 36 | 7f3740572b97174cf11bd2ad11118db2 37 | 2012-07-05T06:31:32.932295Z 38 | 29 39 | dsage 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 6698 62 | 63 | ModifiedGL.java 64 | file 65 | 66 | 67 | 68 | 69 | 2012-11-27T10:45:32.000000Z 70 | 8edf68dfe0bd37282e5114240beac63e 71 | 2012-07-05T06:31:32.932295Z 72 | 29 73 | dsage 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 3336 96 | 97 | ModifiedGLPSF.java 98 | file 99 | 100 | 101 | 102 | 103 | 2012-11-27T10:45:32.000000Z 104 | 18b527cb68dc8fd77c0539956d18c043 105 | 2012-11-27T10:25:13.249218Z 106 | 32 107 | kirshner 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 8864 130 | 131 | ModifiedGLParameters.java 132 | file 133 | 134 | 135 | 136 | 137 | 2012-11-27T10:45:32.000000Z 138 | f4d1df8fb4fcbe2e5db95e0bc91b35b0 139 | 2012-07-05T06:31:32.932295Z 140 | 29 141 | dsage 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 2954 164 | 165 | -------------------------------------------------------------------------------- /src/psf/vri_gibsonlanni/.svn/text-base/KirchhoffDiffractionSimpson.java.svn-base: -------------------------------------------------------------------------------- 1 | //===================================================================================== 2 | // Project: PSF Generator 3 | // 4 | // Author: 5 | // Daniel Sage 6 | // Biomedical Imaging Group (BIG) 7 | // Ecole Polytechnique Federale de Lausanne (EPFL) 8 | // Lausanne, Switzerland 9 | // 10 | // Information: http://bigwww.epfl.ch/deconvolution/ 11 | // 12 | // Reference: 13 | // Alessandra Griffa, Nathalie Garin, Daniel Sage, 14 | // Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 15 | // G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 16 | // Available: http://bigwww.epfl.ch/publications/griffa1001.html 17 | // 18 | // Conditions of use: 19 | // You'll be free to use this software for research purposes, but you 20 | // should not redistribute it without our consent. In addition, we 21 | // expect you to include a citation or acknowledgment whenever 22 | // you present or publish results that are based on it. 23 | //===================================================================================== 24 | 25 | package psf.mgl; 26 | 27 | import psf.utils.Bessel; 28 | 29 | /** 30 | * Kirchhoff Diffraction integral formula for the Gibson and Lanni PSF model 31 | * 32 | * @author Hagai Kirshner, Biomedical Imaging Group, Ecole Polytechnique Federale de Lausanne (EPFL) 33 | */ 34 | public class KirchhoffDiffractionSimpson{ 35 | 36 | // Gibson & Lanni parameters of the acquisition 37 | private ModifiedGLParameters p; 38 | 39 | // Stopping conditions: 40 | // Difference between consecutive Riemann approximations. 41 | double TOL = 1E-1; 42 | // The number of consecutive approximations that meet the TOL criterion 43 | int K = 1; 44 | private int z; 45 | 46 | // Constructor 47 | public KirchhoffDiffractionSimpson(ModifiedGLParameters p, int accuracy, int z) { 48 | this.z = z; 49 | this.p = p; 50 | if (accuracy == 0) K = 5; 51 | else if (accuracy == 1) K = 7; 52 | else if (accuracy == 2) K = 9; 53 | else K = 3; 54 | } 55 | 56 | // calculate() 57 | // Simpson approximation for the Kirchhoff diffraction integral 58 | // 'r' is the radial distance of the detector relative to the optical axis. 59 | double calculate(double r) { 60 | 61 | double a = 0.0; // Lower and upper limits of the integral 62 | double b=Math.min(1, p.ni/p.NA); //1.0 63 | 64 | //IJ.log("(p.ti0, p.ti) = (" + p.ti0 + ", " + p.ti + ")"); 65 | int N; // number of sub-intervals 66 | int k; // number of consecutive successful approximations 67 | double del; // integration interval 68 | int iteration; // number of iterations. 69 | double curDifference; // Stopping criterion 70 | 71 | double realSum, imagSum, rho; 72 | double[] sumOddIndex = new double[2], sumEvenIndex = new double[2]; 73 | double[] valueX0 = new double[2], valueXn = new double[2]; 74 | double[] value = new double[2]; 75 | 76 | double curI = 0.0, prevI = 0.0; 77 | 78 | // Initialization of the Simpson sum (first iteration) 79 | N=2; 80 | del=(b-a)/2.0; 81 | k=0; 82 | iteration = 1; 83 | rho = (b-a)/2.0; 84 | sumOddIndex = this.integrand(rho,r); 85 | sumEvenIndex[0] = 0.0; sumEvenIndex[1] = 0.0; 86 | 87 | valueX0 = this.integrand(a,r); 88 | valueXn = this.integrand(b,r); 89 | 90 | realSum = valueX0[0] + 2.0*sumEvenIndex[0] + 4.0*sumOddIndex[0] + valueXn[0]; 91 | imagSum = valueX0[1] + 2.0*sumEvenIndex[1] + 4.0*sumOddIndex[1] + valueXn[1]; 92 | curI = (realSum*realSum+imagSum*imagSum)*del*del; 93 | 94 | prevI=curI; 95 | curDifference = TOL; 96 | 97 | // Finer sampling grid until we meet the TOL value with the specified number of repetitions, K 98 | while(k. 43 | */ 44 | 45 | package psf.vri_gibsonlanni; 46 | 47 | /** 48 | * @author Hagai Kirshner 49 | */ 50 | 51 | public class VRIGLParameters { 52 | 53 | /** 54 | * Working distance of the objective (design value). This is also the width 55 | * of the immersion layer. 56 | */ 57 | public double ti0; 58 | 59 | /** 60 | * Working distance of the objective (experimental value). influenced by the 61 | * stage displacement. 62 | */ 63 | public double ti; 64 | 65 | /** Immersion medium refractive index (design value). */ 66 | public double ni0; 67 | 68 | /** Immersion medium refractive index (experimental value). */ 69 | public double ni; 70 | 71 | /** Coverslip thickness (design value). */ 72 | public double tg0; 73 | 74 | /** Coverslip thickness (experimental value). */ 75 | public double tg; 76 | 77 | /** Coverslip refractive index (design value). */ 78 | public double ng0; // = 1.5; 79 | 80 | /** Coverslip refractive index (experimental value). */ 81 | public double ng; // = 1.5; 82 | 83 | /** Sample refractive index. */ 84 | public double ns1; 85 | public double ns2; 86 | 87 | /** Emission wavelength of the fluorophoes. */ 88 | public double lambda; 89 | 90 | /** Numerical aperture (normalized by ni0) */ 91 | public double NA; 92 | 93 | /** Axial position of the particle. */ 94 | public double particleAxialPosition; 95 | 96 | /** Variation of Refractive Index within the specimen */ 97 | public int type; 98 | 99 | VRIGLParameters() { 100 | } 101 | 102 | VRIGLParameters(VRIGLParameters p) { 103 | this.NA = p.NA; 104 | this.ng = p.ng; 105 | this.ng0 = p.ng0; 106 | this.ni = p.ni; 107 | this.ni0 = p.ni0; 108 | this.ns1 = p.ns1; 109 | this.ns2 = p.ns2; 110 | this.particleAxialPosition = p.particleAxialPosition; 111 | this.tg = p.tg; 112 | this.tg0 = p.tg0; 113 | this.ti = p.ti; 114 | this.ti0 = p.ti0; 115 | this.lambda = p.lambda; 116 | this.type = p.type; 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /src/psfgenerator/About.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psfgenerator; 46 | 47 | import javax.swing.BorderFactory; 48 | import javax.swing.JFrame; 49 | 50 | import bilib.commons.components.HTMLPane; 51 | 52 | public class About { 53 | 54 | public static String title() { 55 | return "PSF Generator"; 56 | } 57 | 58 | public static String version() { 59 | return "1.1.1.2 (18.12.2017)"; 60 | } 61 | 62 | public static String url() { 63 | return "http://bigwww.epfl.ch/algorithms/psfgenerator/"; 64 | } 65 | 66 | public static String copyright() { 67 | return " 2017 EPFL BIG \u2022 " + version(); 68 | } 69 | 70 | public static HTMLPane getPanel(int w, int h) { 71 | HTMLPane html = new HTMLPane(w, h); 72 | 73 | html.append("h1", title()); 74 | html.append("p", "Daniel Sage and Hagai Kirshner"); 75 | html.append("p", "Biomedical Imaging Group (BIG)"); 76 | html.append("p", "EPFL, Lausanne, Switzerland"); 77 | html.append("
"); 78 | html.append("h2", "Version: " + version()); 79 | html.append("p", "http://bigwww.epfl.ch/algorithms/psfgenerator/"); 80 | html.append("
"); 81 | html.append("h2", "Reference:"); 82 | html.append("p", "H. Kirshner, F. Aguet, D. Sage, M. Unser, " + "3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application, " 83 | + "Journal of Microscopy, vol. 249, no. 1, 2013."); 84 | html.append("p", "A. Griffa, N, Garin, D. Sage, " + "Comparison of Deconvolution Software in 3D Microscopy: A User Point of View" 85 | + "G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010."); 86 | html.append("
"); 87 | 88 | html.append("p", "PSF Generator is a Java software package that allows one to generate " + "and visualize various 3D models of a microscope PSF."); 89 | html.append("p", "The current version has 15 different models including true 3D optical " + "models Born & Wolf, Gibson & Lanni, and the vectorial-based model Richards & Wolf."); 90 | 91 | return html; 92 | } 93 | 94 | public static void show() { 95 | HTMLPane pane = getPanel(400, 400); 96 | pane.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); 97 | JFrame frame = new JFrame("About " + title()); 98 | frame.getContentPane().add(pane); 99 | frame.pack(); 100 | frame.setVisible(true); 101 | } 102 | } -------------------------------------------------------------------------------- /src/psfgenerator/CollectionPSF.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psfgenerator; 46 | 47 | import java.util.ArrayList; 48 | 49 | import psf.PSF; 50 | import psf.bornwolf.BornWolfPSF; 51 | import psf.defocusplane.DefocusPlanePSF; 52 | import psf.defocussing.DefocussingPSF; 53 | import psf.gibsonlanni.GibsonLanniPSF; 54 | import psf.koehler.KoehlerPSF; 55 | import psf.richardswolf.RichardsWolfPSF; 56 | import psf.torgovarga.TorokVargaPSF; 57 | import psf.vri_gibsonlanni.VRIGLPSF; 58 | 59 | public class CollectionPSF { 60 | 61 | public static ArrayList getStandardCollection() { 62 | ArrayList psfs = new ArrayList(); 63 | 64 | psfs.add(new GibsonLanniPSF()); 65 | psfs.add(new RichardsWolfPSF()); 66 | psfs.add(new VRIGLPSF()); 67 | psfs.add(new BornWolfPSF()); 68 | psfs.add(new TorokVargaPSF()); 69 | 70 | psfs.add(new DefocusPlanePSF(DefocusPlanePSF.GAUSSIAN)); 71 | psfs.add(new DefocusPlanePSF(DefocusPlanePSF.LORENTZ)); 72 | psfs.add(new DefocusPlanePSF(DefocusPlanePSF.SINC)); 73 | psfs.add(new DefocusPlanePSF(DefocusPlanePSF.COSINE)); 74 | psfs.add(new DefocusPlanePSF(DefocusPlanePSF.CIRCULAR)); 75 | psfs.add(new DefocusPlanePSF(DefocusPlanePSF.ASTIGMATISM)); 76 | psfs.add(new DefocusPlanePSF(DefocusPlanePSF.ROTATED_GAUSSIAN)); 77 | psfs.add(new DefocusPlanePSF(DefocusPlanePSF.DOUBLE_HELIX)); 78 | 79 | psfs.add(new KoehlerPSF()); 80 | psfs.add(new DefocussingPSF()); 81 | return psfs; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/psfgenerator/ResultPlanesTable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psfgenerator; 46 | 47 | import java.awt.BorderLayout; 48 | import java.util.ArrayList; 49 | 50 | import javax.swing.JPanel; 51 | 52 | import bilib.commons.table.CustomizedColumn; 53 | import bilib.commons.table.CustomizedTable; 54 | import bilib.commons.utils.NumFormat; 55 | import psf.Data3D; 56 | import psf.PSF; 57 | 58 | public class ResultPlanesTable extends JPanel { 59 | 60 | public ResultPlanesTable(PSF psf) { 61 | super(); 62 | Data3D data = psf.getData(); 63 | double plane[][] = data.getPlaneInformation(); 64 | ArrayList columns = new ArrayList(); 65 | columns.add(new CustomizedColumn("Z-Plane", String.class, 40, false)); 66 | columns.add(new CustomizedColumn("Max Value", String.class, 40, false)); 67 | columns.add(new CustomizedColumn("Energy Value", String.class, 40, false)); 68 | columns.add(new CustomizedColumn("Efficiency Radius", String.class, 40, false)); 69 | 70 | CustomizedTable table = new CustomizedTable(columns, true); 71 | for (int i = 0; i < plane.length; i++) { 72 | String z = String.format("%05d", (int) plane[i][0]); 73 | String m = NumFormat.sci(plane[i][1]); 74 | String e = NumFormat.sci(plane[i][2] * 100); 75 | String r = NumFormat.sci(plane[i][3] * psf.resLateral); 76 | table.append(new String[] { z, m, e, r }); 77 | } 78 | 79 | setLayout(new BorderLayout()); 80 | add(table.getPane(200, 200)); 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /src/psfgenerator/SummaryPanel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PSFGenerator 3 | * 4 | * Authors: Daniel Sage and Hagai Kirshner 5 | * Organization: Biomedical Imaging Group (BIG), Ecole Polytechnique Federale de Lausanne 6 | * Address: EPFL-STI-IMT-LIB, 1015 Lausanne, Switzerland 7 | * Information: http://bigwww.epfl.ch/algorithms/psfgenerator/ 8 | * 9 | * References: 10 | * [1] H. Kirshner, F. Aguet, D. Sage, M. Unser 11 | * 3-D PSF Fitting for Fluorescence Microscopy: Implementation and Localization Application 12 | * Journal of Microscopy, vol. 249, no. 1, pp. 13-25, January 2013. 13 | * Available at: http://bigwww.epfl.ch/publications/kirshner1301.html 14 | * 15 | * [2] A. Griffa, N. Garin, D. Sage 16 | * Comparison of Deconvolution Software in 3D Microscopy: A User Point of View 17 | * G.I.T. Imaging & Microscopy, vol. 12, no. 1, pp. 43-45, March 2010. 18 | * Available at: http://bigwww.epfl.ch/publications/griffa1001.html 19 | * 20 | * Conditions of use: 21 | * Conditions of use: You are free to use this software for research or 22 | * educational purposes. In addition, we expect you to include adequate 23 | * citations and acknowledgments whenever you present or publish results that 24 | * are based on it. 25 | */ 26 | 27 | /** 28 | * Copyright 2010-2017 Biomedical Imaging Group at the EPFL. 29 | * 30 | * This file is part of PSFGenerator. 31 | * 32 | * PSFGenerator is free software: you can redistribute it and/or modify it under the 33 | * terms of the GNU General Public License as published by the Free Software 34 | * Foundation, either version 3 of the License, or (at your option) any later 35 | * version. 36 | * 37 | * PSFGenerator is distributed in the hope that it will be useful, but WITHOUT ANY 38 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 39 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 40 | * 41 | * You should have received a copy of the GNU General Public License along with 42 | * PSFGenerator. If not, see . 43 | */ 44 | 45 | package psfgenerator; 46 | 47 | import java.awt.BorderLayout; 48 | import java.util.ArrayList; 49 | 50 | import javax.swing.JPanel; 51 | 52 | import bilib.commons.components.HTMLPane; 53 | import bilib.commons.table.CustomizedColumn; 54 | import bilib.commons.table.CustomizedTable; 55 | import bilib.commons.utils.NumFormat; 56 | import psf.PSF; 57 | import psf.Point3D; 58 | 59 | public class SummaryPanel extends JPanel { 60 | 61 | public SummaryPanel(PSF psf) { 62 | 63 | Point3D max = psf.getData().max; 64 | Point3D fwhm = psf.getData().fwhm; 65 | 66 | ArrayList columns = new ArrayList(); 67 | columns.add(new CustomizedColumn("Feature", String.class, 40, false)); 68 | columns.add(new CustomizedColumn("Value in nm", String.class, 40, false)); 69 | columns.add(new CustomizedColumn("Value in pixel", String.class, 40, false)); 70 | 71 | CustomizedTable table = new CustomizedTable(columns, true); 72 | 73 | table.append(new String[] { "Numerical Aperture", NumFormat.sci(psf.NA), "" }); 74 | table.append(new String[] { "Wavelength", NumFormat.sci(psf.lambda), "" }); 75 | table.append(new String[] { "Energy", NumFormat.sci(psf.getData().energy), "" }); 76 | 77 | table.append(new String[] { "Size X", NumFormat.sci(psf.nx * psf.resLateral), "" + psf.nx }); 78 | table.append(new String[] { "Size Y", NumFormat.sci(psf.ny * psf.resLateral), "" + psf.ny }); 79 | table.append(new String[] { "Size Z", NumFormat.sci(psf.nz * psf.resAxial), "" + psf.nz }); 80 | 81 | table.append(new String[] { "Pixelsize X", NumFormat.sci(psf.resLateral) }); 82 | table.append(new String[] { "Pixelsize Y", NumFormat.sci(psf.resLateral) }); 83 | table.append(new Object[] { "Axial Z-step", NumFormat.sci(psf.resAxial) }); 84 | 85 | table.append(new String[] { "FWHM Lateral X", NumFormat.sci(fwhm.x * psf.resLateral), NumFormat.sci(fwhm.x) }); 86 | table.append(new String[] { "FWHM Lateral Y", NumFormat.sci(fwhm.y * psf.resLateral), NumFormat.sci(fwhm.y) }); 87 | table.append(new String[] { "FWHM Axial Z", NumFormat.sci(fwhm.z * psf.resAxial), NumFormat.sci(fwhm.z) }); 88 | table.append(new String[] { "Energy under FWHM", NumFormat.sci(fwhm.value), "" }); 89 | 90 | table.append(new String[] { "Max Lateral X", NumFormat.sci(max.x * psf.resLateral), NumFormat.sci(max.x) }); 91 | table.append(new String[] { "Max Lateral Y", NumFormat.sci(max.y * psf.resLateral), NumFormat.sci(max.y) }); 92 | table.append(new String[] { "Max Axial Z", NumFormat.sci(max.z * psf.resAxial), NumFormat.sci(max.z) }); 93 | table.append(new String[] { "Max Value", NumFormat.sci(max.value), "" }); 94 | 95 | HTMLPane panel = new HTMLPane(); 96 | panel.append("

" + psf.getFullname() + "

"); 97 | setLayout(new BorderLayout()); 98 | add(panel.getPane(), BorderLayout.NORTH); 99 | add(table.getPane(200, 200), BorderLayout.CENTER); 100 | } 101 | } 102 | --------------------------------------------------------------------------------