()
| 3152 | } |
| 3153 | |
| 3154 | @AstroImageJ(reason = "Move interactions that need the EventQueue to that thread", modified = true) |
| 3155 | void open() { |
| 3156 | File f = null; |
| 3157 | interp.getLeftParen(); |
| 3158 | if (interp.nextToken()==')') { |
| 3159 | interp.getRightParen(); |
| 3160 | eventCallWait(IJ::open); |
| 3161 | } else { |
| 3162 | double n = Double.NaN; |
| 3163 | String options = null; |
| 3164 | String path = getString(); |
| 3165 | f = new File(path); |
| 3166 | if (interp.nextToken()==',') { |
| 3167 | interp.getComma(); |
| 3168 | if (isStringArg()) |
| 3169 | options = getString(); |
| 3170 | else |
| 3171 | n = interp.getExpression(); |
| 3172 | } |
| 3173 | interp.getRightParen(); |
| 3174 | if (!Double.isNaN(n)) { |
| 3175 | try { |
| 3176 | double finalN = n; |
| 3177 | eventCallWait(() -> IJ.open(path, (int) finalN)); |
| 3178 | } catch (Exception e) { |
| 3179 | String msg = e.getMessage(); |
| 3180 | if (msg!=null&&msg.indexOf("canceled")==-1) |
| 3181 | interp.error(""+msg); |
| 3182 | } |
| 3183 | } else { |
| 3184 | if (f!=null&&f.isDirectory()) { |
| 3185 | FolderOpener fo = new FolderOpener(); |
| 3186 | if (options!=null && options.contains("virtual")) |
| 3187 | fo.openAsVirtualStack(true); |
| 3188 | ImagePlus imp = fo.openFolder(path); |
| 3189 | if (imp!=null) imp.show(); |
| 3190 | } else |
| 3191 | IJ.open(path); |
| 3192 | } |
| 3193 | if (path!=null&&!path.equals("")&&f!=null) { |
| 3194 | OpenDialog.setLastDirectory(f.getParent()+File.separator); |
| 3195 | OpenDialog.setLastName(f.getName()); |
| 3196 | } |
| 3197 | } |
| 3198 | resetImage(); |
| 3199 | } |
| 3200 | |
| 3201 | double roiManager() { |
| 3202 | String cmd = getFirstString(); |
no test coverage detected