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

Method setup

ij/src/main/java/ij/Undo.java:42–95  ·  view source on GitHub ↗
(int what, ImagePlus imp)

Source from the content-addressed store, hash-verified

40 private static int overlayImageID;
41
42 public static void setup(int what, ImagePlus imp) {
43 if (imp==null) {
44 whatToUndo = NOTHING;
45 reset();
46 return;
47 }
48 if (IJ.debugMode) IJ.log("Undo.setup: "+what+" "+imp);
49 if (what==FILTER && whatToUndo==COMPOUND_FILTER)
50 return;
51 if (what==COMPOUND_FILTER_DONE) {
52 if (whatToUndo==COMPOUND_FILTER)
53 whatToUndo = what;
54 return;
55 }
56 whatToUndo = what;
57 imageID = imp.getID();
58 if (what==TYPE_CONVERSION) {
59 ipCopy = imp.getProcessor();
60 calCopy = (Calibration)imp.getCalibration().clone();
61 } else if (what==TRANSFORM) {
62 if ((!IJ.macroRunning()||Prefs.supportMacroUndo) && (imp.getStackSize()==1||imp.getDisplayMode()==IJ.COMPOSITE) && imp.getSizeInBytes()<209715200)
63 impCopy = imp.duplicate();
64 else
65 reset();
66 } else if (what==MACRO) {
67 ipCopy = imp.getProcessor().duplicate();
68 calCopy = (Calibration)imp.getCalibration().clone();
69 impCopy = null;
70 } else if (what==COMPOUND_FILTER) {
71 ImageProcessor ip = imp.getProcessor();
72 if (ip!=null)
73 ipCopy = ip.duplicate();
74 else
75 ipCopy = null;
76 } else if (what==OVERLAY_ADDITION) {
77 impCopy = null;
78 ipCopy = null;
79 } else if (what==ROI) {
80 impCopy = null;
81 ipCopy = null;
82 Roi roi = imp.getRoi();
83 if (roi!=null) {
84 roiCopy = (Roi)roi.clone();
85 roiCopy.setImage(null);
86 } else
87 whatToUndo = NOTHING;
88 } else if (what==OVERLAY) {
89 saveOverlay(imp);
90 } else {
91 ipCopy = null;
92 //ImageProcessor ip = imp.getProcessor();
93 //lutCopy = (LUT)ip.getLut().clone();
94 }
95 }
96
97 /** This function should be called from PlugInFilters that modify the overlay prior to the operation.
98 * For the type 'FILTER', undo of overlays requires that the modified image also has an overlay. */

Callers 15

copyMethod · 0.95
pasteMethod · 0.95
undoMethod · 0.95
doFunctionMethod · 0.95
doOperationMethod · 0.95
runMethod · 0.95
runMethod · 0.95
enlargeMethod · 0.95
fitCircleMethod · 0.95
fitSplineMethod · 0.95
interpolateMethod · 0.95
createEllipseMethod · 0.95

Calls 15

resetMethod · 0.95
logMethod · 0.95
macroRunningMethod · 0.95
duplicateMethod · 0.95
cloneMethod · 0.95
saveOverlayMethod · 0.95
getIDMethod · 0.80
getCalibrationMethod · 0.80
getSizeInBytesMethod · 0.80
cloneMethod · 0.65
getProcessorMethod · 0.45
getStackSizeMethod · 0.45

Tested by

no test coverage detected