Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96327848
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Dec 25, 08:46
Size
33 KB
Mime Type
application/octet-stream
Expires
Fri, Dec 27, 08:46 (2 d)
Engine
blob
Format
Raw Data
Handle
23171301
Attached To
R2075 deconvolution
View Options
diff --git a/DeconvolutionLab2/DeconvolutionLab2.config b/DeconvolutionLab2/DeconvolutionLab2.config
index 0341ed5..fa32aa7 100644
--- a/DeconvolutionLab2/DeconvolutionLab2.config
+++ b/DeconvolutionLab2/DeconvolutionLab2.config
@@ -1,83 +1,84 @@
#DeconvolutionLab2 [Beta 1]
#DeconvolutionLab2 [Beta 1]
-#Sun Feb 05 16:18:49 CET 2017
+#Tue Feb 07 19:01:05 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=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
+Algorithm.algorithm=Richardson-Lucy
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=608
DeconvolutionLab.MainDialog.location.w=502
-DeconvolutionLab.MainDialog.location.x=372
-DeconvolutionLab.MainDialog.location.y=70
+DeconvolutionLab.MainDialog.location.x=337
+DeconvolutionLab.MainDialog.location.y=53
Fourier.dim=XYZ
Fourier.epsilon=1E-6
Fourier.fft=Academic
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=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
+PSF.psf.row0=Cube;synthetic;Cube 100.0 0.0 10.0 1.0 size 128 128 32 ;
+PSF.psf.row1=AirySimulated;synthetic;AirySimulated 100.0 0.0 10.0 size 128 128 32 ;null
+PSF.psf.row2=AirySimulated;synthetic;AirySimulated 100.0 0.0 1.0 size 128 128 32 ;null
+PSF.psf.row3=AirySimulated;synthetic;AirySimulated 100.0 0.0 10.0 10.0 size 128 128 32 ;null
+PSF.psf.row4=Airy;synthetic;Airy 100.0 0.0 10.0 10.0 size 128 128 32 ;null
+PSF.psf.row5=Airy;synthetic;Airy 100.0 0.0 1.0 size 128 128 32 ;null
+PSF.psf.selected=Cube;synthetic;Cube 100.0 0.0 10.0 1.0 size 128 128 32 ;
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/TestRegex.java b/DeconvolutionLab2/src/TestRegex.java
deleted file mode 100644
index fcb071a..0000000
--- a/DeconvolutionLab2/src/TestRegex.java
+++ /dev/null
@@ -1,23 +0,0 @@
-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/deconvolution/Command.java b/DeconvolutionLab2/src/deconvolution/Command.java
index 3ee918d..7c82eed 100644
--- a/DeconvolutionLab2/src/deconvolution/Command.java
+++ b/DeconvolutionLab2/src/deconvolution/Command.java
@@ -1,286 +1,299 @@
/*
* 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 deconvolution;
import java.util.ArrayList;
import java.util.Collections;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import lab.tools.NumFormat;
import signal.Constraint;
import signal.apodization.AbstractApodization;
import signal.apodization.Apodization;
import signal.apodization.UniformApodization;
import signal.padding.AbstractPadding;
import signal.padding.NoPadding;
import signal.padding.Padding;
import wavelets.Wavelets;
import deconvolution.algorithm.AbstractAlgorithm;
import deconvolution.algorithm.Algorithm;
import deconvolution.algorithm.Controller;
import deconvolutionlab.Output;
import deconvolutionlab.Output.View;
import deconvolutionlab.modules.AbstractModule;
import deconvolutionlab.modules.CommandModule;
import deconvolutionlab.modules.LanguageModule;
import deconvolutionlab.monitor.ConsoleMonitor;
import deconvolutionlab.monitor.Monitors;
import deconvolutionlab.monitor.TableMonitor;
public class Command {
- public static String keywords[] = {
- "-image", "-psf", "-algorithm",
- "-path", "-disable", "-verbose", "-time",
- "-constraint", "-residu", "-reference", "-savestats", "-showstats",
- "-out", "-pad", "-apo", "-norm", "-fft"
- };
+ public static String keywords[] = { "-image", "-psf", "-algorithm", "-path", "-disable", "-verbose", "-time", "-constraint", "-residu", "-reference", "-savestats", "-showstats", "-out", "-pad", "-apo", "-norm", "-fft" };
private static AbstractModule modules[];
- private static CommandModule command;
+ private static CommandModule command;
public static void active(AbstractModule[] m, CommandModule c) {
modules = m;
command = c;
}
public static String command() {
if (modules == null)
return "";
String cmd = "";
for (AbstractModule m : modules)
cmd += m.getCommand() + " ";
if (command != null)
command.setCommand(cmd);
-
+
return cmd;
}
/**
- * This methods first segments the command line, then create all the tokens of the command line
+ * This methods first segments the command line, then create all the tokens
+ * of the command line
*
- * @param command Command line
+ * @param command
+ * Command line
* @return the list of tokens extracted from the command line
*/
public static ArrayList<Token> parse(String command) {
-
+
ArrayList<CommandSegment> segments = new ArrayList<CommandSegment>();
- for (String keyword : keywords) {
+ for (String keyword : keywords)
segments.addAll(findSegment(command, keyword));
- }
- Collections.sort(segments);
-
+
ArrayList<Token> tokens = new ArrayList<Token>();
+ for(int i=0; i<segments.size(); i++) {
+ String keyword = segments.get(i).keyword;
+ int begin = segments.get(i).index+keyword.length()+1;
+ int end = (i<segments.size()-1 ? segments.get(i+1).index : command.length());
+ Token token = new Token(keyword, command, begin, end);
+ tokens.add(token);
+ }
+
+ /*
for (int i = 0; i < segments.size(); i++) {
CommandSegment segment = segments.get(i);
String next = (i + 1 < segments.size() ? segments.get(i + 1).keyword : "");
int end = (i + 1 < segments.size() ? segments.get(i + 1).index - next.length() : command.length());
tokens.add(new Token(segment.keyword, command, segment.index, end));
}
+ */
+
return tokens;
}
public static Token extract(String command, String keyword) {
ArrayList<Token> tokens = parse(command);
- for(Token token : tokens)
+ for (Token token : tokens)
if (token.keyword.equalsIgnoreCase(keyword))
return token;
- return (Token)null;
+ return (Token) null;
}
public static double[] parseNumeric(String line) {
ArrayList<String> num = new ArrayList<String>();
Pattern p = Pattern.compile("[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?");
Matcher m = p.matcher(line);
while (m.find()) {
num.add(m.group());
}
double number[] = new double[num.size()];
for (int i = 0; i < num.size(); i++)
number[i] = Double.parseDouble(num.get(i));
return number;
}
-
- public static ArrayList<CommandSegment> findSegment(String command, String key) {
- int index = -1;
+
+ public static ArrayList<CommandSegment> findSegment(String command, String keyword) {
ArrayList<CommandSegment> segments = new ArrayList<CommandSegment>();
- do {
- index = command.indexOf(key, index + 1);
- if (index >= 0) {
- segments.add(new CommandSegment(key, index + key.length()));
- }
+ String regex = "(?<!\\w)" + keyword + "(?!\\w)";
+ Matcher matcher = Pattern.compile(regex).matcher(command);
+
+ while (matcher.find()) {
+ segments.add(new CommandSegment(keyword, matcher.start()));
+ System.out.println(" " + "," + matcher.end() + " " + matcher.group());
}
- while (index >= 0);
+
+ Collections.sort(segments);
return segments;
}
-
+ /*
+ * public static ArrayList<CommandSegment> findSegment(String command,
+ * String key) { int index = -1; ArrayList<CommandSegment> segments = new
+ * ArrayList<CommandSegment>(); do { index = command.indexOf(key, index +
+ * 1); if (index >= 0) { segments.add(new CommandSegment(key, index +
+ * key.length())); } } while (index >= 0); return segments; }
+ */
public static AbstractAlgorithm decodeAlgorithm(Token token, Controller controller) {
-
+
String option = token.option;
AbstractAlgorithm algo = Algorithm.createAlgorithm(option);
double params[] = parseNumeric(token.parameters);
if (params != null) {
algo.setParameters(params);
if (algo.isIterative())
controller.setIterationMax(algo.getController().getIterationMax());
}
-
+
if (algo.isWaveletsBased()) {
- for(String wavelet : Wavelets.getWaveletsAsArray()) {
+ for (String wavelet : Wavelets.getWaveletsAsArray()) {
int pos = token.parameters.toLowerCase().indexOf(wavelet.toLowerCase());
if (pos >= 0)
- algo.setWavelets(wavelet);
+ algo.setWavelets(wavelet);
}
}
return algo;
}
public static Output decodeOut(Token token) {
int freq = 0;
String line = token.parameters;
String parts[] = token.parameters.split(" ");
- for(int i=0; i<Math.min(2, parts.length); i++) {
+ for (int i = 0; i < Math.min(2, parts.length); i++) {
if (parts[i].startsWith("@"))
- freq = (int)NumFormat.parseNumber(parts[i], 0);
+ freq = (int) NumFormat.parseNumber(parts[i], 0);
}
String p = token.parameters.toLowerCase();
Output out = null;
if (p.startsWith("stack"))
out = new Output(View.STACK, freq, line.substring("stack".length(), line.length()));
if (p.startsWith("series"))
out = new Output(View.SERIES, freq, line.substring("series".length(), line.length()));
if (p.startsWith("mip"))
out = new Output(View.MIP, freq, line.substring("mip".length(), line.length()));
if (p.startsWith("ortho"))
out = new Output(View.ORTHO, freq, line.substring("ortho".length(), line.length()));
if (p.startsWith("figure"))
out = new Output(View.FIGURE, freq, line.substring("figure".length(), line.length()));
if (p.startsWith("planar"))
out = new Output(View.PLANAR, freq, line.substring("planar".length(), line.length()));
-
+
return out;
}
public static void decodeController(Token token, Controller controller) {
-
+
int freq = 1;
String line = token.parameters;
if (token.parameters.startsWith("@")) {
String parts[] = token.parameters.split(" ");
if (parts.length >= 1) {
- freq = (int)NumFormat.parseNumber(parts[0], 1);
+ freq = (int) NumFormat.parseNumber(parts[0], 1);
line = token.parameters.substring(parts[0].length(), token.parameters.length()).trim();
}
}
if (token.keyword.equals("-constraint")) {
controller.setConstraint(freq, Constraint.getByName(line.trim()));
}
-
+
else if (token.keyword.equals("-residu")) {
double stop = NumFormat.parseNumber(line, -1);
- controller.setResiduStop(freq, stop);
+ controller.setResiduStop(freq, stop);
}
-
+
else if (token.keyword.equals("-reference")) {
controller.setReference(freq, line);
}
else if (token.keyword.equals("-savestats")) {
controller.setSaveStats(freq, line);
}
else if (token.keyword.equals("-showstats")) {
controller.setShowStats(freq, line);
}
else if (token.keyword.equals("-time")) {
double stop = NumFormat.parseNumber(line, Double.MAX_VALUE);
controller.setTimeStop(stop);
}
}
-
+
public static double decodeNormalization(Token token) {
- if (token.parameters.toLowerCase().endsWith("no"))
+ if (token.parameters.toLowerCase().endsWith("no"))
return 0;
else
- return NumFormat.parseNumber(token.parameters, 1);
+ return NumFormat.parseNumber(token.parameters, 1);
}
public static boolean decodeDisable(Token token, String word) {
String p = token.parameters.toLowerCase();
String parts[] = p.split(" ");
- for(String part : parts) {
+ for (String part : parts) {
if (part.trim().equals(word))
return false;
}
- return true;
+ return true;
}
public static Padding decodePadding(Token token) {
AbstractPadding padXY = new NoPadding();
AbstractPadding padZ = new NoPadding();
int extXY = 0;
int extZ = 0;
-
+
String param = token.parameters.trim();
String[] parts = param.split(" ");
if (parts.length > 0)
padXY = Padding.getByShortname(parts[0].trim());
if (parts.length > 1)
padZ = Padding.getByShortname(parts[1].trim());
double[] ext = NumFormat.parseNumbers(param);
if (ext.length > 0)
- extXY = (int)Math.round(ext[0]);
+ extXY = (int) Math.round(ext[0]);
if (ext.length > 1)
- extZ = (int)Math.round(ext[1]);
+ extZ = (int) Math.round(ext[1]);
return new Padding(padXY, padXY, padZ, extXY, extXY, extZ);
}
public static Apodization decodeApodization(Token token) {
AbstractApodization apoXY = new UniformApodization();
AbstractApodization apoZ = new UniformApodization();
String[] parts = token.parameters.trim().split(" ");
if (parts.length >= 1)
apoXY = Apodization.getByShortname(parts[0].trim());
if (parts.length >= 2)
apoZ = Apodization.getByShortname(parts[1].trim());
return new Apodization(apoXY, apoXY, apoZ);
}
}
diff --git a/DeconvolutionLab2/src/deconvolutionlab/dialog/LabDialog.java b/DeconvolutionLab2/src/deconvolutionlab/dialog/LabDialog.java
index 75a8e26..5b8d8e8 100644
--- a/DeconvolutionLab2/src/deconvolutionlab/dialog/LabDialog.java
+++ b/DeconvolutionLab2/src/deconvolutionlab/dialog/LabDialog.java
@@ -1,368 +1,369 @@
/*
* 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.OutputModule;
import deconvolutionlab.modules.PSFModule;
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 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);
panelScript = new GroupedModulePanel(buildProgrammingPanel(), this);
panelAbout = new GroupedModulePanel(buildAboutPanel(), this);
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("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);
+ bnQuit.addActionListener(this);
bnHelp.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();
dispose();
}
- else if (e.getSource() == bnClose) {
+ else if (e.getSource() == bnQuit) {
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();
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);
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(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/deconvolutionlab/modules/BatchModule.java b/DeconvolutionLab2/src/deconvolutionlab/modules/BatchModule.java
index e68c434..81f4650 100644
--- a/DeconvolutionLab2/src/deconvolutionlab/modules/BatchModule.java
+++ b/DeconvolutionLab2/src/deconvolutionlab/modules/BatchModule.java
@@ -1,189 +1,189 @@
/*
* 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.modules;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JToolBar;
import javax.swing.ListSelectionModel;
import deconvolution.Deconvolution;
import deconvolutionlab.Constants;
import lab.component.CustomizedColumn;
import lab.component.CustomizedTable;
public class BatchModule extends AbstractModule implements MouseListener, ActionListener {
private CustomizedTable table;
private JButton bnScript;
private JButton bnRunAll;
private JButton bnRunJob;
private JButton bnLaunchAll;
private JButton bnLaunchJob;
public BatchModule(boolean expanded) {
super("Batch", "", "", "", expanded);
}
@Override
public String getCommand() {
- return "DeconvolutionLab2 " + Constants.version;
+ return "";
}
@Override
public JPanel buildExpandedPanel() {
bnScript = new JButton("Create Script (not yet implemented)");
bnRunAll = new JButton("Run All Jobs");
bnRunJob = new JButton("Run Selected Jobs");
bnLaunchAll = new JButton("Launch All Jobs");
bnLaunchJob = new JButton("Launch Selected Jobs");
ArrayList<CustomizedColumn> columns = new ArrayList<CustomizedColumn>();
columns.add(new CustomizedColumn("Job", String.class, 120, false));
columns.add(new CustomizedColumn("Command", String.class, Constants.widthGUI, false));
columns.add(new CustomizedColumn("", String.class, 30, "\u232B", "Delete this job"));
table = new CustomizedTable(columns, true);
table.getColumnModel().getColumn(2).setMaxWidth(30);
table.getColumnModel().getColumn(2).setMinWidth(30);
table.addMouseListener(this);
table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
JToolBar pn = new JToolBar("Controls Batch");
pn.setBorder(BorderFactory.createEmptyBorder());
pn.setLayout(new GridLayout(1, 5));
pn.setFloatable(false);
pn.add(bnScript);
pn.add(bnRunAll);
pn.add(bnRunJob);
pn.add(bnLaunchAll);
pn.add(bnLaunchJob);
JPanel panel = new JPanel(new BorderLayout());
panel.add(table.getPane(100, 100), BorderLayout.CENTER);
panel.add(pn, BorderLayout.SOUTH);
getAction1Button().addActionListener(this);
bnScript.addActionListener(this);
bnRunAll.addActionListener(this);
bnRunJob.addActionListener(this);
bnLaunchAll.addActionListener(this);
bnLaunchJob.addActionListener(this);
return panel;
}
@Override
public void actionPerformed(ActionEvent e) {
super.actionPerformed(e);
if (e.getSource() == bnRunJob) {
int rows[] = table.getSelectedRows();
for (int row : rows) {
new Deconvolution(table.getCell(row, 1)).deconvolve(false);
}
}
else if (e.getSource() == bnLaunchJob) {
int rows[] = table.getSelectedRows();
for (int row : rows) {
new Deconvolution(table.getCell(row, 1)).launch(table.getCell(row, 0), false);
}
}
else if (e.getSource() == bnRunAll) {
for (int row = 0; row < table.getRowCount(); row++) {
new Deconvolution(table.getCell(row, 1)).deconvolve(false);
}
}
else if (e.getSource() == bnLaunchAll) {
for (int row = 0; row < table.getRowCount(); row++) {
new Deconvolution(table.getCell(row, 1)).launch(table.getCell(row, 0), false);
}
}
}
private void update() {
setSynopsis("" + table.getRowCount() + " jobs");
}
public int getCountJob() {
return table.getRowCount();
}
public void addJob(String name, String command) {
table.append(new String[] { name, command, "" });
update();
}
@Override
public void mouseClicked(MouseEvent e) {
if (e.getSource() == table) {
int row = table.getSelectedRow();
if (row < 0)
return;
if (table.getSelectedColumn() == 2) {
table.removeRow(row);
if (table.getRowCount() > 0)
table.setRowSelectionInterval(0, 0);
}
}
update();
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
@Override
public void close() {
getAction1Button().removeActionListener(this);
}
}
Event Timeline
Log In to Comment