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

Method run

ij/src/main/java/ij/plugin/filter/ImageMath.java:62–148  ·  view source on GitHub ↗
(ImageProcessor ip)

Source from the content-addressed store, hash-verified

60 }
61
62 public void run(ImageProcessor ip) {
63 if (canceled)
64 return;
65 if (arg.equals("add")) {
66 ip.add(addValue);
67 } else if (arg.equals("sub")) {
68 ip.subtract(addValue);
69 } else if (arg.equals("mul")) {
70 ip.multiply(mulValue);
71 } else if (arg.equals("div")) {
72 if (mulValue==0.0&&imp.getBitDepth()!=32)
73 return;
74 else
75 ip.multiply(1.0/mulValue);
76 } else if (arg.equals("and")) {
77 try {
78 ip.and(Integer.parseInt(andValue,2));
79 } catch (NumberFormatException e) {
80 andValue = defaultAndValue;
81 IJ.error("Binary number required");
82 }
83 } else if (arg.equals("or")) {
84 try {
85 ip.or(Integer.parseInt(andValue,2));
86 } catch (NumberFormatException e) {
87 andValue = defaultAndValue;
88 IJ.error("Binary number required");
89 }
90 } else if (arg.equals("xor")) {
91 try {
92 ip.xor(Integer.parseInt(andValue,2));
93 } catch (NumberFormatException e) {
94 andValue = defaultAndValue;
95 IJ.error("Binary number required");
96 }
97 } else if (arg.equals("min")) {
98 ip.min(minValue);
99 if (!(ip instanceof ByteProcessor))
100 ip.resetMinAndMax();
101 } else if (arg.equals("max")) {
102 ip.max(maxValue);
103 if (!(ip instanceof ByteProcessor))
104 ip.resetMinAndMax();
105 } else if (arg.equals("gamma")) {
106 if (gammaValue<0.05 || gammaValue>5.0) {
107 if (!previewing() && !canceled) {
108 canceled = true;
109 IJ.error("Gamma must be between 0.05 and 5.0");
110 }
111 gammaValue = defaultGammaValue;
112 } else
113 ip.gamma(gammaValue);
114 } else if (arg.equals("set")) {
115 ip.set(addValue);
116 } else if (arg.equals("log")) {
117 ip.log();
118 } else if (arg.equals("exp")) {
119 ip.exp();

Callers

nothing calls this directly

Calls 15

errorMethod · 0.95
previewingMethod · 0.95
setBackgroundToNaNMethod · 0.95
applyMacroMethod · 0.95
parseIntMethod · 0.80
getCalibrationMethod · 0.80
addMethod · 0.65
equalsMethod · 0.45
subtractMethod · 0.45
multiplyMethod · 0.45
getBitDepthMethod · 0.45
andMethod · 0.45

Tested by

no test coverage detected