Page MenuHomec4science

No OneTemporary

File Metadata

Created
Mon, May 6, 23:39
diff --git a/DeconvolutionLab2/build.xml b/DeconvolutionLab2/build.xml
index 0cfdb6a..e34ad38 100644
--- a/DeconvolutionLab2/build.xml
+++ b/DeconvolutionLab2/build.xml
@@ -1,48 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="DeconvolutionLab2" default="build" basedir=".">
<property name="imagej" location="${user.home}/Desktop/ImageJ/plugins" />
<property name="fiji" location="${user.home}/Desktop/Fiji-deconv.app/plugins" />
<property name="matlab" location="/Applications/MATLAB_R2014b.app/java/" />
<property name="doc" location="${user.home}/Desktop/doc/" />
<property name="javadoc.header" value="&lt;h3&gt;DeconvolutionLab2&lt;/h3&gt;&#09;v1.0" />
<property name="javadoc.footer" value="&lt;h4&gt;DeconvolutionLab2&lt;/h4&gt;&#09;&lt;script&gt; var tStamp=new Date(); document.write(tStamp.toUTCString()); &lt;/script&gt;" />
<property name="javadoc.bottom" value='Copyright &amp;copy; &lt;script&gt; var currYear=new Date(); document.write(currYear.getFullYear()); &lt;/script&gt;, Biomedical Imaging Group, EPFL, Lausanne, Switzerland. All rights reserved.' />
<target name="build">
<mkdir dir="${doc}" />
<mkdir dir="bin" />
<copy todir="bin"><fileset dir="ij"></fileset></copy>
+ <copy todir="bin"><fileset dir="jtransforms"></fileset></copy>
<copy file="plugins.config" toDir="bin" />
<zip destfile="../DeconvolutionLab2-src.zip" basedir="src" />
<zip destfile="../DeconvolutionLab2-cls.zip" basedir="bin" />
<jar destfile="../DeconvolutionLab_2.jar" basedir="bin">
<manifest>
<attribute name="Main-Class" value="DeconvolutionLab2" />
- <attribute name="Class-Path" value="ij.jar jtransforms.jar" />
</manifest>
</jar>
<copy toDir="${fiji}" file="../DeconvolutionLab_2.jar" />
<copy toDir="${matlab}" file="../DeconvolutionLab_2.jar" />
<copy toDir="${imagej}" file="../DeconvolutionLab_2.jar" />
<javadoc destdir="${doc}" author="true" version="true" overview="${basedir}/overview.html" windowtitle="DeconvolutionLab2">
<fileset dir="src">
<include name="**/*.java" />
<exclude name="**/fft/**" />
<exclude name="**/jfftw/**" />
</fileset>
<header>
<![CDATA[${javadoc.header}]]>
</header>
<footer>
<![CDATA[${javadoc.footer}]]>
</footer>
<bottom>
<![CDATA[${javadoc.bottom}]]>
</bottom>
</javadoc>
</target>
</project>
diff --git a/DeconvolutionLab2/src/DL2.java b/DeconvolutionLab2/src/DL2.java
index 6df7b4d..af13673 100644
--- a/DeconvolutionLab2/src/DL2.java
+++ b/DeconvolutionLab2/src/DL2.java
@@ -1,252 +1,251 @@
/*
* 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 java.io.File;
-
-import deconvolution.Deconvolution;
-import deconvolutionlab.Imager;
-import deconvolutionlab.Lab;
-import deconvolutionlab.LabDialog;
import ij.ImagePlus;
import ij.WindowManager;
import matlab.Converter;
import signal.RealSignal;
+import bilib.tools.Files;
+import deconvolution.Deconvolution;
+import deconvolutionlab.Imager;
+import deconvolutionlab.Lab;
+import deconvolutionlab.LabDialog;
/**
* This class allows Matlab interface for DeconvolutionLab2
*
* A Matlab 3D variable in converted to a RealSignal and vice-versa.
*
* @author Daniel Sage
*
*/
public class DL2 {
public static void lab() {
- Lab.init(Imager.Platform.MATLAB, System.getProperty("user.dir") + File.separator + "DeconvolutionLab2.config");
+ Lab.init(Imager.Platform.MATLAB, Files.getWorkingDirectory() + "DeconvolutionLab2.config");
LabDialog dlg = new LabDialog();
Lab.setVisible(dlg, false);
}
public static void run(String command) {
new Deconvolution("Matlab", command).deconvolve();
}
public static void launch(String command) {
new Deconvolution("Matlab", command).launch();
}
public static Object get(String image) {
ImagePlus imp = WindowManager.getCurrentImage();
if (imp != null)
return Converter.get(imp);
return null;
}
public static Object run(Object arrayImage, Object arrayPSF, String algo) {
RealSignal image = Converter.createRealSignal(arrayImage);
RealSignal psf = Converter.createRealSignal(arrayPSF);
String command = " -image platform input -psf platform psf -algorithm " + algo;
Deconvolution d = new Deconvolution("Matlab", command);
RealSignal result = d.deconvolve(image, psf);
return Converter.createObject(result);
}
public static void help() {
Lab.help();
}
public static void clear() {
int ids[] = WindowManager.getIDList();
for(int id : ids) {
ImagePlus imp = WindowManager.getImage(id);
if (imp != null)
imp.close();
}
}
public static Object DIV(Object arrayImage, Object arrayPSF) {
return DIV(arrayImage, arrayPSF, "");
}
public static Object DIV(Object arrayImage, Object arrayPSF, String options) {
RealSignal image = Converter.createRealSignal(arrayImage);
RealSignal psf = Converter.createRealSignal(arrayPSF);
String command = " -algorithm DIV " + options;
Deconvolution d = new Deconvolution("Matlab DIV", command);
RealSignal result = d.deconvolve(image, psf);
return Converter.createObject(result);
}
public static Object CONV(Object arrayImage, Object arrayPSF) {
return CONV(arrayImage, arrayPSF, "");
}
public static Object CONV(Object arrayImage, Object arrayPSF, String options) {
RealSignal image = Converter.createRealSignal(arrayImage);
RealSignal psf = Converter.createRealSignal(arrayPSF);
String command = " -algorithm CONV " + options;
Deconvolution d = new Deconvolution("Matlab CONV", command);
RealSignal result = d.deconvolve(image, psf);
return Converter.createObject(result);
}
public static Object NIF(Object arrayImage, Object arrayPSF) {
return NIF(arrayImage, arrayPSF, "");
}
public static Object NIF(Object arrayImage, Object arrayPSF, String options) {
RealSignal image = Converter.createRealSignal(arrayImage);
RealSignal psf = Converter.createRealSignal(arrayPSF);
String command = " -algorithm NIF " + options;
Deconvolution d = new Deconvolution("Matlab NIF", command);
RealSignal result = d.deconvolve(image, psf);
return Converter.createObject(result);
}
public static Object TRIF(Object arrayImage, Object arrayPSF, double regularizationFactor) {
return TRIF(arrayImage, arrayPSF, regularizationFactor, "");
}
public static Object TRIF(Object arrayImage, Object arrayPSF, double regularizationFactor, String options) {
RealSignal image = Converter.createRealSignal(arrayImage);
RealSignal psf = Converter.createRealSignal(arrayPSF);
String command = " -algorithm TRIF " + regularizationFactor + " " + options;
Deconvolution d = new Deconvolution("Matlab TRIF", command);
RealSignal result = d.deconvolve(image, psf);
return Converter.createObject(result);
}
public static Object RIF(Object arrayImage, Object arrayPSF, double regularizationFactor) {
return RIF(arrayImage, arrayPSF, regularizationFactor, "");
}
public static Object RIF(Object arrayImage, Object arrayPSF, double regularizationFactor, String options) {
RealSignal image = Converter.createRealSignal(arrayImage);
RealSignal psf = Converter.createRealSignal(arrayPSF);
String command = " -algorithm RIF " + regularizationFactor + " " + options;
Deconvolution d = new Deconvolution("Matlab RIF", command);
RealSignal result = d.deconvolve(image, psf);
return Converter.createObject(result);
}
public static Object RL(Object arrayImage, Object arrayPSF, double itmax) {
return RL(arrayImage, arrayPSF, itmax, "");
}
public static Object RL(Object arrayImage, Object arrayPSF, double itmax, String options) {
RealSignal image = Converter.createRealSignal(arrayImage);
RealSignal psf = Converter.createRealSignal(arrayPSF);
String command = " -algorithm RL " + itmax + " " + options;
Deconvolution d = new Deconvolution("Matlab RL", command);
RealSignal result = d.deconvolve(image, psf);
return Converter.createObject(result);
}
public static Object RLTV(Object arrayImage, Object arrayPSF, double itmax, double regularizationFactor) {
return RLTV(arrayImage, arrayPSF, itmax, regularizationFactor, "");
}
public static Object RLTV(Object arrayImage, Object arrayPSF, double itmax, double regularizationFactor, String options) {
RealSignal image = Converter.createRealSignal(arrayImage);
RealSignal psf = Converter.createRealSignal(arrayPSF);
String command = " -algorithm RLTV " + itmax + " " + regularizationFactor + " " + options;
Deconvolution d = new Deconvolution("Matlab RLTV", command);
RealSignal result = d.deconvolve(image, psf);
return Converter.createObject(result);
}
public static Object LW(Object arrayImage, Object arrayPSF, double itmax, double gamma) {
return LW(arrayImage, arrayPSF, itmax, gamma, "");
}
public static Object LW(Object arrayImage, Object arrayPSF, double itmax, double gamma, String options) {
RealSignal image = Converter.createRealSignal(arrayImage);
RealSignal psf = Converter.createRealSignal(arrayPSF);
String command = " -algorithm LW " + itmax + " " + gamma + " " + options;
Deconvolution d = new Deconvolution("Matlab LW", command);
RealSignal result = d.deconvolve(image, psf);
return Converter.createObject(result);
}
public static Object NNLS(Object arrayImage, Object arrayPSF, double itmax, double gamma) {
return NNLS(arrayImage, arrayPSF, itmax, gamma, "");
}
public static Object NNLS(Object arrayImage, Object arrayPSF, double itmax, double gamma, String options) {
RealSignal image = Converter.createRealSignal(arrayImage);
RealSignal psf = Converter.createRealSignal(arrayPSF);
String command = " -algorithm NNLS " + itmax + " " + options;
Deconvolution d = new Deconvolution("Matlab NNLS", command);
RealSignal result = d.deconvolve(image, psf);
return Converter.createObject(result);
}
public static Object BVLS(Object arrayImage, Object arrayPSF, double itmax, double gamma) {
return BVLS(arrayImage, arrayPSF, itmax, gamma, "");
}
public static Object BVLS(Object arrayImage, Object arrayPSF, double itmax, double gamma, String options) {
RealSignal image = Converter.createRealSignal(arrayImage);
RealSignal psf = Converter.createRealSignal(arrayPSF);
String command = " -algorithm BVLS " + itmax + " " + options;
Deconvolution d = new Deconvolution("Matlab BVLS", command);
RealSignal result = d.deconvolve(image, psf);
return Converter.createObject(result);
}
public static Object TM(Object arrayImage, Object arrayPSF, double itmax, double gamma, double lambda) {
return TM(arrayImage, arrayPSF, itmax, gamma, lambda, "");
}
public static Object TM(Object arrayImage, Object arrayPSF, double itmax, double gamma, double lambda, String options) {
RealSignal image = Converter.createRealSignal(arrayImage);
RealSignal psf = Converter.createRealSignal(arrayPSF);
String command = " -algorithm TM " + itmax + " " + gamma + " " + lambda + " " + options;
Deconvolution d = new Deconvolution("Matlab TM", command);
RealSignal result = d.deconvolve(image, psf);
return Converter.createObject(result);
}
public static Object ICTM(Object arrayImage, Object arrayPSF, double itmax, double gamma, double lambda) {
return ICTM(arrayImage, arrayPSF, itmax, gamma, lambda, "");
}
public static Object ICTM(Object arrayImage, Object arrayPSF, double itmax, double gamma, double lambda, String options) {
RealSignal image = Converter.createRealSignal(arrayImage);
RealSignal psf = Converter.createRealSignal(arrayPSF);
String command = " -algorithm ICTM " + itmax + " " + gamma + " " + lambda + " " + options;
Deconvolution d = new Deconvolution("Matlab ICTM", command);
RealSignal result = d.deconvolve(image, psf);
return Converter.createObject(result);
}
}
diff --git a/DeconvolutionLab2/src/DeconvolutionLab2.java b/DeconvolutionLab2/src/DeconvolutionLab2.java
index fef4ab4..942cce5 100644
--- a/DeconvolutionLab2/src/DeconvolutionLab2.java
+++ b/DeconvolutionLab2/src/DeconvolutionLab2.java
@@ -1,128 +1,130 @@
/*
* 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 java.io.File;
import bilib.tools.Files;
import deconvolution.Command;
import deconvolution.Deconvolution;
import deconvolutionlab.Constants;
import deconvolutionlab.Imager;
import deconvolutionlab.Imager.Platform;
import deconvolutionlab.Lab;
import deconvolutionlab.LabDialog;
import deconvolutionlab.monitor.Monitors;
public class DeconvolutionLab2 {
- public static String ack = Constants.name + " " + Constants.version + " " + Constants.copyright;
+ public static String ack = Constants.name + " " + Constants.version + " " + Constants.copyright;
public static void main(String arg[]) {
+
Lab.init(Platform.STANDALONE);
if (arg.length == 0) {
System.out.println("Starting lab");
lab(arg);
return;
}
String flag = arg[0].trim().toLowerCase();
if (flag.equalsIgnoreCase("help")) {
System.out.println("Starting help");
help();
return;
}
else if (flag.equalsIgnoreCase("lab")) {
System.out.println("Starting lab");
lab(arg);
}
else if (flag.equalsIgnoreCase("fft")) {
System.out.println("Starting fft");
Lab.checkFFT(Monitors.createDefaultMonitor());
}
else if (flag.equalsIgnoreCase("run")) {
System.out.println("Starting run");
String cmd = "";
for (int i = 1; i < arg.length; i++)
cmd += arg[i] + " ";
new Deconvolution("Run", cmd, Deconvolution.Finish.KILL).deconvolve();
}
else if (flag.equalsIgnoreCase("launch")) {
System.out.println("Starting launch");
String cmd = "";
for (int i = 1; i < arg.length; i++)
cmd += arg[i] + " ";
new Deconvolution("Launch", cmd, Deconvolution.Finish.KILL).launch();
}
- else
- System.out.println("" + flag + " command not found");
-
+ else
+ System.out.println("" + flag + " command not found");
+
}
private static void lab(String arg[]) {
String config = Files.getWorkingDirectory() + "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;
}
Lab.init(Platform.STANDALONE, config);
LabDialog dialog = new LabDialog();
dialog.setVisible(true);
}
public static void help() {
System.out.println("More info:" + Constants.url);
System.out.println("Syntax:");
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 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.println("Keywords of {command}: ");
for (String keyword : Command.keywords)
System.out.println("\t" + keyword);
}
public DeconvolutionLab2(String cmd) {
System.out.println("cmd: " + cmd);
Lab.init(Imager.Platform.STANDALONE, Files.getWorkingDirectory() + "DeconvolutionLab2.config");
new Deconvolution("CommandLine", cmd).deconvolve();
}
+
}
diff --git a/DeconvolutionLab2/src/deconvolutionlab/module/DirectoryModule.java b/DeconvolutionLab2/src/deconvolutionlab/module/DirectoryModule.java
index d6afddb..ca9e6b1 100644
--- a/DeconvolutionLab2/src/deconvolutionlab/module/DirectoryModule.java
+++ b/DeconvolutionLab2/src/deconvolutionlab/module/DirectoryModule.java
@@ -1,225 +1,228 @@
/*
* 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.module;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.io.File;
import java.io.IOException;
import java.util.List;
import javax.swing.BoxLayout;
import javax.swing.JButton;
-import javax.swing.JCheckBox;
import javax.swing.JComboBox;
+import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import bilib.component.GridPanel;
import bilib.tools.Files;
import deconvolution.Command;
import deconvolutionlab.Config;
-import deconvolutionlab.system.SystemInfo;
+import deconvolutionlab.Lab;
public class DirectoryModule extends AbstractModule implements ActionListener, KeyListener {
private JComboBox<String> cmbPath;
private JTextField txtPath;
private JButton bnBrowse;
+ private JLabel platform;
public DirectoryModule() {
super("Path", "", "Default", "");
}
@Override
public String getCommand() {
String cmd = "";
if (cmbPath.getSelectedIndex() == 1)
cmd += "-path home ";
if (cmbPath.getSelectedIndex() == 2)
cmd += "-path desktop ";
if (cmbPath.getSelectedIndex() == 3)
cmd += " -path " + txtPath.getText();
return cmd;
}
@Override
public JPanel buildExpandedPanel() {
cmbPath = new JComboBox<String>(new String[] { "current", "home", "desktop", "specify ..."});
txtPath = new JTextField("", 35);
+ platform = new JLabel("Running on the platform: " + Lab.getPlatform().name().toLowerCase());
bnBrowse = new JButton("Browse or drag anf drop a directory");
GridPanel pn1 = new GridPanel(true, 3);
pn1.place(0, 0, 3, 1, "Working directory");
pn1.place(1, 0, cmbPath);
pn1.place(1, 1, bnBrowse);
pn1.place(2, 0, 3, 1, txtPath);
- pn1.place(5, 0, 3, 1, " ");
+ pn1.place(3, 0, 3, 1, " ");
+ pn1.place(4, 0, 3, 1, platform);
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
panel.add(pn1);
String dir = Files.getWorkingDirectory();
Config.register(getName(), "current", cmbPath, cmbPath.getItemAt(0));
Config.register(getName(), "path", txtPath, dir);
// Add drop area
pn1.setDropTarget(new LocalDropTarget());
txtPath.setDropTarget(new LocalDropTarget());
bnBrowse.setDropTarget(new LocalDropTarget());
getCollapsedPanel().setDropTarget(new LocalDropTarget());
bnTitle.setDropTarget(new LocalDropTarget());
bnSynopsis.setDropTarget(new LocalDropTarget());
bnExpand.setDropTarget(new LocalDropTarget());
cmbPath.addActionListener(this);
txtPath.addKeyListener(this);
bnBrowse.addActionListener(this);
getAction1Button().addActionListener(this);
return panel;
}
private void update() {
setCommand(getCommand());
if (cmbPath.getSelectedIndex() == 0) {
txtPath.setText(Files.getWorkingDirectory());
txtPath.setEnabled(false);
}
if (cmbPath.getSelectedIndex() == 1) {
txtPath.setText(Files.getHomeDirectory());
txtPath.setEnabled(false);
}
if (cmbPath.getSelectedIndex() == 2) {
txtPath.setText(Files.getDesktopDirectory());
txtPath.setEnabled(false);
}
if (cmbPath.getSelectedIndex() == 3) {
txtPath.setEnabled(true);
}
setSynopsis(new File(txtPath.getText()).getName());
Command.command();
}
@Override
public void actionPerformed(ActionEvent e) {
super.actionPerformed(e);
if (e.getSource() == bnBrowse) {
File f = Files.browseDirectory(txtPath.getText());
if (f != null) {
txtPath.setText(f.getAbsolutePath());
cmbPath.setSelectedIndex(3);
}
}
else if (e.getSource() == cmbPath) {
if (cmbPath.getSelectedIndex() == 1) {
File f = new File(Files.getWorkingDirectory());
txtPath.setText(f.getAbsolutePath());
}
if (cmbPath.getSelectedIndex() == 2) {
File f = new File(Files.getHomeDirectory());
txtPath.setText(f.getAbsolutePath());
}
if (cmbPath.getSelectedIndex() == 3) {
File f = new File(Files.getDesktopDirectory());
txtPath.setText(f.getAbsolutePath());
}
}
else if (e.getSource() == getAction1Button()) {
cmbPath.setSelectedIndex(0);
txtPath.setText(Files.getWorkingDirectory());
txtPath.setEnabled(false);
}
update();
}
@Override
public void close() {
cmbPath.removeActionListener(this);
txtPath.removeKeyListener(this);
bnBrowse.removeActionListener(this);
}
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
update();
}
public class LocalDropTarget extends DropTarget {
-
+
@Override
public void drop(DropTargetDropEvent e) {
e.acceptDrop(DnDConstants.ACTION_COPY);
e.getTransferable().getTransferDataFlavors();
Transferable transferable = e.getTransferable();
DataFlavor[] flavors = transferable.getTransferDataFlavors();
for (DataFlavor flavor : flavors) {
if (flavor.isFlavorJavaFileListType()) {
try {
List<File> files = (List<File>) transferable.getTransferData(flavor);
for (File file : files) {
cmbPath.setSelectedIndex(3);
txtPath.setEnabled(true);
if (file.isDirectory())
txtPath.setText(file.getAbsolutePath());
else
txtPath.setText(file.getParent());
update();
}
}
catch (UnsupportedFlavorException ex) {
ex.printStackTrace();
}
catch (IOException ex) {
ex.printStackTrace();
}
}
}
e.dropComplete(true);
super.drop(e);
}
}
}
diff --git a/DeconvolutionLab2/src/deconvolutionlab/system/SystemInfo.java b/DeconvolutionLab2/src/deconvolutionlab/system/SystemInfo.java
index 32658e1..2bf6d43 100644
--- a/DeconvolutionLab2/src/deconvolutionlab/system/SystemInfo.java
+++ b/DeconvolutionLab2/src/deconvolutionlab/system/SystemInfo.java
@@ -1,287 +1,287 @@
/*
* 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.system;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.util.ArrayList;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import bilib.component.PanelImage;
import bilib.tools.NumFormat;
import deconvolutionlab.Config;
import deconvolutionlab.Constants;
import deconvolutionlab.Lab;
import fft.FFTPanel;
import signal.SignalCollector;
public class SystemInfo extends JDialog implements WindowListener, ActionListener, MouseListener {
private JPanel cards;
private String[] rates = new String[] { "1 s.", "0.5 s.", "0.2 s.", "0.1 s.", "10 s.", "5 s.", "2 s." };
private JButton bnRate = new JButton("1 s.");
private JButton bnClear = new JButton("Clear");
private Timer timer = new Timer();
private TimerTask updater = new Updater();
private MemoryMeter memory;
private ProcessorMeter processor;
private SignalMeter signal;
private FFTMeter fft;
private JavaMeter java;
private FileMeter file;
private int width = Constants.widthGUI;
private static SystemInfo instance;
private int rate = 0;
private ArrayList<AbstractMeter> meters = new ArrayList<AbstractMeter>();
public static void activate() {
if (instance == null) {
instance = new SystemInfo();
Lab.setVisible(instance, false);
Config.registerFrame("System", "Frame", instance);
return;
}
if (!instance.isVisible())
Lab.setVisible(instance, false);
instance.toFront();
}
public static void close() {
if (instance == null)
return;
if (instance.isVisible())
instance.dispose();
}
private SystemInfo() {
super(new JFrame(), "DeconvolutionLab2 System");
memory = new MemoryMeter();
processor = new ProcessorMeter();
signal = new SignalMeter();
fft = new FFTMeter();
java = new JavaMeter();
file = new FileMeter();
meters.add(memory);
meters.add(processor);
meters.add(signal);
meters.add(fft);
meters.add(java);
meters.add(file);
// Panel meters on top
JPanel meters = new JPanel(new GridLayout(2, 3));
meters.add(file);
meters.add(memory);
meters.add(processor);
meters.add(java);
meters.add(signal);
meters.add(fft);
bnClear.setToolTipText("Clear all the entries");
bnRate.setToolTipText("Choose the rate of refreshing the information");
JPanel pan = new JPanel(new GridLayout(2, 1));
pan.add(bnRate);
pan.add(bnClear);
restart();
// Panel Compact
PanelImage pnCompact = new PanelImage("celegans.jpg");
pnCompact.setPreferredSize(new Dimension(width, 20));
// Panel cards, compact is visible
cards = new JPanel(new CardLayout());
cards.add("collapse", pnCompact);
- cards.add(signal.getName(), SignalCollector.getPanel(width, 200));
- cards.add(memory.getName(), memory.getPanel(width, 200));
- cards.add(processor.getName(), processor.getPanel(width, 200));
- cards.add(fft.getName(), new FFTPanel(width, 200));
- cards.add(java.getName(), java.getPanel(width, 200));
- cards.add(file.getName(), file.getPanel(width, 200));
+ cards.add(signal.getMeterName(), SignalCollector.getPanel(width, 200));
+ cards.add(memory.getMeterName(), memory.getPanel(width, 200));
+ cards.add(processor.getMeterName(), processor.getPanel(width, 200));
+ cards.add(fft.getMeterName(), new FFTPanel(width, 200));
+ cards.add(java.getMeterName(), java.getPanel(width, 200));
+ cards.add(file.getMeterName(), file.getPanel(width, 200));
cards.setVisible(false);
JPanel top = new JPanel(new BorderLayout());
top.add(meters, BorderLayout.CENTER);
top.add(pan, BorderLayout.EAST);
JPanel panel = new JPanel(new BorderLayout());
panel.add(top, BorderLayout.NORTH);
panel.add(cards, BorderLayout.CENTER);
getContentPane().add(panel);
bnClear.addActionListener(this);
signal.addMouseListener(this);
memory.addMouseListener(this);
processor.addMouseListener(this);
java.addMouseListener(this);
file.addMouseListener(this);
fft.addMouseListener(this);
bnRate.addActionListener(this);
setMinimumSize(new Dimension(width, 70));
pack();
bnClear.setEnabled(signal.isExpanded());
Rectangle rect = Config.getDialog("System.Frame");
if (rect.x > 0 && rect.y > 0)
setLocation(rect.x, rect.y);
}
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == bnRate) {
rate++;
if (rate >= rates.length)
rate = 0;
bnRate.setText(rates[rate]);
restart();
}
if (e.getSource() == bnClear) {
SignalCollector.clear();
}
pack();
}
public void update() {
for(AbstractMeter meter : meters)
meter.update();
}
public void restart() {
long refreshTime = (long) (NumFormat.parseNumber(bnRate.getText(), 1) * 1000);
if (updater != null) {
updater.cancel();
updater = null;
}
updater = new Updater();
timer.schedule(updater, 0, refreshTime);
}
private class Updater extends TimerTask {
@Override
public void run() {
update();
}
}
@Override
public void mouseClicked(MouseEvent e) {
if (e.getSource() instanceof AbstractMeter) {
AbstractMeter meter = (AbstractMeter) e.getSource();
if (meter.isExpanded()) {
meter.collapse();
cards.setVisible(false);
}
else for(AbstractMeter m : meters) {
if (m.isExpanded())
m.collapse();
meter.expand();
cards.setVisible(true);
}
- ((CardLayout) (cards.getLayout())).show(cards, meter.getName());
+ ((CardLayout) (cards.getLayout())).show(cards, meter.getMeterName());
pack();
}
bnClear.setEnabled(signal.isExpanded());
}
@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 windowOpened(WindowEvent e) {
}
@Override
public void windowClosing(WindowEvent e) {
timer.cancel();
timer = null;
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) {
}
}
diff --git a/jtransforms.jar b/jtransforms.jar
new file mode 100644
index 0000000..042e843
Binary files /dev/null and b/jtransforms.jar differ

Event Timeline