The objective of the plugin is to take a slice from a stack and then create a new stack with multiple images of the same slice but with different contrasts.
I wrote a for loop, but the results are not what I intended. The new stack is created but it's always the same image in every slice. What am I missing here?
public void run(ImageProcessor ip) {
ImageProcessor ip2 = ip.duplicate();
ImageStack nstack = new ImageStack(stack.getWidth(),stack.getHeight());
ip2.snapshot();
for(int i=0; i<256; i=i+10){
ip2.setMinAndMax(0,i);
nstack.addSlice("Contrast "+i, ip2);
ip2.reset();
}
ImagePlus imp2= new ImagePlus("teste", nstack);
imp2.show();
}}