// This macro demonstrates how a macro can display a // data input dialog box. The dialog it creates contains // one string field, one popup menu, three numeric fields, // one RadioButtonGroup and one check box. // It also shows how to have two dialog items in one row. title = "Untitled"; width=512; height=512; fillWith = newArray("White","Black","Ramp","Noise"); msg = "* When closing, ImageJ will ask whether to save\n" +"the image even if it has not been modified." Dialog.create("New Image"); Dialog.addString("Title:", title, 20); Dialog.addChoice("Type:", newArray("8-bit", "16-bit", "32-bit", "RGB")); Dialog.addToSameRow(); Dialog.addMessage("(Use '32-bit' for float)"); Dialog.addNumber("Width:", 512); Dialog.addToSameRow(); Dialog.addNumber("Height:", 512); Dialog.addNumber("Stack slices:", 1); Dialog.addRadioButtonGroup("Fill with", fillWith, 1, 4, "Ramp"); Dialog.addCheckbox("Mark as changed *", false); Dialog.setInsets(0, 0, 0); Dialog.addMessage(msg); Dialog.show(); title = Dialog.getString(); width = Dialog.getNumber(); height = Dialog.getNumber(); slices = Dialog.getNumber(); type = Dialog.getChoice(); fillType = Dialog.getRadioButton(); markAsChanged = Dialog.getCheckbox(); newImage(title, type+" "+fillType, width, height, slices); setOption("Changes", markAsChanged);