(ImagePlus imp)
| 212 | } |
| 213 | |
| 214 | @AstroImageJ(reason = "Correct file separator; Change default directory", modified = true) |
| 215 | private boolean showDialog(ImagePlus imp) { |
| 216 | String options = Macro.getOptions(); |
| 217 | if (options!=null && options.contains("save=")) //macro |
| 218 | Macro.setOptions(options.replaceAll("save=", "dir=")); |
| 219 | directory = Prefs.get("import.sequence.dir", IJ.getDir("downloads")+"stack2"+Prefs.getFileSeparator()); |
| 220 | GenericDialog gd = new GenericDialog("Save Image Sequence"); |
| 221 | if (!IJ.isMacro()) |
| 222 | fileType = staticFileType; |
| 223 | gd.setInsets(5, 0, 0); |
| 224 | gd.addDirectoryField("Dir:", directory); |
| 225 | gd.setInsets(2, 110, 5); |
| 226 | gd.addMessage("drag and drop target", IJ.font10, Color.darkGray); |
| 227 | gd.addChoice("Format:", choices, fileType); |
| 228 | gd.addStringField("Name:", name, 12); |
| 229 | if (!hyperstack) |
| 230 | gd.addNumericField("Start At:", startAt, 0); |
| 231 | gd.addNumericField("Digits (1-8):", ndigits, 0); |
| 232 | if (!hyperstack) |
| 233 | gd.addCheckbox("Use slice labels as file names", useLabels); |
| 234 | gd.showDialog(); |
| 235 | if (gd.wasCanceled()) |
| 236 | return false; |
| 237 | directory = gd.getNextString(); |
| 238 | directory = IJ.addSeparator(directory); |
| 239 | Prefs.set(DIR_KEY, directory); |
| 240 | gd.setSmartRecording(true); |
| 241 | fileType = gd.getNextChoice(); |
| 242 | format = fileType.toLowerCase(Locale.US); |
| 243 | if (!IJ.isMacro()) |
| 244 | staticFileType = fileType; |
| 245 | String name2 = gd.getNextString(); |
| 246 | boolean nameChanged = !name2.equals(name); |
| 247 | name = name2; |
| 248 | if (!hyperstack) |
| 249 | startAt = (int)gd.getNextNumber(); |
| 250 | if (startAt<0) startAt = 0; |
| 251 | int ndigits2 = (int)gd.getNextNumber(); |
| 252 | boolean ndigitsChanged = ndigits2!=ndigits; |
| 253 | ndigits = ndigits2; |
| 254 | if (!hyperstack) |
| 255 | useLabels = gd.getNextBoolean(); |
| 256 | else |
| 257 | useLabels = false; |
| 258 | if (IJ.recording()) { |
| 259 | String options2 = "format="+format; |
| 260 | if (nameChanged) |
| 261 | options2 += " name="+name; |
| 262 | if (ndigitsChanged) |
| 263 | options2 += " digits="+ndigits; |
| 264 | if (useLabels) |
| 265 | options2 += " use"; |
| 266 | String dir = Recorder.fixPath(directory); |
| 267 | Recorder.recordCall("StackWriter.save(imp, \""+dir+"\", \""+options2+"\");"); |
| 268 | } |
| 269 | return true; |
| 270 | } |
| 271 |
no test coverage detected