For IDs less than zero, returns the ImagePlus with the specified ID. Returns null if no open window has a matching ID or no images are open. For IDs greater than zero, returns the Nth ImagePlus. Returns null if the ID is zero.
(int imageID)
| 247 | For IDs greater than zero, returns the Nth ImagePlus. Returns null if |
| 248 | the ID is zero. */ |
| 249 | public synchronized static ImagePlus getImage(int imageID) { |
| 250 | if (imageID>0) |
| 251 | imageID = getNthImageID(imageID); |
| 252 | if (imageID==0 || getImageCount()==0) |
| 253 | return null; |
| 254 | ImagePlus imp2 = Interpreter.getBatchModeImage(imageID); |
| 255 | if (imp2!=null) |
| 256 | return imp2; |
| 257 | ImagePlus imp = null; |
| 258 | for (int i=0; i<imageList.size(); i++) { |
| 259 | ImageWindow win = (ImageWindow)imageList.get(i); |
| 260 | imp2 = win.getImagePlus(); |
| 261 | if (imageID==imp2.getID()) { |
| 262 | imp = imp2; |
| 263 | break; |
| 264 | } |
| 265 | } |
| 266 | imp2 = getCurrentImage(); |
| 267 | if (imp==null &&imp2!=null && imp2.getID()==imageID) |
| 268 | return imp2; |
| 269 | return imp; |
| 270 | } |
| 271 | |
| 272 | /** Returns the ID of the Nth open image. Returns zero if n<=0 |
| 273 | or n greater than the number of open image windows. */ |
no test coverage detected