selectImage(id) not working

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

selectImage(id) not working

davek604
Hello

I'm writing a macro which requires 2 separate images to be selected by a user then using the image ID later in the macro to select the image but the selectImage(id) command throws the error "The method selectImage(int) is undefined for type.

Any help appreciated

David

public void run(ImageProcessor ip) {
               
                imp.unlock(); //Unlock the image for processing
               
                //**Get Image Name and ID for later selection**
                String filename = imp.getTitle(); //Get file name
                new WaitForUserDialog("Select Red", "Select Red Image, then click OK.").show();
                int RedID = imp.getID();
                new WaitForUserDialog("Select Green", "Select Green Image, then click OK.").show();
                int GreenID = imp.getID();
               
                selectImage(RedID);  //Error here


                //***Threshold Image and store result in variable**
                IJ.run("Threshold...","method='Default'"); //Threshold the image
                new WaitForUserDialog("Threshold", "Threshold Image, then click OK.").show();
                upper = ip.getMaxThreshold(); //Get upper threshold value
                lower = ip.getMinThreshold(); //Get lower threshold value

                }
Reply | Threaded
Open this post in threaded view
|

Re: selectImage(id) not working

Olivier Burri
Hello David,

selectImage(id) is a macro function
You can use IJ.selectWindow(int id)
"For IDs less than zero, activates the image with the specified ID. For IDs greater than zero, activates the Nth image."
Or IJ.selectWindow(java.lang.String title)
"Activates the window with the specified title."

Some more doc here
http://rsb.info.nih.gov/ij/developer/api/ij/IJ.html

All the best

Oli

Olivier Burri
Engineer - Image Processing
& Software Development
EPFL - SV - PTECH - PTBIOP

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of davek604
Sent: lundi 13 janvier 2014 17:57
To: [hidden email]
Subject: selectImage(id) not working

Hello

I'm writing a macro which requires 2 separate images to be selected by a user then using the image ID later in the macro to select the image but the
selectImage(id) command throws the error "The method selectImage(int) is undefined for type.

Any help appreciated

David

public void run(ImageProcessor ip) {
               
                imp.unlock(); //Unlock the image for processing
               
                //**Get Image Name and ID for later selection**
                String filename = imp.getTitle(); //Get file name
                new WaitForUserDialog("Select Red", "Select Red Image, then click OK.").show();
                int RedID = imp.getID();
                new WaitForUserDialog("Select Green", "Select Green Image, then click OK.").show();
                int GreenID = imp.getID();
               
                selectImage(RedID);  //Error here


                //***Threshold Image and store result in variable**
                IJ.run("Threshold...","method='Default'"); //Threshold the image
                new WaitForUserDialog("Threshold", "Threshold Image, then click OK.").show();
                upper = ip.getMaxThreshold(); //Get upper threshold value
                lower = ip.getMinThreshold(); //Get lower threshold value

                }




--
View this message in context: http://imagej.1557.x6.nabble.com/selectImage-id-not-working-tp5006097.html
Sent from the ImageJ mailing list archive at Nabble.com.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: selectImage(id) not working

davek604
Thanks Oli

That worked

David