Writing Custom Import Code

Custom import code can be written using Wayne Rasband's ImageJ 1.29. The custom class must:

It is possible to write a custom class that serves as an ImageJ plug-in and as a MultiTracer custom class by using the following general strategy:

The following is a skeleton to illustrate a class that serves as an ImageJ import plugin and as a MultiTracer custom import class


// Do not declare a package--doing so breaks ImageJ and MultiTracer

public class ExampleImporter implements ij.plugin.Plugin {
	
	private ij.ImagePlus globalImagePlus=null;
	private boolean isPlugIn=false;
	
	public ExampleImporter(){
		isPlugIn=true;
	}
	public ExampleImporter(java.lang.String arg){
		run(arg);
	}
	public void run(java.lang.String arg){
	
		globalimagePlus=null;	// Important if class is reused by MultiTracer to load another image
	
		// Add code here to load data and create an ij.ImagePlus object called localImagePlus
		
		if(isPlugIn) localImagePlus.show();		// Causes image to be displayed in ImageJ
		else globalImagePlus=localImagePlus;
	}
	public ij.ImagePlus getImagePlus(){
		return globalImagePlus;	// if null, MultiTracer will report an import failure to the user
	}
}
	
		

Back to main MultiTracer page ©2001-2003 Roger P. Woods, M.D.

Modified: April 3, 2003