Login  Register

deleteSlice(1) deletes the second image of a stack

Posted by JiHO-2 on Jun 24, 2009; 11:18pm
URL: http://imagej.273.s1.nabble.com/deleteSlice-1-deletes-the-second-image-of-a-stack-tp3692024.html

Hello everyone,

I am probably doing something wrong, otherwise this looks like a bug:

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.*;
import ij.plugin.filter.PlugInFilter;

public class Delete_First implements PlugInFilter {

     ImagePlus im;
     ImageStack stack;

     public int setup(String arg, ImagePlus im) {
         this.im = im;
         return DOES_ALL+STACK_REQUIRED;
     }

     public void run(ImageProcessor ip) {

         // Delete first slice of the stack
         stack = im.getStack();
         stack.deleteSlice(1);

         im.updateAndDraw();
     }
}

This deletes the second image of the stack. stack.deleteSlice(0) gives  
an array out of bounds error.

Thanks in advance for your help. Sincerely,

JiHO
---
http://maururu.net