Page MenuHomec4science

No OneTemporary

File Metadata

Created
Fri, Nov 22, 12:22
diff --git a/DeconvolutionLab2/DeconvolutionLab2.config b/DeconvolutionLab2/DeconvolutionLab2.config
index 73ba193..0341ed5 100644
--- a/DeconvolutionLab2/DeconvolutionLab2.config
+++ b/DeconvolutionLab2/DeconvolutionLab2.config
@@ -1,83 +1,83 @@
#DeconvolutionLab2 [Beta 1]
#DeconvolutionLab2 [Beta 1]
-#Fri Feb 03 14:47:43 CET 2017
+#Sun Feb 05 16:18:49 CET 2017
Algorithm.FISTA.iterations=10
Algorithm.FISTA.reg=0.1
Algorithm.FISTA.scale=3
Algorithm.FISTA.step=1.0
Algorithm.FISTA.wavelets=Haar
Algorithm.ICTM.iterations=10
-Algorithm.ICTM.reg=\ 1.0000
+Algorithm.ICTM.reg=0.1
Algorithm.ICTM.step=1.0
Algorithm.ISTA.iterations=10
Algorithm.ISTA.reg=0.1
Algorithm.ISTA.scale=3
Algorithm.ISTA.step=1.0
Algorithm.ISTA.wavelets=Haar
Algorithm.LW+.iterations=10
Algorithm.LW+.step=1.0
Algorithm.LW.iterations=10
Algorithm.LW.step=1.0
Algorithm.RIF.reg=0.1
Algorithm.RL.iterations=10
Algorithm.RLTV.reg=0.1
Algorithm.SIM.gaussian.mean=0.0
Algorithm.SIM.gaussian.stdev=1.0
Algorithm.SIM.poisson=0.0
Algorithm.TM.iterations=10
Algorithm.TM.reg=0.1
Algorithm.TM.step=1.0
Algorithm.TRIF.reg=0.1
Algorithm.VC.iterations=10
Algorithm.VC.step=1.0
Algorithm.algorithm=Iterative Contraint Tikhonov-Miller
Border.apoxy=Uniform
Border.apoz=Uniform
Border.extxy=0
Border.extz=0
Border.normalization=1
Border.padxy=None
Border.padz=None
Controller.constraint.enable=false
Controller.constraint.snapshot=1
Controller.constraint.value=No
Controller.reference.enable=false
Controller.reference.snapshot=1
Controller.reference.value=
Controller.residu.enable=false
Controller.residu.snapshot=1
Controller.residu.value=0.01
Controller.savestats.enable=false
Controller.savestats.snapshot=1
Controller.savestats.value=Stats
Controller.showstats.enable=false
Controller.showstats.snapshot=1
Controller.showstats.value=Stats
-DeconvolutionLab.MainDialog.location.h=507
-DeconvolutionLab.MainDialog.location.w=503
-DeconvolutionLab.MainDialog.location.x=190
-DeconvolutionLab.MainDialog.location.y=268
+DeconvolutionLab.MainDialog.location.h=608
+DeconvolutionLab.MainDialog.location.w=502
+DeconvolutionLab.MainDialog.location.x=372
+DeconvolutionLab.MainDialog.location.y=70
Fourier.dim=XYZ
Fourier.epsilon=1E-6
Fourier.fft=Academic
-Image.image.row0=Cube;synthetic;Cube 100.0 0.0 10.0 1.0 size 128 128 32 ;null
-Image.image.row1=resolution;directory;/Users/dsage/Desktop/DeconvolutionLab2-Course/resolution;null
-Image.image.selected=Cube;synthetic;Cube 100.0 0.0 10.0 1.0 size 128 128 32 ;null
+Image.image.row0=RandomLines;synthetic;RandomLines 100.0 0.0 300.0 size 300 300 32 ;null
+Image.image.row1=logo-h360.png;file;/Users/dsage/Desktop/logo-h360.png;null
+Image.image.row2=logo-psf.png;file;/Users/dsage/Desktop/logo-psf.png;null
+Image.image.selected=RandomLines;synthetic;RandomLines 100.0 0.0 300.0 size 300 300 32 ;null
Language.headless=Run (Headless)
Language.job=Job
-Language.language=ImageJ Macro
-Output.output.row0=ortho;OR1;;;;\u2713;\u2713;null
-Output.output.row1=ortho;OR1;;;;\u2713;;null
-Output.output.selected=ortho;OR1;;;;\u2713;;null
-PSF.psf.row0=MotionBlur2D;synthetic;MotionBlur2D 100.0 0.0 3.0 3.0 3.0 size 128 128 32 ;null
-PSF.psf.row1=Airy;synthetic;Airy 100.0 0.0 1.0 size 128 128 32 ;null
-PSF.psf.row2=Defocus;synthetic;Defocus 100.0 0.0 3.0 10.0 10.0 size 3 3 100 ;null
-PSF.psf.selected=Airy;synthetic;Airy 100.0 0.0 1.0 size 128 128 32 ;null
+Language.language=Command line
+PSF.psf.row0=AirySimulated;synthetic;AirySimulated 100.0 0.0 10.0 size 128 128 32 ;null
+PSF.psf.row1=AirySimulated;synthetic;AirySimulated 100.0 0.0 1.0 size 128 128 32 ;null
+PSF.psf.row2=AirySimulated;synthetic;AirySimulated 100.0 0.0 10.0 10.0 size 128 128 32 ;null
+PSF.psf.row3=Airy;synthetic;Airy 100.0 0.0 10.0 10.0 size 128 128 32 ;null
+PSF.psf.row4=Airy;synthetic;Airy 100.0 0.0 1.0 size 128 128 32 ;null
+PSF.psf.selected=AirySimulated;synthetic;AirySimulated 100.0 0.0 10.0 10.0 size 128 128 32 ;null
Watcher.disable.console=false
Watcher.disable.display=false
Watcher.disable.multithreading=false
Watcher.disable.table=false
Watcher.path=/Users/dsage/git/deconvolution/DeconvolutionLab2
Watcher.time.value=3600
Watcher.time=No time limitation
Watcher.verbose=Verbose\: log
diff --git a/DeconvolutionLab2/src/DeconvolutionLab2.java b/DeconvolutionLab2/src/DeconvolutionLab2.java
index dc11b21..2efede5 100644
--- a/DeconvolutionLab2/src/DeconvolutionLab2.java
+++ b/DeconvolutionLab2/src/DeconvolutionLab2.java
@@ -1,93 +1,93 @@
import java.io.File;
import deconvolution.Command;
import deconvolution.Deconvolution;
import deconvolutionlab.Config;
import deconvolutionlab.Constants;
import deconvolutionlab.Lab;
import deconvolutionlab.Platform;
import deconvolutionlab.dialog.LabDialog;
import deconvolutionlab.monitor.Monitors;
public class DeconvolutionLab2 {
public static String ack = Constants.name + " " + Constants.version + " " + Constants.copyright;
public static void main(String arg[]) {
System.out.println(ack);
Lab.getInstance(Platform.STANDALONE);
if (arg.length == 0) {
lab(arg);
return;
}
String flag = arg[0].trim().toLowerCase();
if (flag.equalsIgnoreCase("help")) {
help();
return;
}
if (flag.equalsIgnoreCase("lab")) {
lab(arg);
}
if (flag.equalsIgnoreCase("fft")) {
Lab.checkFFT(Monitors.createDefaultMonitor());
}
if (flag.equalsIgnoreCase("run")) {
String cmd = "";
for (int i = 1; i < arg.length; i++)
cmd += arg[i] + " ";
new Deconvolution(cmd).deconvolve(true);
}
if (flag.equalsIgnoreCase("launch")) {
String cmd = "";
for (int i = 1; i < arg.length; i++)
cmd += arg[i] + " ";
new Deconvolution(cmd).launch("", true);
}
}
private static void lab(String arg[]) {
String config = System.getProperty("user.dir") + File.separator + "DeconvolutionLab2.config";
if (arg.length >= 2) {
String filename = arg[1].trim();
File file = new File(filename);
if (file.exists())
if (file.isFile())
if (file.canRead())
config = filename;
}
Config.getInstance(config);
LabDialog dialog = new LabDialog();
dialog.setVisible(true);
}
private static void help() {
System.out.println("More info:" + Constants.url);
System.out.println("Syntax:");
- System.out.println("java -jar DeconvolutionLab_2.jar lab [config.txt]");
+ System.out.println("java -jar DeconvolutionLab_2.jar lab");
System.out.println("java -jar DeconvolutionLab_2.jar run {command} ...");
- System.out.println("java -jar DeconvolutionLab_2.jar {command} ...");
+ System.out.println("java -jar DeconvolutionLab_2.jar launch {command} ...");
System.out.println("java -jar DeconvolutionLab_2.jar fft");
System.out.println("java -jar DeconvolutionLab_2.jar info");
System.out.println("java -jar DeconvolutionLab_2.jar help");
System.out.println("{command} is the full command line for running a deconvolution");
System.out.print("Keywords of {command}: ");
for (String keyword : Command.keywords)
System.out.print(keyword + " ");
}
public DeconvolutionLab2(String cmd) {
System.out.println("cmd: " + cmd);
deconvolutionlab.Lab.getInstance(Platform.STANDALONE);
String config = System.getProperty("user.dir") + File.separator + "DeconvolutionLab2.config";
Config.getInstance(config);
new Deconvolution(cmd).deconvolve(false);
}
}
diff --git a/DeconvolutionLab2/src/TestRegex.java b/DeconvolutionLab2/src/TestRegex.java
new file mode 100644
index 0000000..fcb071a
--- /dev/null
+++ b/DeconvolutionLab2/src/TestRegex.java
@@ -0,0 +1,23 @@
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class TestRegex {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ String c = "-image -image -- image image -image \t language -image";
+ String regex = "\bimage\b";
+ Pattern p = Pattern.compile(regex);
+
+ // Check each entry of list to find the correct value
+ Matcher matcher = p.matcher(c);
+
+ while (matcher.find())
+ {
+ System.out.print("Start index: " + matcher.start());
+ System.out.print(" End index: " + matcher.end() + " ");
+ System.out.println(matcher.group());
+ }
+ }
+
+}
diff --git a/DeconvolutionLab2/src/course/DeconvolutionLab2_Course_Piecewise.java b/DeconvolutionLab2/src/course/DeconvolutionLab2_Course_Piecewise.java
new file mode 100644
index 0000000..77eca47
--- /dev/null
+++ b/DeconvolutionLab2/src/course/DeconvolutionLab2_Course_Piecewise.java
@@ -0,0 +1,105 @@
+package course;
+
+import java.io.File;
+import java.util.Random;
+
+import javax.swing.filechooser.FileSystemView;
+
+import deconvolution.Deconvolution;
+import deconvolutionlab.Lab;
+import deconvolutionlab.monitor.Monitors;
+import ij.plugin.PlugIn;
+import signal.RealSignal;
+import signal.factory.Constant;
+import signal.factory.Cube;
+
+public class DeconvolutionLab2_Course_Piecewise implements PlugIn {
+
+ private String desktop = FileSystemView.getFileSystemView().getHomeDirectory().getAbsolutePath() + File.separator + "Desktop";
+ private String root = desktop + File.separator + "DeconvolutionLab2-Course" + File.separator;
+ private String res = root + "Results" + File.separator + "piecewise" + File.separator;
+ private String data = root + "Data" + File.separator + "piecewise" + File.separator;
+
+ public DeconvolutionLab2_Course_Piecewise() {
+
+ Monitors monitors = Monitors.createDefaultMonitor();
+ new File(res).mkdir();
+ System.setProperty("user.dir", res);
+
+ new File(res + "RIF").mkdir();
+ new File(res + "LW").mkdir();
+ new File(res + "LW+").mkdir();
+ new File(res + "RL").mkdir();
+ new File(res + "RLTV").mkdir();
+ new File(res + "ISTA").mkdir();
+ new File(res + "FISTA").mkdir();
+
+ int nx = 128;
+ int ny = 128;
+ int nz = 128;
+ int spacing = 16;
+
+ Random rand = new Random(1234);
+ RealSignal x = new Constant().intensity(0, 10).generate(nx, ny, nz);
+ for(int i = 0; i< 12; i++) {
+ double xc = (rand.nextDouble()*0.6 + 0.2);
+ double yc = (rand.nextDouble()*0.6 + 0.2);
+ double zc = (rand.nextDouble()*0.6 + 0.2);
+ double size = 15 + (rand.nextDouble()*30);
+ double ampl = (rand.nextDouble()+0.5)*10;
+ x.plus(new Cube(size, 0.1).intensity(0, ampl).center(xc, yc, zc).generate(nx, ny, nz));
+ }
+ Lab.show(monitors, x, "reference");
+ Lab.save(monitors, x, res + "ref.tif");
+
+ String algo = " ";
+ String ground = " -image file " + res + "ref.tif ";
+ //String psf = " -psf file ../../Data/resolution/psfgl.tif";
+ String psf = " -psf synthetic gaussian 100.0 0.0 1.2 1.2 3.6 size ";
+ // nx + " " + ny + " " + nz;
+ String signal = " -image file signal.tif -reference " + res + "ref.tif -disable monitor";
+
+ String paramout = " intact float (" + spacing + "," + spacing + "," + spacing + ")";
+
+ algo = " -algorithm CONV -showstats @3 PR -out stack PR -out ortho PRo ";
+ new Deconvolution(ground + "-reference reference.tif -psf synthetic impulse 100 0 size 128 128 128 " + algo).deconvolve(false);
+
+ algo = " -algorithm SIM 0 1 1 -showstats @3 SIM -out stack signal -out ortho SIGNALo ";
+ new Deconvolution(ground + psf + algo).deconvolve(false);
+
+ algo = " -algorithm NIF -out ortho NIF " + paramout;
+ new Deconvolution(signal + psf + algo).deconvolve(false);
+
+ algo = " -algorithm LW+ 15 1.5 -showstats @1 LW+ -out ortho @1 LW+/LW+" + paramout;
+ new Deconvolution(signal + psf + algo).deconvolve(false);
+
+ algo = " -algorithm FISTA 15 1 1 -showstats @1 FISTA -out ortho @1 FISTA/FISTA" + paramout;
+ new Deconvolution(signal + psf + algo).deconvolve(false);
+
+ algo = " -algorithm ISTA 15 1 1 -showstats @1 ISTA -out ortho @1 ISTA/ISTA" + paramout;
+ new Deconvolution(signal + psf + algo).deconvolve(false);
+
+ algo = " -algorithm RLTV 15 0.001 -showstats @1 RLTV -out ortho @1 RLTV/RLTV" + paramout;
+ new Deconvolution(signal + psf + algo).deconvolve(false);
+
+ /*
+ for(int i=0; i<=24; i++) {
+ double p = Math.pow(10, i-18);
+ algo =" -algorithm RIF " + p + " -out ortho @5 RIF/RIF" + i + paramout;
+ new Deconvolution(signal + psf + algo).deconvolve(false);
+ }
+ */
+
+
+ }
+
+ public static void main(String arg[]) {
+ new DeconvolutionLab2_Course_Piecewise();
+ }
+
+ @Override
+ public void run(String arg) {
+ new DeconvolutionLab2_Course_Piecewise();
+ }
+
+}
diff --git a/DeconvolutionLab2/src/course/DeconvolutionLab2_Course_Resolution.java b/DeconvolutionLab2/src/course/DeconvolutionLab2_Course_Resolution.java
index d47a9b4..3655d16 100644
--- a/DeconvolutionLab2/src/course/DeconvolutionLab2_Course_Resolution.java
+++ b/DeconvolutionLab2/src/course/DeconvolutionLab2_Course_Resolution.java
@@ -1,81 +1,84 @@
package course;
import java.io.File;
import javax.swing.filechooser.FileSystemView;
import deconvolution.Deconvolution;
import deconvolutionlab.Lab;
import deconvolutionlab.monitor.Monitors;
import ij.plugin.PlugIn;
import signal.RealSignal;
import signal.factory.GridSpots;
public class DeconvolutionLab2_Course_Resolution implements PlugIn {
private String desktop = FileSystemView.getFileSystemView().getHomeDirectory().getAbsolutePath() + File.separator + "Desktop";
private String root = desktop + File.separator + "DeconvolutionLab2-Course" + File.separator;
private String res = root + "Results" + File.separator + "resolution" + File.separator;
+ private String data = root + "Data" + File.separator + "resolution" + File.separator;
public DeconvolutionLab2_Course_Resolution() {
Monitors monitors = Monitors.createDefaultMonitor();
new File(res).mkdir();
System.setProperty("user.dir", res);
new File(res + "RIF").mkdir();
new File(res + "LW").mkdir();
new File(res + "LW+").mkdir();
+ new File(res + "RL").mkdir();
int nx = 128;
int ny = 128;
int nz = 128;
int spacing = 16;
- RealSignal x = new GridSpots(3, 1, spacing).intensity(0, 10).generate(nx, ny, nz);
+ RealSignal x = new GridSpots(3, 0.1, spacing).intensity(0, 255).generate(nx, ny, nz);
Lab.show(monitors, x, "reference");
- Lab.save(monitors, x, res + "reference.tif");
+ Lab.save(monitors, x, res + "ref.tif");
String algo = " ";
- String ground = " -image file reference.tif ";
- String psf = " -psf file ../../Data/resolution/psf-bw-500.tif ";
- //String psf = " -psf synthetic gaussian 100.0 0.0 1 1 1 size " + nx + " " + ny + " " + nz;
- String signal = " -image file signal.tif -reference reference.tif -monitor table";
+ String ground = " -image file " + res + "ref.tif ";
+ //String psf = " -psf file ../../Data/resolution/psfgl.tif";
+ String psf = " -psf synthetic gaussian 100.0 0.0 1.2 1.2 3.6 size " + nx + " " + ny + " " + nz;
+ String signal = " -image file signal.tif -reference " + res + "ref.tif -disable monitor";
String paramout = " intact float (" + spacing + "," + spacing + "," + spacing + ")";
algo = " -algorithm CONV -showstats @3 PR -out stack PR -out ortho PRo ";
new Deconvolution(ground + "-reference reference.tif -psf synthetic impulse 100 0 size 128 128 128 " + algo).deconvolve(false);
- algo = " -algorithm SIM 0 0.1 0 -showstats @3 SIM -out stack SIGNAL -out ortho SIGNALo ";
+ algo = " -algorithm SIM 0 1.5 0 -showstats @3 SIM -out stack signal -out ortho SIGNALo ";
new Deconvolution(ground + psf + algo).deconvolve(false);
algo = " -algorithm NIF -out ortho NIF " + paramout;
new Deconvolution(signal + psf + algo).deconvolve(false);
- algo = " -algorithm LW+ 17 1 -showstats @3 LW -out ortho @10 LW+/LW+" + paramout;
- new Deconvolution(signal + psf + algo).deconvolve(false);
-
- for(int i=0; i<=15; i++) {
- double p = Math.pow(10, i-15);
- algo = " -algorithm RIF " + p + " -out ortho RIF/RIF" + String.format("%02d", i) + paramout;
+ for(int i=0; i<=24; i++) {
+ double p = Math.pow(10, i-18);
+ algo = " -algorithm RIF " + p + " -out ortho @5 RIF/RIF" + i + paramout;
new Deconvolution(signal + psf + algo).deconvolve(false);
}
-
- algo = " -algorithm LW 11 1 -showstats @3 LW -out ortho @10 LW/LW" + paramout;
+ algo = " -algorithm LW+ 305 1 -showstats @3 LW+ -out ortho @25 LW+/LW+" + paramout;
new Deconvolution(signal + psf + algo).deconvolve(false);
-
+// algo = " -algorithm LW 205 1 -showstats @3 LW -out ortho @25 LW/LW" + paramout;
+// new Deconvolution(signal + psf + algo).deconvolve(false);
+
+// algo = " -algorithm RL 205 1 -showstats @3 RL -constraint Non-negativity -out ortho @25 RL/RL" + paramout;
+// new Deconvolution(signal + psf + algo).deconvolve(false);
+
}
public static void main(String arg[]) {
new DeconvolutionLab2_Course_Resolution();
}
@Override
public void run(String arg) {
new DeconvolutionLab2_Course_Resolution();
}
}
\ No newline at end of file
diff --git a/DeconvolutionLab2/src/deconvolutionlab/dialog/LabDialog.java b/DeconvolutionLab2/src/deconvolutionlab/dialog/LabDialog.java
index eb6a80c..75a8e26 100644
--- a/DeconvolutionLab2/src/deconvolutionlab/dialog/LabDialog.java
+++ b/DeconvolutionLab2/src/deconvolutionlab/dialog/LabDialog.java
@@ -1,371 +1,368 @@
/*
* DeconvolutionLab2
*
* Conditions of use: You are free to use this software for research or
* educational purposes. In addition, we expect you to include adequate
* citations and acknowledgments whenever you present or publish results that
* are based on it.
*
* Reference: DeconvolutionLab2: An Open-Source Software for Deconvolution
* Microscopy D. Sage, L. Donati, F. Soulez, D. Fortun, G. Schmit, A. Seitz,
* R. Guiet, C. Vonesch, M Unser, Methods of Elsevier, 2017.
*/
/*
* Copyright 2010-2017 Biomedical Imaging Group at the EPFL.
*
* This file is part of DeconvolutionLab2 (DL2).
*
* DL2 is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* DL2 is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* DL2. If not, see <http://www.gnu.org/licenses/>.
*/
package deconvolutionlab.dialog;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.util.ArrayList;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.border.Border;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import deconvolution.Command;
import deconvolution.Deconvolution;
import deconvolution.DeconvolutionDialog;
import deconvolutionlab.Config;
import deconvolutionlab.Constants;
import deconvolutionlab.Lab;
import deconvolutionlab.Platform;
import deconvolutionlab.modules.AboutModule;
import deconvolutionlab.modules.AbstractModule;
import deconvolutionlab.modules.AlgorithmModule;
import deconvolutionlab.modules.BatchModule;
import deconvolutionlab.modules.BorderModule;
import deconvolutionlab.modules.CommandModule;
import deconvolutionlab.modules.ConfigModule;
import deconvolutionlab.modules.ControllerModule;
import deconvolutionlab.modules.FFTModule;
import deconvolutionlab.modules.GroupedModulePanel;
import deconvolutionlab.modules.ImageModule;
import deconvolutionlab.modules.LanguageModule;
import deconvolutionlab.modules.LicenceModule;
-import deconvolutionlab.modules.WatcherModule;
import deconvolutionlab.modules.OutputModule;
import deconvolutionlab.modules.PSFModule;
-import lab.component.PanelImage;
+import deconvolutionlab.modules.WatcherModule;
+import lab.component.JPanelImage;
import lab.system.SystemPanel;
public class LabDialog extends JDialog implements ComponentListener, ActionListener, ChangeListener, WindowListener {
private JTabbedPane tab = new JTabbedPane();
private JButton bnHelp = new JButton("Help");
private JButton bnClose = new JButton("Close");
private JButton bnQuit = new JButton("Quit");
private JButton bnBatch = new JButton("Batch");
private JButton bnRun = new JButton("Run");
private JButton bnLaunch = new JButton("Launch");
private JButton bnSystem = new JButton("System");
private ImageModule image;
private PSFModule psf;
private AlgorithmModule algo;
private AboutModule about;
private LicenceModule licence;
private OutputModule output;
private FFTModule fourier;
private BorderModule border;
private ConfigModule config;
private BatchModule batch;
private LanguageModule language;
private CommandModule command;
private WatcherModule watcher;
private ControllerModule controller;
private GroupedModulePanel panelDeconv;
private GroupedModulePanel panelAdvanc;
- private GroupedModulePanel panelProgra;
+ private GroupedModulePanel panelScript;
private GroupedModulePanel panelAbout;
private AbstractModule modules[];
public LabDialog() {
super(new JFrame(), Constants.name);
image = new ImageModule(false);
psf = new PSFModule(false);
algo = new AlgorithmModule(true);
output = new OutputModule(true);
fourier = new FFTModule(false);
border = new BorderModule(false);
controller = new ControllerModule(false);
batch = new BatchModule(false);
language = new LanguageModule(false);
about = new AboutModule(true);
licence = new LicenceModule(false);
config = new ConfigModule(false);
command = new CommandModule();
watcher = new WatcherModule(false);
doDialog();
modules = new AbstractModule[] { image, psf, algo, output, controller, border, fourier, watcher, batch };
Command.active(modules, command);
Command.command();
addWindowListener(this);
addComponentListener(this);
((GroupedModulePanel) tab.getSelectedComponent()).organize();
setMinimumSize(new Dimension(500, 500));
Config.registerFrame("DeconvolutionLab", "MainDialog", this);
pack();
setVisible(true);
Config.load();
sizeModule();
Command.command();
image.update();
psf.update();
output.update();
}
private void doDialog() {
panelDeconv = new GroupedModulePanel(buildDeconvolutionPanel(), this);
panelAdvanc = new GroupedModulePanel(buildAdvancedPanel(), this);
- panelProgra = new GroupedModulePanel(buildProgrammingPanel(), this);
+ panelScript = new GroupedModulePanel(buildProgrammingPanel(), this);
panelAbout = new GroupedModulePanel(buildAboutPanel(), this);
- PanelImage bottom = new PanelImage("celegans.jpg");
+ JPanelImage bottom = new JPanelImage("celegans.jpg");
bottom.setLayout(new GridLayout(1, 7));
Border b2 = BorderFactory.createEmptyBorder(10, 10, 10, 10);
bottom.setBorder(b2);
bottom.add(bnHelp);
bottom.add(bnSystem);
bottom.add(bnQuit);
bottom.add(bnClose);
bottom.add(bnBatch);
bottom.add(bnRun);
bottom.add(bnLaunch);
tab.add("Deconvolution", panelDeconv);
tab.add("Advanced", panelAdvanc);
- tab.add("Programming", panelProgra);
+ tab.add("Scripting", panelScript);
tab.add("About", panelAbout);
tab.addChangeListener(this);
JPanel base = new JPanel(new BorderLayout());
base.add(bottom, BorderLayout.CENTER);
//base.add(statusBar, BorderLayout.SOUTH);
-
+ //PanelImage pi = new PanelImage("logo.png", 380, 75);
+ //pi.setPreferredSize(new Dimension(400, 75));
+ //add(pi, BorderLayout.NORTH);
add(tab, BorderLayout.CENTER);
add(base, BorderLayout.SOUTH);
bnBatch.addActionListener(this);
bnRun.addActionListener(this);
bnLaunch.addActionListener(this);
bnClose.addActionListener(this);
bnHelp.addActionListener(this);
- bnQuit.addActionListener(this);
bnSystem.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == bnHelp) {
Lab.help();
}
else if (e.getSource() == bnSystem) {
SystemPanel.show(400, 400);
}
else if (e.getSource() == bnClose) {
Config.store();
- close();
dispose();
}
- else if (e.getSource() == bnQuit) {
- close();
+ else if (e.getSource() == bnClose) {
dispose();
}
else if (e.getSource() == bnBatch) {
tab.setSelectedIndex(2);
batch.expand();
sizeModule();
new BatchDialog(batch);
}
else if (e.getSource() == bnLaunch) {
new Deconvolution(Command.command()).launch("", false);
}
else if (e.getSource() == bnRun) {
new Deconvolution(Command.command()).deconvolve(false);
}
}
@Override
public void stateChanged(ChangeEvent e) {
((GroupedModulePanel) tab.getSelectedComponent()).organize();
Command.command();
}
private ArrayList<AbstractModule> buildDeconvolutionPanel() {
ArrayList<AbstractModule> list = new ArrayList<AbstractModule>();
list.add(image);
list.add(psf);
list.add(algo);
list.add(watcher);
return list;
}
private ArrayList<AbstractModule> buildAdvancedPanel() {
ArrayList<AbstractModule> list = new ArrayList<AbstractModule>();
list.add(output);
list.add(controller);
list.add(border);
list.add(fourier);
return list;
}
private ArrayList<AbstractModule> buildProgrammingPanel() {
ArrayList<AbstractModule> list = new ArrayList<AbstractModule>();
list.add(batch);
list.add(command);
list.add(language);
return list;
}
private ArrayList<AbstractModule> buildAboutPanel() {
ArrayList<AbstractModule> list = new ArrayList<AbstractModule>();
list.add(about);
list.add(licence);
list.add(config);
return list;
}
@Override
public void windowOpened(WindowEvent e) {
}
@Override
public void windowClosing(WindowEvent e) {
Config.store();
- close();
dispose();
}
@Override
public void windowClosed(WindowEvent e) {
}
@Override
public void windowIconified(WindowEvent e) {
}
@Override
public void windowDeiconified(WindowEvent e) {
}
@Override
public void windowActivated(WindowEvent e) {
}
@Override
public void windowDeactivated(WindowEvent e) {
}
private void close() {
for (AbstractModule module : modules)
module.close();
bnLaunch.removeActionListener(this);
bnRun.removeActionListener(this);
bnBatch.removeActionListener(this);
bnClose.removeActionListener(this);
bnHelp.removeActionListener(this);
- bnQuit.removeActionListener(this);
removeWindowListener(this);
}
@Override
public void dispose() {
super.dispose();
if (Lab.getPlatform() == Platform.STANDALONE) System.exit(0);
}
@Override
public void componentResized(ComponentEvent e) {
sizeModule();
}
@Override
public void componentMoved(ComponentEvent e) {
Point p = this.getLocation();
p.x += this.getWidth();
DeconvolutionDialog.setLocationLaunch(p);
}
@Override
public void componentShown(ComponentEvent e) {
sizeModule();
}
@Override
public void componentHidden(ComponentEvent e) {
}
public void sizeModule() {
if (tab.getSelectedIndex() == 0) sizePanel(panelDeconv);
if (tab.getSelectedIndex() == 1) sizePanel(panelAdvanc);
- if (tab.getSelectedIndex() == 2) sizePanel(panelProgra);
+ if (tab.getSelectedIndex() == 2) sizePanel(panelScript);
if (tab.getSelectedIndex() == 3) sizePanel(panelAbout);
}
private void sizePanel(GroupedModulePanel panel) {
Dimension dim = getSize();
int hpc = 60;
int npc = hpc * panel.getModules().size();
Dimension small = new Dimension(dim.width, hpc);
Dimension large = new Dimension(dim.width, dim.height - npc);
for (AbstractModule module : panel.getModules()) {
if (module.isExpanded()) {
module.setPreferredSize(large);
module.setMaximumSize(large);
module.setMinimumSize(small);
module.getExpandedPanel().setPreferredSize(large);
module.getExpandedPanel().setMaximumSize(large);
module.getExpandedPanel().setMinimumSize(small);
}
else {
module.setPreferredSize(small);
module.setMaximumSize(small);
module.setMinimumSize(small);
module.getCollapsedPanel().setPreferredSize(small);
module.getCollapsedPanel().setMaximumSize(small);
module.getCollapsedPanel().setMinimumSize(small);
}
}
}
}
diff --git a/DeconvolutionLab2/src/lab/component/PanelImage.java b/DeconvolutionLab2/src/lab/component/PanelImage.java
index 2c7037a..a0229c7 100644
--- a/DeconvolutionLab2/src/lab/component/PanelImage.java
+++ b/DeconvolutionLab2/src/lab/component/PanelImage.java
@@ -1,30 +1,45 @@
package lab.component;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JPanel;
public class PanelImage extends JPanel {
- private Image image;
+ private Image image;
+ private int w = -1;
+ private int h = -1;
public PanelImage(String filename) {
super();
image = ImageLoader.get(filename);
}
+ public PanelImage(String filename, int w, int h) {
+ super();
+ image = ImageLoader.get(filename);
+ this.w = w;
+ this.h = h;
+ }
+
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (image != null) {
- g.drawImage(image, 0, 0, getWidth(), getHeight(), null);
+ if (w < 0)
+ g.drawImage(image, getWidth(), 0, getWidth(), getHeight(), null);
+ else {
+ g.setColor(Color.WHITE);
+ g.fillRect(0, 0, getWidth(), getHeight());
+ g.drawImage(image, (getWidth()-w)/2, 0, w, h, null);
+ }
}
else {
g.setColor(Color.DARK_GRAY);
g.fillRect(0, 0, getWidth(), getHeight());
}
}
}
diff --git a/DeconvolutionLab2/src/signal/factory/Airy.java b/DeconvolutionLab2/src/signal/factory/AirySimulated.java
similarity index 91%
rename from DeconvolutionLab2/src/signal/factory/Airy.java
rename to DeconvolutionLab2/src/signal/factory/AirySimulated.java
index c1dfea0..644d04a 100644
--- a/DeconvolutionLab2/src/signal/factory/Airy.java
+++ b/DeconvolutionLab2/src/signal/factory/AirySimulated.java
@@ -1,79 +1,80 @@
/*
* DeconvolutionLab2
*
* Conditions of use: You are free to use this software for research or
* educational purposes. In addition, we expect you to include adequate
* citations and acknowledgments whenever you present or publish results that
* are based on it.
*
* Reference: DeconvolutionLab2: An Open-Source Software for Deconvolution
* Microscopy D. Sage, L. Donati, F. Soulez, D. Fortun, G. Schmit, A. Seitz,
* R. Guiet, C. Vonesch, M Unser, Methods of Elsevier, 2017.
*/
/*
* Copyright 2010-2017 Biomedical Imaging Group at the EPFL.
*
* This file is part of DeconvolutionLab2 (DL2).
*
* DL2 is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* DL2 is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* DL2. If not, see <http://www.gnu.org/licenses/>.
*/
package signal.factory;
import deconvolutionlab.monitor.Monitors;
import fft.AbstractFFT;
import fft.FFT;
import signal.ComplexSignal;
import signal.RealSignal;
import signal.factory.complex.ComplexSignalFactory;
-public class Airy extends SignalFactory {
+public class AirySimulated extends SignalFactory {
private double mu = 1.0;
- public Airy(double mu) {
+ public AirySimulated(double mu) {
super(new double[] {mu});
}
@Override
public String getName() {
- return "Airy";
+ return "AirySimulated";
}
@Override
public String[] getParametersName() {
return new String[] {"Parameter (mu)"};
}
@Override
public void setParameters(double[] parameters) {
if (parameters.length >= 1)
this.mu = parameters[0];
}
@Override
public double[] getParameters() {
return new double[] {mu};
}
@Override
public void fill(RealSignal signal) {
AbstractFFT fft = FFT.createDefaultFFT(Monitors.createDefaultMonitor(), nx, ny, nz);
- ComplexSignal C = ComplexSignalFactory.airy(nx, ny, nz, mu);
+ ComplexSignal C = ComplexSignalFactory.airySimulated(nx, ny, nz, mu);
RealSignal s = fft.inverse(C).circular().times((float)amplitude);
+ s.times(s);
signal.copy(s);
}
}
diff --git a/DeconvolutionLab2/src/signal/factory/Cube.java b/DeconvolutionLab2/src/signal/factory/Cube.java
index 1f2584a..1af4c5a 100644
--- a/DeconvolutionLab2/src/signal/factory/Cube.java
+++ b/DeconvolutionLab2/src/signal/factory/Cube.java
@@ -1,84 +1,85 @@
/*
* DeconvolutionLab2
*
* Conditions of use: You are free to use this software for research or
* educational purposes. In addition, we expect you to include adequate
* citations and acknowledgments whenever you present or publish results that
* are based on it.
*
* Reference: DeconvolutionLab2: An Open-Source Software for Deconvolution
* Microscopy D. Sage, L. Donati, F. Soulez, D. Fortun, G. Schmit, A. Seitz,
* R. Guiet, C. Vonesch, M Unser, Methods of Elsevier, 2017.
*/
/*
* Copyright 2010-2017 Biomedical Imaging Group at the EPFL.
*
* This file is part of DeconvolutionLab2 (DL2).
*
* DL2 is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* DL2 is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* DL2. If not, see <http://www.gnu.org/licenses/>.
*/
package signal.factory;
import signal.RealSignal;
public class Cube extends SignalFactory {
private double side = 10;
private double slope = 1;
public Cube(double side, double slope) {
super(new double[] {side, slope});
+ setParameters(new double[] {side, slope});
}
@Override
public String getName() {
return "Cube";
}
@Override
public String[] getParametersName() {
return new String[] {"Side", "Sigmoid Curve Slope"};
}
@Override
public void setParameters(double[] parameters) {
if (parameters.length >= 1)
this.side = parameters[0];
if (parameters.length >= 2)
this.slope = parameters[1];
}
@Override
public double[] getParameters() {
return new double[] {side, slope};
}
@Override
public void fill(RealSignal signal) {
double A = (amplitude-background);
for(int x=0; x<nx; x++)
for(int y=0; y<ny; y++)
for(int z=0; z<nz; z++) {
double dx = Math.sqrt((x-xc)*(x-xc)) - side;
double dy = Math.sqrt((y-yc)*(y-yc)) - side;
double dz = Math.sqrt((z-zc)*(z-zc)) - side;
double rx = 1.0- 1.0 / (1.0 + Math.exp(-dx/slope));
double ry = 1.0- 1.0 / (1.0 + Math.exp(-dy/slope));
double rz = 1.0- 1.0 / (1.0 + Math.exp(-dz/slope));
signal.data[z][x+nx*y] = (float)(A * (rx *ry * rz) + background);
}
}
}
diff --git a/DeconvolutionLab2/src/signal/factory/RandomLines.java b/DeconvolutionLab2/src/signal/factory/RandomLines.java
index 18b9e60..36385b6 100644
--- a/DeconvolutionLab2/src/signal/factory/RandomLines.java
+++ b/DeconvolutionLab2/src/signal/factory/RandomLines.java
@@ -1,108 +1,108 @@
package signal.factory;
import java.util.Random;
/*
* DeconvolutionLab2
*
* Conditions of use: You are free to use this software for research or
* educational purposes. In addition, we expect you to include adequate
* citations and acknowledgments whenever you present or publish results that
* are based on it.
*
* Reference: DeconvolutionLab2: An Open-Source Software for Deconvolution
* Microscopy D. Sage, L. Donati, F. Soulez, D. Fortun, G. Schmit, A. Seitz,
* R. Guiet, C. Vonesch, M Unser, Methods of Elsevier, 2017.
*/
/*
* Copyright 2010-2017 Biomedical Imaging Group at the EPFL.
*
* This file is part of DeconvolutionLab2 (DL2).
*
* DL2 is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* DL2 is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* DL2. If not, see <http://www.gnu.org/licenses/>.
*/
import signal.RealSignal;
public class RandomLines extends SignalFactory {
private double number = 3.0;
public RandomLines(double number) {
super(new double[] {number});
}
@Override
public String getName() {
return "RandomLines";
}
@Override
public String[] getParametersName() {
return new String[] { "Number of lines" };
}
@Override
public void setParameters(double[] parameters) {
if (parameters.length >= 1) this.number = parameters[0];
}
@Override
public double[] getParameters() {
return new double[] { number };
}
@Override
public void fill(RealSignal signal) {
Random rand = new Random(12345);
float A = (float)(amplitude - background);
signal.fill((float) (background));
double Q = Math.sqrt(3)*1.5;
for (int index = 0; index < number; index++) {
double x1 = -rand.nextDouble() * nx;
double x2 = nx + rand.nextDouble() * nx;
- double y1 = 0.1 + rand.nextDouble() * ny * 0.8;
- double y2 = 0.1 + rand.nextDouble() * ny * 0.8;
- double z1 = 0.1 + rand.nextDouble() * nz * 0.8;
- double z2 = 0.1 + rand.nextDouble() * nz * 0.8;
+ double y1 = (-0.1 + rand.nextDouble() * 1.2) * ny;
+ double y2 = (-0.1 + rand.nextDouble() * 1.2) * ny;
+ double z1 = (-0.1 + rand.nextDouble() * 1.2) * nz;
+ double z2 = (-0.1 + rand.nextDouble() * 1.2) * nz;
double d = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2);
d = Math.sqrt(d);
int n = (int) (d / 0.3);
double dx = (x2 - x1) / d;
double dy = (y2 - y1) / d;
double dz = (z2 - z1) / d;
for (int s = 0; s < n; s++) {
double x = x1 + s * dx;
int i = (int) Math.round(x);
if (i >= 1 && i < nx-1) {
double y = y1 + s * dy;
int j = (int) Math.round(y);
if (j >= 1 && j < ny-1) {
double z = z1 + s * dz;
int k = (int) Math.round(z);
if (k >= 1 && k < nz-1) {
- for(int ii=i-1; ii<=i+1; ii++)
- for(int jj=j-1; jj<=j+1; jj++)
- for(int kk=k-1; kk<=k+1; kk++) {
- double p = Q - Math.sqrt((x - ii) * (x - ii) + (y - jj) * (y - jj) + (z - kk) * (z - kk));
- signal.data[kk][ii + nx * jj] = Math.max(signal.data[kk][ii + nx * jj], (float)(p*A));
- }
+ //for(int ii=i-1; ii<=i+1; ii++)
+ //for(int jj=j-1; jj<=j+1; jj++)
+ //for(int kk=k-1; kk<=k+1; kk++) {
+ double p = Q - Math.sqrt((x - i) * (x - i) + (y - j) * (y - j) + (z - k) * (z - k));
+ signal.data[k][i + nx * j] = Math.max(signal.data[k][i + nx * j], (float)(p*A));
+ //}
}
}
}
}
}
}
}
diff --git a/DeconvolutionLab2/src/signal/factory/SignalFactory.java b/DeconvolutionLab2/src/signal/factory/SignalFactory.java
index 0bb23e6..c7f0fae 100644
--- a/DeconvolutionLab2/src/signal/factory/SignalFactory.java
+++ b/DeconvolutionLab2/src/signal/factory/SignalFactory.java
@@ -1,210 +1,210 @@
/*
* DeconvolutionLab2
*
* Conditions of use: You are free to use this software for research or
* educational purposes. In addition, we expect you to include adequate
* citations and acknowledgments whenever you present or publish results that
* are based on it.
*
* Reference: DeconvolutionLab2: An Open-Source Software for Deconvolution
* Microscopy D. Sage, L. Donati, F. Soulez, D. Fortun, G. Schmit, A. Seitz,
* R. Guiet, C. Vonesch, M Unser, Methods of Elsevier, 2017.
*/
/*
* Copyright 2010-2017 Biomedical Imaging Group at the EPFL.
*
* This file is part of DeconvolutionLab2 (DL2).
*
* DL2 is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* DL2 is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* DL2. If not, see <http://www.gnu.org/licenses/>.
*/
package signal.factory;
import java.util.ArrayList;
import javax.swing.SwingWorker;
import signal.RealSignal;
public abstract class SignalFactory {
protected double fractXC = 0.5;
protected double fractYC = 0.5;
protected double fractZC = 0.5;
protected double background = 0.0;
protected double amplitude = 1.0;
protected double xc;
protected double yc;
protected double zc;
protected int nx;
protected int ny;
protected int nz;
public SignalFactory() {
}
public SignalFactory(double[] parameters) {
setParameters(parameters);
}
public static SignalFactory get(String name) {
ArrayList<SignalFactory> list = getAll();
for (SignalFactory factory : list) {
if (factory.getName().equals(name))
return factory;
}
return null;
}
public static ArrayList<String> getAllName() {
ArrayList<String> list = new ArrayList<String>();
for (SignalFactory factory : getAll()) {
list.add(factory.getName());
}
return list;
}
public static ArrayList<SignalFactory> getAll() {
ArrayList<SignalFactory> list = new ArrayList<SignalFactory>();
- list.add(new Airy(1));
+ list.add(new AirySimulated(1));
list.add(new Astigmatism(3, 0.2));
list.add(new Constant());
list.add(new Cross(1, 1, 30));
list.add(new Cube(10 ,1));
list.add(new Defocus(3, 10, 10));
list.add(new DoG(3, 4));
list.add(new DoubleHelix(3, 10, 10));
list.add(new Gaussian(3, 3, 3));
list.add(new GridSpots(3, 1, 10));
list.add(new Impulse());
//list.add(new MotionBlur(3, 30, 3));
list.add(new Ramp(1, 0, 0));
list.add(new RandomLines(3));
list.add(new Sinc(3, 3, 3));
list.add(new Sphere(10, 1));
list.add(new Torus(10));
return list;
}
public static ArrayList<SignalFactory> getImages() {
ArrayList<SignalFactory> list = new ArrayList<SignalFactory>();
list.add(new Cube(10, 1));
list.add(new Sphere(10, 1));
list.add(new GridSpots(3, 1, 10));
list.add(new Constant());
list.add(new Cross(1, 1, 30));
list.add(new DoG(3, 4));
list.add(new Gaussian(3, 3, 3));
list.add(new Impulse());
list.add(new Ramp(1, 0, 0));
list.add(new RandomLines(3));
list.add(new Torus(10));
return list;
}
public static ArrayList<SignalFactory> getPSF() {
ArrayList<SignalFactory> list = new ArrayList<SignalFactory>();
- list.add(new Airy(1));
+ list.add(new AirySimulated(1));
list.add(new Astigmatism(3, 0.2));
list.add(new Cross(3, 1, 10));
list.add(new Cube(10, 1));
list.add(new Defocus(3, 10, 10));
list.add(new DoG(3, 4));
list.add(new DoubleHelix(3, 10, 10));
list.add(new Gaussian(3, 3, 3));
//list.add(new MotionBlur(3, 30, 3));
list.add(new Impulse());
list.add(new Sinc(3, 3, 3));
list.add(new Sphere(10, 1));
list.add(new RandomLines(3));
list.add(new Torus(10));
return list;
}
public static SignalFactory getFactoryByName(String name) {
ArrayList<SignalFactory> list = getAll();
for (SignalFactory factory : list)
if (name.toLowerCase().equals(factory.getName().toLowerCase())) {
return factory;
}
return null;
}
public SignalFactory center(double fractXC, double fractYC, double fractZC) {
this.fractXC = fractXC;
this.fractYC = fractYC;
this.fractZC = fractZC;
return this;
}
public SignalFactory intensity(double background, double amplitude) {
this.background = background;
this.amplitude = amplitude;
return this;
}
public String params() {
String name[] = getParametersName();
double params[] = getParameters();
if (params.length == 1)
return name[0] + "=" + params[0];
else if (params.length == 2)
return name[0] + "=" + params[0] + " " + name[1] + "=" + params[1];
else
return name[0] + "=" + params[0] + " " + name[1] + "=" + params[2] + " " + name[2] + "=" + params[2];
}
public RealSignal generate(int nx, int ny, int nz) {
this.nx = nx;
this.ny = ny;
this.nz = nz;
xc = fractXC * nx;
yc = fractYC * ny;
zc = fractZC * nz;
RealSignal signal = new RealSignal(nx, ny, nz);
fill(signal);
return signal;
}
public abstract String getName();
public abstract void setParameters(double[] parameters);
public abstract double[] getParameters();
public abstract String[] getParametersName();
public abstract void fill(RealSignal signal);
public class Worker extends SwingWorker<RealSignal, String> {
private RealSignal signal;
public boolean done=false;
public Worker(RealSignal signal) {
this.signal = signal;
done = false;
}
protected RealSignal doInBackground() throws Exception {
fill(signal);
done = true;
return signal;
}
protected void done() {
done = true;
}
}
}
diff --git a/DeconvolutionLab2/src/signal/factory/complex/ComplexSignalFactory.java b/DeconvolutionLab2/src/signal/factory/complex/ComplexSignalFactory.java
index 0496635..6cda8b9 100644
--- a/DeconvolutionLab2/src/signal/factory/complex/ComplexSignalFactory.java
+++ b/DeconvolutionLab2/src/signal/factory/complex/ComplexSignalFactory.java
@@ -1,148 +1,151 @@
/*
* DeconvolutionLab2
*
* Conditions of use: You are free to use this software for research or
* educational purposes. In addition, we expect you to include adequate
* citations and acknowledgments whenever you present or publish results that
* are based on it.
*
* Reference: DeconvolutionLab2: An Open-Source Software for Deconvolution
* Microscopy D. Sage, L. Donati, F. Soulez, D. Fortun, G. Schmit, A. Seitz,
* R. Guiet, C. Vonesch, M Unser, Methods of Elsevier, 2017.
*/
/*
* Copyright 2010-2017 Biomedical Imaging Group at the EPFL.
*
* This file is part of DeconvolutionLab2 (DL2).
*
* DL2 is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* DL2 is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* DL2. If not, see <http://www.gnu.org/licenses/>.
*/
package signal.factory.complex;
import signal.ComplexSignal;
public class ComplexSignalFactory {
public static ComplexSignal gaussian(int nx, int ny, int nz, double sigma) {
double K = sigma * sigma / 2.0;
int xsize = nx / 2;
int ysize = ny / 2;
int zsize = nz / 2;
float[][][] function = new float[xsize + 1][ysize + 1][zsize + 1];
double wx, wy, wz, wr;
for (int z = 0; z <= zsize; z++)
for (int y = 0; y <= ysize; y++)
for (int x = 0; x <= xsize; x++) {
wx = Math.PI * x / xsize;
wy = Math.PI * y / ysize;
wz = Math.PI * z / ysize;
wr = Math.sqrt(wx * wx + wy * wy + wz * wz);
function[x][y][z] = (float) Math.exp(-wr * wr * K);
}
return createHermitian(nx, ny, nz, function);
}
public static ComplexSignal identity(int nx, int ny, int nz) {
int xsize = nx / 2;
int ysize = ny / 2;
int zsize = nz / 2;
float[][][] function = new float[xsize + 1][ysize + 1][zsize + 1];
for (int z = 0; z <= zsize; z++)
for (int y = 0; y <= ysize; y++)
for (int x = 0; x <= xsize; x++)
function[x][y][z] = 1.0f;
return createHermitian(nx, ny, nz, function);
}
public static ComplexSignal laplacian(int nx, int ny, int nz) {
int xsize = nx / 2;
int ysize = ny / 2;
int zsize = nz / 2;
float[][][] function = new float[xsize + 1][ysize + 1][zsize + 1];
double wx, wy, wz;
for (int z = 0; z <= zsize; z++)
for (int y = 0; y <= ysize; y++)
for (int x = 0; x <= xsize; x++) {
wx = Math.PI * x / xsize;
wy = Math.PI * y / ysize;
wz = Math.PI * z / ysize;
function[x][y][z] = (float) ((wx * wx + wy * wy + wz * wz));
}
return createHermitian(nx, ny, nz, function);
}
- public static ComplexSignal airy(int nx, int ny, int nz, double mu) {
+ public static ComplexSignal airySimulated(int nx, int ny, int nz, double mu) {
int xsize = nx / 2;
int ysize = ny / 2;
- double K = ysize / 2.0;
int zsize = nz / 2;
+ double K = ysize/2;
float[][][] function = new float[xsize + 1][ysize + 1][zsize + 1];
double wx, wy, wz, wr;
for (int z = 0; z <= zsize; z++)
for (int y = 0; y <= ysize; y++)
for (int x = 0; x <= xsize; x++) {
wx = Math.PI * x / xsize;
wy = Math.PI * y / ysize;
wz = Math.PI * z / ysize;
- wr = Math.sqrt(wx * wx + wy * wy + wz * wz);
- function[x][y][z] = (float) (1.0 - 1.0 / (1.0 + Math.exp(-K * (wr - mu))) + 1.0 / (1.0 + Math.exp(-K * (wr - 0.6 * mu))) - 1.0 / (1.0 + Math.exp(-K * (wr - 0.4 * mu))));
+ wr = Math.sqrt(wx * wx + wy * wy + wz*wz);
+ function[x][y][z] =
+ (float) (1.0 - 1.0 / (1.0 + Math.exp(-K * (wr - mu)))
+ + 1.0 / (1.0 + Math.exp(-K * (wr - 0.6 * mu)))
+ - 1.0 / (1.0 + Math.exp(-K * (wr - 0.4 * mu))));
}
return createHermitian(nx, ny, nz, function);
}
public static ComplexSignal createHermitian(int nx, int ny, int nz, float[][][] firstQuadrant) {
ComplexSignal signal = new ComplexSignal(nx, ny, nz);
int xsize = firstQuadrant.length - 1;
int ysize = firstQuadrant[0].length - 1;
int zsize = firstQuadrant[0][0].length - 1;
if (xsize >= 1 && ysize >= 1 && zsize >= 1) {
for (int z = 0; z <= zsize; z++)
for (int y = 0; y <= ysize; y++)
for (int x = 0; x <= xsize; x++) {
signal.data[z][2 * (x + nx * y)] = firstQuadrant[x][y][z];
}
for (int z = 0; z < zsize; z++)
for (int y = 0; y < ysize; y++)
for (int x = 0; x < xsize; x++) {
int a = nx - 1 - x;
int b = nx * (ny - 1 - y);
signal.data[z][2 * (a + nx * y)] = firstQuadrant[x + 1][y][z];
signal.data[z][2 * (a + b)] = firstQuadrant[x + 1][y + 1][z];
signal.data[z][2 * (x + b)] = firstQuadrant[x][y + 1][z];
int c = nz - 1 - z;
signal.data[c][2 * (x + nx * y)] = firstQuadrant[x][y][z + 1];
signal.data[c][2 * (a + nx * y)] = firstQuadrant[x + 1][y][z + 1];
signal.data[c][2 * (a + b)] = firstQuadrant[x + 1][y + 1][z + 1];
signal.data[c][2 * (x + b)] = firstQuadrant[x][y + 1][z + 1];
}
}
if (zsize == 0) {
for (int y = 0; y <= ysize; y++)
for (int x = 0; x <= xsize; x++) {
signal.data[0][2 * (x + nx * y)] = firstQuadrant[x][y][0];
}
for (int y = 0; y < ysize; y++)
for (int x = 0; x < xsize; x++) {
int a = nx - 1 - x;
int b = nx * (ny - 1 - y);
signal.data[0][2 * (a + nx * y)] = firstQuadrant[x + 1][y][0];
signal.data[0][2 * (a + b)] = firstQuadrant[x + 1][y + 1][0];
signal.data[0][2 * (x + b)] = firstQuadrant[x][y + 1][0];
}
}
return signal;
}
}

Event Timeline