forked from dscho/fiji
-
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.
Conflicts: .gitignore Fakefile Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Loading branch information
Showing
71 changed files
with
18,218 additions
and
1 deletion.
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
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
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
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,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; | ||
} | ||
|
||
} |
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,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 |
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,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); | ||
} | ||
|
||
} |
Oops, something went wrong.