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

Method showDialog

ij/src/main/java/ij/plugin/Scaler.java:229–393  ·  view source on GitHub ↗
(ImageProcessor ip)

Source from the content-addressed store, hash-verified

227 }
228
229 boolean showDialog(ImageProcessor ip) {
230 String options = Macro.getOptions();
231 boolean isMacro = options!=null;
232 if (isMacro) {
233 if (options.contains(" interpolate"))
234 options = options.replaceAll(" interpolate", " interpolation=Bilinear");
235 else if (!options.contains(" interpolation="))
236 options = options+" interpolation=None";
237 if (options.contains("width=")&&options.contains(" height=")) {
238 xstr = "-";
239 ystr = "-";
240 if (options.contains(" depth="))
241 zstr = "-";
242 else
243 zstr = "1.0";
244 }
245 Macro.setOptions(options);
246 interpolationMethod = ImageProcessor.BILINEAR;
247 }
248 int bitDepth = imp.getBitDepth();
249 int stackSize = imp.getStackSize();
250 boolean isStack = stackSize>1;
251 oldDepth = stackSize;
252 if (isStack && !isMacro) {
253 xstr = "1.0";
254 ystr = "1.0";
255 zstr = "1.0";
256 }
257 r = ip.getRoi();
258 int width = newWidth;
259 if (width==0) width = r.width;
260 int height = (int)Math.round(((double)width*r.height/r.width));
261 xscale = Tools.parseDouble(xstr, 0.0);
262 yscale = Tools.parseDouble(ystr, 0.0);
263 zscale = 1.0;
264 if (xscale!=0.0 && yscale!=0.0) {
265 width = (int)Math.round(r.width*xscale);
266 height = (int)Math.round(r.height*yscale);
267 } else {
268 xstr = "-";
269 ystr = "-";
270 }
271 GenericDialog gd = new GenericDialog("Scale");
272 gd.addStringField("X Scale:", xstr);
273 gd.addStringField("Y Scale:", ystr);
274 if (isStack)
275 gd.addStringField("Z Scale:", zstr);
276 gd.setInsets(5, 0, 5);
277 gd.addStringField("Width (pixels):", ""+width);
278 gd.addStringField("Height (pixels):", ""+height);
279 if (isStack) {
280 String label = "Depth (images):";
281 if (imp.isHyperStack()) {
282 int slices = imp.getNSlices();
283 int frames = imp.getNFrames();
284 if (slices==1&&frames>1) {
285 label = "Depth (frames):";
286 oldDepth = frames;

Callers 1

runMethod · 0.95

Calls 15

getOptionsMethod · 0.95
setOptionsMethod · 0.95
parseDoubleMethod · 0.95
addStringFieldMethod · 0.95
setInsetsMethod · 0.95
getStringFieldsMethod · 0.95
addChoiceMethod · 0.95
addCheckboxMethod · 0.95
getUniqueNameMethod · 0.95
showDialogMethod · 0.95
wasCanceledMethod · 0.95
getNextStringMethod · 0.95

Tested by

no test coverage detected