Contrast PlugIn
Posted by
Priscila Gomes on
Apr 14, 2015; 5:34pm
URL: http://imagej.273.s1.nabble.com/Contrast-PlugIn-tp5012471.html
Hi!
The objective of the plugin I'm writing 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.Firstly, I tried to put the altered images on a stack, with a for loop. But all the images get the same contrast definitions (max and min) as the first one added.So, my second approach, was to create the stack with the original image, and then alter its contrast definition. This does quite except, that when it's done, the stack gets the same min max definitions as the last slice modified.I don't know what I'm missing.Can someone help me?
This is the code I wrote:
public void run(ImageProcessor ip) { ImageProcessor ip2 = ip.duplicate(); ImageStack nstack = new ImageStack(stack.getWidth(),stack.getHeight()); for(int i=0; i<100; i++){ nstack.addSlice(ip2); //creates the stack } ImagePlus imp2= new ImagePlus("teste", nstack); imp2.show(); //the image is shown modifying the contrast for(int j=0; j<100;j++){ imp2.setSlice(j); IJ.run(imp2, "Enhance Contrast", "saturated="+j+" normalize"); }}
Regards,
Priscila Gomes, MSc student
Portugal
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html