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

Method changeSlice

ij/src/main/java/ij/plugin/Animator.java:332–367  ·  view source on GitHub ↗
(int pn)

Source from the content-addressed store, hash-verified

330 }
331
332 void changeSlice(int pn) {
333 boolean hyperstack = imp.isDisplayedHyperStack();
334 int channels = imp.getNChannels();
335 int slices = imp.getNSlices();
336 int frames = imp.getNFrames();
337 if (swin.getAnimate() && (channels*slices*frames==Math.max(channels,Math.max(slices,frames))) )
338 {stopAnimation(); return;} //if only one dimension, stop animating
339 if(hyperstack){
340 int c=imp.getChannel(); int z=imp.getSlice(); int t=imp.getFrame();
341 if (frames>1 && !((slices>1||channels>1)&&(IJ.controlKeyDown()||IJ.spaceBarDown()||IJ.altKeyDown()) || swin.getAnimate())){
342 t += pn;
343 if (t>frames) t = frames;
344 if (t<1) t = 1;
345 } else if (slices>1 && !(channels>1&& (IJ.altKeyDown() || IJ.spaceBarDown()) || ((swin.getAnimate()|| IJ.controlKeyDown()) && frames==1)) ) {
346 z += pn;
347 if (z>slices) z = slices;
348 if (z<1) z = 1;
349 } else if (channels>1) {
350 c += pn;
351 if (c>channels) c = channels;
352 if (c<1) c = 1;
353 }
354 swin.setPosition(c, z, t);
355 } else {
356 if (IJ.altKeyDown())
357 slice+=(pn*10);
358 else
359 slice+=pn;
360 if (slice>nSlices)
361 slice = nSlices;
362 if (slice<1)
363 slice = 1;
364 swin.showSlice(slice);
365 }
366 imp.updateStatusbarValue();
367 }
368
369 void setSlice() {
370 if (imp.isDisplayedHyperStack()) {

Callers 1

runMethod · 0.95

Calls 15

stopAnimationMethod · 0.95
controlKeyDownMethod · 0.95
spaceBarDownMethod · 0.95
altKeyDownMethod · 0.95
isDisplayedHyperStackMethod · 0.80
getNSlicesMethod · 0.80
getNFramesMethod · 0.80
getAnimateMethod · 0.80
updateStatusbarValueMethod · 0.80
getChannelMethod · 0.65
getFrameMethod · 0.65
getNChannelsMethod · 0.45

Tested by

no test coverage detected