Skip to content

Commit

Permalink
Merge branch 'edf'
Browse files Browse the repository at this point in the history
Conflicts:
	.gitignore
	Fakefile

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Dec 24, 2010
2 parents b8049b3 + d740405 commit b05edaf
Show file tree
Hide file tree
Showing 71 changed files with 18,218 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,6 @@
/plugins/Temporal_Color_Coder.jar
/plugins/Samples_.jar
/plugins/Lasso_and_Blow_Tool.jar
/jars/wavelets.jar
/jars/imageware.jar
/plugins/Extended_Depth_Field.jar
8 changes: 7 additions & 1 deletion Fakefile
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ PLUGIN_TARGETS=plugins/Jython_Interpreter.jar \
plugins/Temporal_Color_Coder.jar \
plugins/Samples_.jar \
plugins/Lasso_and_Blow_Tool.jar \
jars/mij.jar
jars/mij.jar \
jars/wavelets.jar \
jars/imageware.jar \
plugins/Extended_Depth_Field.jar \

all <- fiji $SUBMODULE_TARGETS $PLUGIN_TARGETS

Expand Down Expand Up @@ -396,6 +399,9 @@ CLASSPATH(plugins/Linear_Kuwahara.jar)=jars/ij.jar
CLASSPATH(plugins/Thread_Killer.jar)=jars/ij.jar
CLASSPATH(plugins/MosaicJ_.jar)=jars/ij.jar
CLASSPATH(plugins/SheppLogan_.jar)=jars/ij.jar
CLASSPATH(jars/wavelets.jar)=jars/ij.jar
CLASSPATH(jars/imageware.jar)=jars/ij.jar
CLASSPATH(plugins/Extended_Depth_Field.jar)=jars/ij.jar:jars/imageware.jar:jars/wavelets.jar

# pre-Java5 generics ;-)

Expand Down
1 change: 1 addition & 0 deletions LICENSES
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Name File Author(s) Contact License
* Color Histogram Color_Histogram.jar Dimiter Prodanov dimiterpp@gmail.com GPL 2
* Color Inspector 3D Color_Inspector_3D.jar Kai Uwe Barthel k.barthel@fhtw-berlin.de PD
* Differentials Differentials_.jar Philippe Thevenaz http://bigwww.epfl.ch/thevenaz/differentials/ BIG (see below)
* Extended Depth of Focus Extended_Depth_Field.jar Alex Prudencio, Daniel Sage et al http://bigwww.epfl.ch/demo/edf/ BIG (see below)
* FeatureJ FeatureJ_.jar Erik Meijering http://www.imagescience.org/meijering/software/featurej/ imagescience (see below)
* Fiji_Plugins.jar Fiji_Plugins.jar Various authors http://pacific.mpi-cbg.de/contributors PD,GPL
* Fiji as a framework GPL
Expand Down
114 changes: 114 additions & 0 deletions src-plugins/Extended_Depth_Field/Demo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
//==============================================================================
//
// Project: EDF - Extended Depth of Focus
//
// Author: Daniel Sage
//
// Organization: Biomedical Imaging Group (BIG)
// Ecole Polytechnique Federale de Lausanne (EPFL), Lausanne, Switzerland
//
// Information: http://bigwww.epfl.ch/demo/edf/
//
// Reference: B. Forster, D. Van De Ville, J. Berent, D. Sage, M. Unser
// Complex Wavelets for Extended Depth-of-Field: A New Method for the Fusion
// of Multichannel Microscopy Images, Microscopy Research and Techniques,
// 65(1-2), pp. 33-42, September 2004.
//
// Conditions of use: You'll be free to use this software for research purposes,
// but you should not redistribute it without our consent. In addition, we
// expect you to include a citation or acknowledgment whenever you present or
// publish results that are based on it.
//
// History:
// - Updated (Daniel Sage, 21 December 2010)
//
//==============================================================================

import ij.ImagePlus;
import ij.ImageStack;
import ij.process.ColorProcessor;

import java.applet.Applet;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.MediaTracker;
import java.awt.Toolkit;
import java.net.URL;

/**
* This class is an applet demonstration of the EDF. It loads a image stack
* and present the easy dialog.
*/
public class Demo extends Applet {

private EDF_Easy_ edf;

/**
* Initialization of the applet.
* Load the image stack soudure.
*/
public void init() {
ImageStack stack = new ImageStack(512, 512);
for(int i=2; i<9; i++) {
ColorProcessor cp1 = (ColorProcessor)(new ImagePlus("",
loadImageFile("soudure/s000" + i + ".jpg"))).getProcessor();
stack.addSlice("", cp1);
}

ImagePlus imp = new ImagePlus("z-stack of images", stack);

imp.show();
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
Dimension window = imp.getWindow().getSize();
if (window.width==0)
return;
int left = screen.width/4-window.width/2;
int top = (screen.height-window.height)/4;
if (top<0) top = 0;
imp.getWindow().setLocation(left, top);

edf = new EDF_Easy_();
edf.run("applet");

edf.dl.setJSliderQuality(2);
edf.dl.setJSliderRegularization(4);
edf.dl.setJCheckBoxShow3D(true);
edf.dl.setJCheckBoxShowTopology(true);
}

/**
* Load an image from a URL.
*/
public Image loadImageURL(String urltext) {
Image image = null;
try {
URL url = new URL(urltext);
MediaTracker mtracker = new MediaTracker(this);
image = getImage(url);
mtracker.addImage(image, 0);
mtracker.waitForAll();
}
catch (Exception e) {
System.out.println("Exeception" + e);
}
return image;
}

/**
* Load an image from a local file.
*/
public Image loadImageFile(String filename) {
Image image=null;
MediaTracker mtracker = new MediaTracker(this);
image = getImage(this.getDocumentBase(), filename);
mtracker.addImage(image, 0);
try {
mtracker.waitForAll();
}
catch (InterruptedException ie) {
System.out.println("Bad loading of an image.");
}
return image;
}

}
37 changes: 37 additions & 0 deletions src-plugins/Extended_Depth_Field/EDF-demo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// EDF Demo Macro
//
// http://bigwww.epfl.ch/demo/edf/
//
// Daniel Sage
// Biomecial Imaging Group (BIG)
// Ecole Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland
//
// 14 June 2007
//

run("EDF Easy ", "quality='0' topology='1' show-topology='off' show-view='off'");

//
// Description of the arguments
//
// argument quality: Speed/Quality trade-off.
// 0 for fast
// 1 for intermediate speed
// 2 for medium quality / medium speed
// 3 for intermediate quality
// 4 for high quality
//
// argument topology: Topology smoothness
// 0 for no smoothing of the topology
// 1 for weak smoothing
// 2 for medium smoothing
// 3 for strong smoothing
// 4 for very strong smoothing
//
// argument show-topology: Show the topology map
// on
// off
//
// argument show-view: Show the 3D view
// on
// off
162 changes: 162 additions & 0 deletions src-plugins/Extended_Depth_Field/EDF_Easy_.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
//==============================================================================
//
// Project: EDF - Extended Depth of Focus
//
// Author: Daniel Sage
//
// Organization: Biomedical Imaging Group (BIG)
// Ecole Polytechnique Federale de Lausanne (EPFL), Lausanne, Switzerland
//
// Information: http://bigwww.epfl.ch/demo/edf/
//
// Reference: B. Forster, D. Van De Ville, J. Berent, D. Sage, M. Unser
// Complex Wavelets for Extended Depth-of-Field: A New Method for the Fusion
// of Multichannel Microscopy Images, Microscopy Research and Techniques,
// 65(1-2), pp. 33-42, September 2004.
//
// Conditions of use: You'll be free to use this software for research purposes,
// but you should not redistribute it without our consent. In addition, we
// expect you to include a citation or acknowledgment whenever you present or
// publish results that are based on it.
//
// History:
// - Updated (Daniel Sage, 21 December 2010)
//
//==============================================================================

import ij.IJ;
import ij.ImagePlus;
import ij.Macro;
import ij.WindowManager;
import ij.gui.GUI;
import ij.plugin.PlugIn;

import java.util.StringTokenizer;

import edfgui.BasicDialog;

/**
* This class is a plugin of ImageJ. It offers an easy dialog box to run
* the EDF program.
*/
public class EDF_Easy_ implements PlugIn {

public BasicDialog dl;

/**
* Implements the run method of PlugIn.
*/
public void run(String args) {
// Check the ImageJ version
if (IJ.versionLessThan("1.21a"))
return;

// Check the presence of the image
ImagePlus imp = WindowManager.getCurrentImage();

if (imp == null) {
IJ.error("No stack of images open");
return;
}

// Check the size of the image
if (imp.getWidth() < 4) {
IJ.error("The image is too small (nx=" + imp.getWidth() + ")");
return;
}

if (imp.getHeight() < 4) {
IJ.error("The image is too small (ny=" + imp.getHeight() + ")");
return;
}

if (imp.getStackSize() < 2) {
IJ.error("The stack of images is too small (nz=" + imp.getStackSize() + ")");
return;
}

// Color or grayscale image
boolean color = false;
if (imp.getType() == ImagePlus.COLOR_RGB)
color = true;
else if (imp.getType() == ImagePlus.GRAY8)
color = false;
else if (imp.getType() == ImagePlus.GRAY16)
color = false;
else if (imp.getType() == ImagePlus.GRAY32)
color = false;
else {
IJ.error("Only process 8-bits, 16-bits, 32-bits and RGB images");
return;
}

if (Macro.getOptions() != null) {
dl = new BasicDialog(new int[]{imp.getWidth(), imp.getHeight()}, color, args.equals("applet"));

String params = Macro.getValue(Macro.getOptions(), "quality", "");
if (!params.equals("")) {
String arguments[] = split(params);
if (arguments.length != 1) {
IJ.error("The arguments of the quality are not valid. Correct example: quality='0'");
return;
}
int quality = (new Integer(arguments[0])).intValue();
dl.parameters.setQualitySettings(quality);
}

params = Macro.getValue(Macro.getOptions(), "topology", "");
if (!params.equals("")) {
String arguments[] = split(params);
if (arguments.length != 1) {
IJ.error("The arguments of the topology are not valid. Correct example: topology='0'");
return;
}
int topology = (new Integer(arguments[0])).intValue();
dl.parameters.setTopologySettings(topology);
}

params = Macro.getValue(Macro.getOptions(), "show-view", "");
if (!params.equals("")) {
String arguments[] = split(params);
if (arguments.length != 1) {
IJ.error("The arguments of the show-view are not valid. Correct example: show-view='on'");
return;
}
dl.parameters.show3dView = arguments[0].equals("on");
}

params = Macro.getValue(Macro.getOptions(), "show-topology", "");
if (!params.equals("")) {
String arguments[] = split(params);
if (arguments.length != 1) {
IJ.error("The arguments of the show-topology are not valid. Correct example: show-topology='on'");
return;
}
dl.parameters.showTopology = arguments[0].equals("on");
}

dl.process();
}
else {
dl = new BasicDialog(new int[]{imp.getWidth(), imp.getHeight()},color, args.equals("applet"));
dl.initialize();
dl.pack();
GUI.center(dl);
dl.setVisible(true);
}

}

/**
* Split a macro options string.
*/
private String[] split(String s) {
StringTokenizer t = new StringTokenizer(s);
String[] items = new String[t.countTokens()];
for (int k = 0; (k < items.length); k++) {
items[k] = t.nextToken();
}
return(items);
}

}
Loading

0 comments on commit b05edaf

Please sign in to comment.