File Input

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

File Input

JingleHymrShmit
I'm writing a plugin for the first time. I need the user to input the paths of 5 images and currently I am doing this by having the user type in the paths into a dialog box. Is there a way for the user to be able to choose the image via a file browsing option. I'm sure there is a simple way to do this but I can't seem to find out how.
Reply | Threaded
Open this post in threaded view
|

Re: File Input

Daniel Kalthoff
Hi,

you could use the macro capabilities available in ImageJ plugins, i.e. use the File.openDialog(...) macro within your plugin (see example below). Sure you could get the same using clean native Java code, but this will work just as good.

Regards,

Daniel

------------

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.*;

public class My_Plugin implements PlugIn {

        public void run(String arg) {
                String s = IJ.runMacro("return File.openDialog('Select File');");
                IJ.log(s);
        }

}

JingleHymrShmit wrote
I'm writing a plugin for the first time. I need the user to input the paths of 5 images and currently I am doing this by having the user type in the paths into a dialog box. Is there a way for the user to be able to choose the image via a file browsing option. I'm sure there is a simple way to do this but I can't seem to find out how.