Reduces the number of slices in this stack by a factor.
(int factor)
| 480 | |
| 481 | /** Reduces the number of slices in this stack by a factor. */ |
| 482 | public void reduce(int factor) { |
| 483 | if (factor<2 || nSlices/factor<1 || names==null) |
| 484 | return; |
| 485 | nSlices = nSlices/factor; |
| 486 | for (int i=0; i<nSlices; i++) { |
| 487 | names[i] = names[i*factor]; |
| 488 | if (labels != null) |
| 489 | labels[i] = labels[i*factor]; |
| 490 | } |
| 491 | ImagePlus imp = WindowManager.getCurrentImage(); |
| 492 | if (imp!=null) { |
| 493 | imp.setSlice(1); |
| 494 | imp.updateAndRepaintWindow(); |
| 495 | } |
| 496 | } |
| 497 | |
| 498 | } |
| 499 |
no test coverage detected