Returns the ID of the Nth open image. Returns zero if n<=0 or n greater than the number of open image windows.
(int n)
| 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. */ |
| 274 | public synchronized static int getNthImageID(int n) { |
| 275 | if (n<=0) return 0; |
| 276 | if (Interpreter.isBatchMode()) { |
| 277 | int[] list = getIDList(); |
| 278 | if (n>list.length) |
| 279 | return 0; |
| 280 | else |
| 281 | return list[n-1]; |
| 282 | } else { |
| 283 | if (n>imageList.size()) return 0; |
| 284 | ImageWindow win = (ImageWindow)imageList.get(n-1); |
| 285 | if (win!=null) |
| 286 | return win.getImagePlus().getID(); |
| 287 | else |
| 288 | return 0; |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | |
| 293 | /** Returns the first image that has the specified title or null if it is not found. */ |
no test coverage detected