Posted by
Cammer, Michael on
Jan 26, 2014; 6:31pm
URL: http://imagej.273.s1.nabble.com/Time-Series-Flicker-Correction-tp5006250p5006288.html
Here are three methods we've used. Also try the subtract background macro followed by the multiply macro.
Regards-
Michael
//-----------------------------------------------
macro 'Multiply to fix bleaching based on ROI'{
//checkCurrentVersion();
original = getImageID();
run("Set Measurements...", " mean redirect=None decimal=0");
run("Plot Z-axis Profile"); run("Close");
standard = getResult("Mean",(0));
selectImage(original);
for (i=1; i<=nSlices; i++){
bgmean = standard / getResult("Mean",(i-1));
run("Set Slice...", "slice="+i);
run("Select All");
run("Multiply...", "slice value="+bgmean);
} // for
run("Select None");
selectWindow("Results");
run("Close");
} // macro 'Multiply to fix bleaching based on ROI'
//---------------------------------------------------------
//based on 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);
}
//===================================================================
// This macro measures the same region of interest in each slice of a stack and subtracts the mean plus
// specified standard deviation of the mean from each corresponding slice. It is useful for situations where
// there is background intensity changing over time due to something like a flickering light source and you
// want the stack's background to be uniform. It may not be appropriate for situations where precise intensity
// measurements will be made that should be uniform through the stack. Subtracting one constant from the
// entire stack is likely better.
// To use, put a ROI over a region that is background in all slices. (Choose the ROI on a maximum pixel
// projection if features to assure only bg pixels are included.) Run the macro.
//
macro 'Subtract background based on ROI'{
n = 0; // this is the number of standard deviations to add to the mean bg to subtract
checkCurrentVersion();
image_to_process = getImageID();
run("Set Measurements...", " mean standard redirect=None decimal=5");
run("Plot Z-axis Profile");
run("Close");
selectImage(image_to_process);
run("Select All");
for (i=1; i<=nSlices; i++){
bgmean=getResult("Mean",(i-1)) + n*getResult("StdDev",(i-1));
run("Set Slice...", "slice="+i);
run("Subtract...", "slice value="+bgmean);
} // for loop
run("Select None");
run("Min...", "value=0 stack");
resetMinAndMax();
} // Subtract background based on ROI
_________________________________________
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 Kota Miura [
[hidden email]]
Sent: Sunday, January 26, 2014 10:14 AM
To:
[hidden email]
Subject: Re: Time Series Flicker Correction
Hi James,
If you are using Fiji, try "Bleach Correction" and select "Histogram
matching" .
Only the current problem is that it takes long time with 16bit image stack.
For 8bit image stack, its pretty fast.
cheers,
Kota
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html------------------------------------------------------------
This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email.
=================================
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html