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

Method run2

ij/src/main/java/ij/plugin/ZProjector.java:142–200  ·  view source on GitHub ↗
(ImagePlus img, String arg)

Source from the content-addressed store, hash-verified

140 }
141
142 public void run2(ImagePlus img, String arg) {
143 imp = img;
144
145 // Make sure input image is a stack.
146 if(imp.getStackSize()==1) {
147 IJ.error("Z Project", "Stack required");
148 return;
149 }
150
151 // Check for inverting LUT.
152 if (imp.getProcessor().isInvertedLut()) {
153 if (!IJ.showMessageWithCancel("ZProjection", lutMessage))
154 return;
155 }
156
157 setDefaultBounds();
158
159 // Build control dialog
160 GenericDialog gd = buildControlDialog(startSlice,stopSlice);
161 gd.showDialog();
162 if (gd.wasCanceled()) return;
163
164 if (!imp.lock()) return; // exit if in use
165 long tstart = System.currentTimeMillis();
166 gd.setSmartRecording(true);
167 int startSlice2 = startSlice;
168 int stopSlice2 = stopSlice;
169 setStartSlice((int)gd.getNextNumber());
170 setStopSlice((int)gd.getNextNumber());
171 boolean rangeChanged = startSlice!=startSlice2 || stopSlice!=stopSlice2;
172 startSlice2 = startSlice;
173 stopSlice2 = stopSlice;
174 gd.setSmartRecording(false);
175 method = gd.getNextChoiceIndex();
176 Prefs.set(METHOD_KEY, method);
177 if (isHyperstack)
178 allTimeFrames = imp.getNFrames()>1&&imp.getNSlices()>1?gd.getNextBoolean():false;
179 doProjection(true);
180
181 if (arg.equals("") && projImage!=null) {
182 long tstop = System.currentTimeMillis();
183 if (simpleComposite && imp.getBitDepth()!=24)
184 IJ.run(projImage, "Grays", "");
185 projImage.show("ZProjector: " +IJ.d2s((tstop-tstart)/1000.0,2)+" seconds");
186 }
187
188 imp.unlock();
189 IJ.register(ZProjector.class);
190 if (Recorder.scriptMode()) {
191 String m = getMethodAsString();
192 if (isHyperstack && allTimeFrames)
193 m = m + " all";
194 String range = "";
195 if (rangeChanged)
196 range = ","+startSlice2+","+stopSlice2;
197 Recorder.recordCall("imp = ZProjector.run(imp,\""+m+"\""+range+");");
198 }
199

Callers 2

runMethod · 0.95
runMethod · 0.80

Calls 15

errorMethod · 0.95
showMessageWithCancelMethod · 0.95
setDefaultBoundsMethod · 0.95
buildControlDialogMethod · 0.95
showDialogMethod · 0.95
wasCanceledMethod · 0.95
setSmartRecordingMethod · 0.95
setStartSliceMethod · 0.95
getNextNumberMethod · 0.95
setStopSliceMethod · 0.95
getNextChoiceIndexMethod · 0.95
setMethod · 0.95

Tested by

no test coverage detected