I've tried all options in Process/Enhance contrast and cannot get each
individual frame stretched based on its individual statistics. Images in my stack have very different range and I need to run an animation to show their differences in terms of noise level, thus I need to linearly stretch (equalization would be too severe) each frame leaving ie 2% of saturated or unsaturated pixels. I've tried clicking on Process all 196 slices and/or Normalize, but I always get some slices too dark or totally white, which should not be the case. Also, I have the impression that the actual applied stretching depends upon the image being displayed when selecting the options in the Enhance Contrast menu. I understand in most cases people want all slices being stretched on the same values ("use stack histogram) for the slices to be comparable, but not in this case. Any other plugin? Agus Note: my stack is made of 32bit images. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
How about this macro which I modified slightly from the original posting a while back?
//--------------------------------------------------------- //Method by Kenton Arkill [[hidden email]] //Floating means that each image has the same mean pixel value and the same standard deviation. //I find it really useful as it means the same threshold can often be used on all the images. Here is my macro, //it floats the stack to the values of the first slice (so make sure it is a good image): macro "Float the stack"{ run("32-bit"); for (i = 1; i <= nSlices; i++) { setSlice(i); getRawStatistics(nPixels, meani, min, max, stdi, histogram); run("Subtract...", "value="+meani+" slice"); run("Divide...", "value="+stdi+" slice"); run("Multiply...", "value="+stdref+" slice"); run("Add...", "value="+stdref+" slice"); } run("Enhance Contrast", "saturated=0.35"); // may change saturated # setSlice(1); // optional } _________________________________________ Michael Cammer, Assistant Research Scientist Skirball Institute of Biomolecular Medicine Lab: (212) 263-3208 Cell: (914) 309-3270 ________________________________________ From: ImageJ Interest Group [[hidden email]] on behalf of Agustin Lobo [[hidden email]] Sent: Monday, April 29, 2013 3:46 AM To: [hidden email] Subject: Contrast slices in stack according to individual statistics I've tried all options in Process/Enhance contrast and cannot get each individual frame stretched based on its individual statistics. Images in my stack have very different range and I need to run an animation to show their differences in terms of noise level, thus I need to linearly stretch (equalization would be too severe) each frame leaving ie 2% of saturated or unsaturated pixels. I've tried clicking on Process all 196 slices and/or Normalize, but I always get some slices too dark or totally white, which should not be the case. Also, I have the impression that the actual applied stretching depends upon the image being displayed when selecting the options in the Enhance Contrast menu. I understand in most cases people want all slices being stretched on the same values ("use stack histogram) for the slices to be comparable, but not in this case. Any other plugin? Agus Note: my stack is made of 32bit images. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Whoops-- IGNORE THE LAST RESPONSE because two lines were missing. They are in this version.
//--------------------------------------------------------- //Kenton Arkill [[hidden email]] //Floating means that each image has the same mean pixel value and the same standard deviation. //I find it really useful as it means the same threshold can often be used on all the images. Here is my macro, //it floats the stack to the values of the first slice (so make sure it is a good image): macro "Float the stack"{ run("32-bit"); setSlice(1); getRawStatistics(nPixels, meanref, min, max, stdref, histogram); for (i = 1; i <= nSlices; i++) { setSlice(i); getRawStatistics(nPixels, meani, min, max, stdi, histogram); run("Subtract...", "value="+meani+" slice"); run("Divide...", "value="+stdi+" slice"); run("Multiply...", "value="+stdref+" slice"); run("Add...", "value="+stdref+" slice"); } run("Enhance Contrast", "saturated=0.35"); setSlice(1); } _________________________________________ Michael Cammer, Assistant Research Scientist Skirball Institute of Biomolecular Medicine Lab: (212) 263-3208 Cell: (914) 309-3270 ________________________________________ From: ImageJ Interest Group [[hidden email]] on behalf of Cammer, Michael [[hidden email]] Sent: Monday, April 29, 2013 5:56 PM To: [hidden email] Subject: Re: Contrast slices in stack according to individual statistics How about this macro which I modified slightly from the original posting a while back? //--------------------------------------------------------- //Method by Kenton Arkill [[hidden email]] //Floating means that each image has the same mean pixel value and the same standard deviation. //I find it really useful as it means the same threshold can often be used on all the images. Here is my macro, //it floats the stack to the values of the first slice (so make sure it is a good image): macro "Float the stack"{ run("32-bit"); for (i = 1; i <= nSlices; i++) { setSlice(i); getRawStatistics(nPixels, meani, min, max, stdi, histogram); run("Subtract...", "value="+meani+" slice"); run("Divide...", "value="+stdi+" slice"); run("Multiply...", "value="+stdref+" slice"); run("Add...", "value="+stdref+" slice"); } run("Enhance Contrast", "saturated=0.35"); // may change saturated # setSlice(1); // optional } _________________________________________ Michael Cammer, Assistant Research Scientist Skirball Institute of Biomolecular Medicine Lab: (212) 263-3208 Cell: (914) 309-3270 ________________________________________ From: ImageJ Interest Group [[hidden email]] on behalf of Agustin Lobo [[hidden email]] Sent: Monday, April 29, 2013 3:46 AM To: [hidden email] Subject: Contrast slices in stack according to individual statistics I've tried all options in Process/Enhance contrast and cannot get each individual frame stretched based on its individual statistics. Images in my stack have very different range and I need to run an animation to show their differences in terms of noise level, thus I need to linearly stretch (equalization would be too severe) each frame leaving ie 2% of saturated or unsaturated pixels. I've tried clicking on Process all 196 slices and/or Normalize, but I always get some slices too dark or totally white, which should not be the case. Also, I have the impression that the actual applied stretching depends upon the image being displayed when selecting the options in the Enhance Contrast menu. I understand in most cases people want all slices being stretched on the same values ("use stack histogram) for the slices to be comparable, but not in this case. Any other plugin? Agus Note: my stack is made of 32bit images. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |