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

Method doOptions

ij/src/main/java/ij/plugin/Animator.java:222–272  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

220 }
221
222 void doOptions() {
223 if (firstFrame<1 || firstFrame>nSlices || lastFrame<1 || lastFrame>nSlices)
224 {firstFrame=1; lastFrame=nSlices;}
225 if (imp.isDisplayedHyperStack()) {
226 int frames = imp.getNFrames();
227 int slices = imp.getNSlices();
228 firstFrame = 1;
229 if (frames>1)
230 lastFrame = frames;
231 else if (slices>1)
232 lastFrame=slices;
233 }
234 boolean start = swin!=null && !swin.getAnimate();
235 Calibration cal = imp.getCalibration();
236 if (cal.fps!=0.0)
237 animationRate = cal.fps;
238 else if (cal.frameInterval!=0.0 && cal.getTimeUnit().equals("sec"))
239 animationRate = 1.0/cal.frameInterval;
240 int decimalPlaces = (int)animationRate==animationRate?0:3;
241 GenericDialog gd = new GenericDialog("Animation Options");
242 gd.addNumericField("Speed (0.1-1000 fps):", animationRate, decimalPlaces);
243 if (!imp.isDisplayedHyperStack()) {
244 gd.addNumericField("First Frame:", firstFrame, 0);
245 gd.addNumericField("Last Frame:", lastFrame, 0);
246 }
247 gd.addCheckbox("Loop Back and Forth", cal.loop);
248 gd.addCheckbox("Start Animation", start);
249 gd.showDialog();
250 if (gd.wasCanceled()) {
251 if (firstFrame==1 && lastFrame==nSlices)
252 {firstFrame=0; lastFrame=0;}
253 return;
254 }
255 double speed = gd.getNextNumber();
256 if (!imp.isDisplayedHyperStack()) {
257 firstFrame = (int)gd.getNextNumber();
258 lastFrame = (int)gd.getNextNumber();
259 }
260 if (firstFrame==1 && lastFrame==nSlices)
261 {firstFrame=0; lastFrame=0;}
262 cal.loop = gd.getNextBoolean();
263 Calibration.setLoopBackAndForth(cal.loop);
264 start = gd.getNextBoolean();
265 if (speed>1000.0) speed = 1000.0;
266 //if (speed<0.1) speed = 0.1;
267 animationRate = speed;
268 if (animationRate!=0.0)
269 cal.fps = animationRate;
270 if (start && swin!=null && !swin.getAnimate())
271 startAnimation();
272 }
273
274 void nextSlice() {
275 boolean hyperstack = imp.isDisplayedHyperStack();

Callers 1

runMethod · 0.95

Calls 15

getTimeUnitMethod · 0.95
addNumericFieldMethod · 0.95
addCheckboxMethod · 0.95
showDialogMethod · 0.95
wasCanceledMethod · 0.95
getNextNumberMethod · 0.95
getNextBooleanMethod · 0.95
setLoopBackAndForthMethod · 0.95
startAnimationMethod · 0.95
isDisplayedHyperStackMethod · 0.80
getNFramesMethod · 0.80
getNSlicesMethod · 0.80

Tested by

no test coverage detected