-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 946bfb2
Showing
53 changed files
with
10,746 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
<classpathentry kind="lib" path="lib/ij.jar"/> | ||
<classpathentry kind="lib" path="lib/slf4j-api-1.7.5.jar"/> | ||
<classpathentry kind="lib" path="/usr/share/java/v4l4j.jar"/> | ||
<classpathentry kind="lib" path="lib/commons-codec-1.9.jar"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> | ||
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/> | ||
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="true"/> | ||
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> | ||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> | ||
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/> | ||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-7-openjdk-amd64"/> | ||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.ant.internal.launching.remote.InternalAntRunner"/> | ||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value=""/> | ||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${build_project:/build.xml}"/> | ||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/> | ||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> | ||
<stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/> | ||
</launchConfiguration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
bin/ | ||
doc/ | ||
Plugin_Telemicroscopia.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>Plugin_Telemicroscopia</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> | ||
<triggers>auto,full,incremental,</triggers> | ||
<arguments> | ||
<dictionary> | ||
<key>LaunchConfigHandle</key> | ||
<value><project>/.externalToolBuilders/New_Builder (1).launch</value> | ||
</dictionary> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.7 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.7 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<project name="Plugin_Telemicroscopia" default="main" basedir="."> | ||
<description> | ||
Plugin_Telemicroscopia: build file | ||
</description> | ||
<property name="src" location="src" /> | ||
<property name="build" location="bin" /> | ||
<property name="dist" location="dist" /> | ||
<property name="pluginsDir" location="$basedir/../../AppTm4l/plugins/" /> | ||
<property name="user.name" value="ehas" /> | ||
|
||
<target name="main" depends="compress" description="Main target"> | ||
<echo> | ||
Building the .jar file | ||
</echo> | ||
</target> | ||
|
||
<target name="compress" depends="compile" description="generate the distribution"> | ||
<jar jarfile="Plugin_Telemicroscopia.jar"> | ||
<!-- zipgroupfileset dir="lib" includes="*.jar"/>--> | ||
<fileset dir="${build}" includes="**/*.*" /> | ||
<manifest> | ||
<attribute name="Built-By" value="${user.name}"/> | ||
</manifest> | ||
</jar> | ||
<copy file="Plugin_Telemicroscopia.jar" toDir="${pluginsDir}" /> | ||
<copy toDir="${pluginsDir}"> | ||
<fileset dir="lib"> | ||
<include name="**.jar"/> | ||
<exclude name="ij.jar"/> | ||
</fileset> | ||
</copy> | ||
</target> | ||
|
||
<target name="compile"> | ||
<javac srcdir="." destdir="bin"> | ||
<classpath> | ||
<fileset dir="lib"> | ||
<include name="**.jar"/> | ||
</fileset> | ||
<pathelement location="/usr/share/java/v4l4j.jar"/> | ||
</classpath> | ||
</javac> | ||
</target> | ||
|
||
</project> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import ij.Macro; | ||
import ij.plugin.PlugIn; | ||
|
||
import java.io.IOException; | ||
import java.net.BindException; | ||
|
||
import javax.swing.JOptionPane; | ||
|
||
import util.StatusIndicator; | ||
|
||
import communication.v4l.CamServer; | ||
|
||
/** | ||
* This plugin runs when the activate/deactivate camera button is pushed. | ||
* | ||
* @author ehas | ||
* | ||
*/ | ||
public class ActivateCamera_ implements PlugIn { | ||
|
||
public void run(String arg) { | ||
|
||
// This variable is used to avoid the execution of several run() | ||
// threads. | ||
// This happens when the activate/deactivate camera button is pushed | ||
// many times quickly. | ||
CamServer.LockCamServerInit.lock(); | ||
|
||
// This variable is: true if the camera has been enabled, false if | ||
// disabled | ||
String state = Macro.getOptions().trim(); | ||
|
||
if (state.equals("true") && !CamServer.active) { | ||
|
||
try { | ||
CamServer.start(); | ||
} catch (IOException e) { | ||
if(e instanceof java.net.BindException){ | ||
JOptionPane.showMessageDialog(null, | ||
"No se ha podido inicializar el servidor de internet.\n" + | ||
"Comprueba que el puerto " + CamServer.port + " está libre " + | ||
"y que tienes los\npermisos necesarios para ocuparlo.", | ||
"Fallo inicializando el servidor de internet", | ||
JOptionPane.ERROR_MESSAGE); | ||
} else { | ||
JOptionPane.showMessageDialog(null, | ||
"No se ha podido inicializar el servidor de internet", | ||
"Fallo inicializando el servidor de internet", | ||
JOptionPane.ERROR_MESSAGE); | ||
} | ||
if (CamServer.indicator != null) { | ||
CamServer.indicator.setState(StatusIndicator.DOWN); | ||
} | ||
if (CamServer.cameraCheckBox != null){ | ||
CamServer.cameraCheckBox.setSelected(false); | ||
} | ||
} | ||
} | ||
// If camera has been disabled, the CamServer instance stops | ||
else if (state.equals("false")) { | ||
if (CamServer.active) { | ||
CamServer.stop(); | ||
} | ||
} | ||
CamServer.LockCamServerInit.unlock(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import ij.ImagePlus; | ||
import ij.WindowManager; | ||
import ij.gui.ImageCanvas; | ||
import ij.plugin.PlugIn; | ||
|
||
import communication.v4l.CamServer; | ||
|
||
/** | ||
* This plugin runs when the activate viewer button is pushed. If the CamServer | ||
* has not been initialized, it does nothing. | ||
* | ||
* @author ehas | ||
* | ||
*/ | ||
public class ActivateViewer_ implements PlugIn { | ||
|
||
@Override | ||
public void run(String arg0) { | ||
|
||
// If CamServer is active, it notifies that the button has been pushed | ||
if (CamServer.active == true) { | ||
try { | ||
synchronized (CamServer.LockViewer) { | ||
CamServer.LockViewer.notify(); | ||
} | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import ij.plugin.PlugIn; | ||
|
||
import communication.v4l.CamServer; | ||
|
||
/** | ||
* This plugin runs when the Capture button is pushed. | ||
* | ||
* @author ehas | ||
* | ||
*/ | ||
public class Capture_ implements PlugIn { | ||
public void run(String arg) { | ||
|
||
try { | ||
synchronized (CamServer.LockLocal) { | ||
CamServer.setLocalCapture(true); | ||
} | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import gestion.GestorSave; | ||
import ij.ImagePlus; | ||
import ij.WindowManager; | ||
import ij.macro.MacroRunner; | ||
import ij.plugin.PlugIn; | ||
|
||
import javax.swing.JOptionPane; | ||
|
||
import edition.ImageManager; | ||
import edition.RoiManager; | ||
|
||
/** | ||
* This plugin runs when the close button is pushed. This is the right way to | ||
* close the whole working area: Roi manager, Images manager and Displayer. | ||
* | ||
* @author ehas | ||
* | ||
*/ | ||
public class Close_ implements PlugIn { | ||
|
||
@Override | ||
public void run(String arg0) { | ||
ImagePlus current = WindowManager.getCurrentImage(); | ||
if (current != null) { | ||
// First ask for saving the current image | ||
int result = JOptionPane.showConfirmDialog(null, | ||
"¿Desea guardar el fichero actual?", "Guardar cambios", | ||
JOptionPane.YES_NO_CANCEL_OPTION); | ||
switch (result) { | ||
case 0: | ||
GestorSave saver = new GestorSave(); | ||
saver.saveAsTifInZip(current, false); | ||
case 1: | ||
new MacroRunner("run(\"ForceClose \")\n"); | ||
break; | ||
default: | ||
// Exit the dialog and do nothing | ||
return; | ||
} | ||
} else { | ||
JOptionPane.showMessageDialog(null, "No hay imágenes abiertas", | ||
"Fallo cerrando ficheros", JOptionPane.ERROR_MESSAGE); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import edition.ImageManager; | ||
import edition.RoiManager; | ||
import ij.ImagePlus; | ||
import ij.WindowManager; | ||
import ij.plugin.PlugIn; | ||
|
||
|
||
public class ForceClose_ implements PlugIn { | ||
|
||
@Override | ||
public void run(String arg0) { | ||
ImagePlus current = WindowManager.getCurrentImage(); | ||
if (current != null) { | ||
// Close everything related to the current session | ||
if (RoiManager.getInstance() != null) { | ||
RoiManager.getInstance().close(); | ||
RoiManager.setInstance(null); | ||
} | ||
if (ImageManager.getInstance() != null) { | ||
ImageManager.getInstance().close(); | ||
} | ||
while (WindowManager.getCurrentImage() != null) { | ||
WindowManager.getCurrentImage().close(); | ||
WindowManager.setTempCurrentImage(null); | ||
} | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import ij.IJ; | ||
import ij.Prefs; | ||
import ij.plugin.PlugIn; | ||
|
||
import java.io.IOException; | ||
import java.util.Hashtable; | ||
|
||
import au.edu.jcu.v4l4j.exceptions.V4L4JException; | ||
|
||
import communication.v4l.CamServer; | ||
import communication.v4l.Settings; | ||
|
||
/** | ||
* This plugin runs at the beginning of the telemicroscopy toolbar creation. | ||
* | ||
* @author ehas | ||
* | ||
*/ | ||
public class Initialize_ implements PlugIn { | ||
|
||
public void run(String arg) { | ||
|
||
// Set the useJFileChooser preference to false in order to avoid the | ||
// change of Look&Feel when managing windows | ||
Prefs.useJFileChooser = false; | ||
|
||
// Hide the main IJ instance | ||
IJ.getInstance().setVisible(false); | ||
|
||
// Initialize the values with a device /dev/video0 | ||
String defaultDevice = Settings.getDefaultVideoDevice(); | ||
if (defaultDevice == null) { | ||
// TODO print message | ||
} else { | ||
Hashtable<String, String> defaultSettings = Settings | ||
.getDefaultSettings(defaultDevice); | ||
try { | ||
String videoResolution = defaultSettings.get("videoResolution"); | ||
String captureResolution = defaultSettings | ||
.get("captureResolution"); | ||
String interval = defaultSettings.get("interval"); | ||
CamServer.initialize(defaultDevice, | ||
Integer.parseInt(videoResolution.split("x")[0]), | ||
Integer.parseInt(videoResolution.split("x")[1]), | ||
Integer.parseInt(captureResolution.split("x")[0]), | ||
Integer.parseInt(captureResolution.split("x")[1]), | ||
CamServer.port, Integer.parseInt(interval.split("/")[0]), | ||
Integer.parseInt(interval.split("/")[1])); | ||
} catch (NumberFormatException e) { | ||
e.printStackTrace(); | ||
} catch (V4L4JException e) { | ||
e.printStackTrace(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.