MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / showDialog

Method showDialog

ij/src/main/java/ij/plugin/StackWriter.java:214–270  ·  view source on GitHub ↗
(ImagePlus imp)

Source from the content-addressed store, hash-verified

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

Callers 1

runMethod · 0.95

Calls 15

getOptionsMethod · 0.95
setOptionsMethod · 0.95
getMethod · 0.95
getDirMethod · 0.95
getFileSeparatorMethod · 0.95
isMacroMethod · 0.95
setInsetsMethod · 0.95
addDirectoryFieldMethod · 0.95
addMessageMethod · 0.95
addChoiceMethod · 0.95
addStringFieldMethod · 0.95
addNumericFieldMethod · 0.95

Tested by

no test coverage detected