Time Series Flicker Correction

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Time Series Flicker Correction

JimmiB
Hi all,
Just wondering if anyone has implemented any "advanced" type of flicker
correction.

We have image stacks with flicker caused by variation in illumination.  Our
approach has been to adjust the image mean towards a local (mean from a
number of temporally close images).
This works well at a global level, but can make the problem worse in areas
of low intensity.
Thus a more localised approach may be required
eg.
http://www.researchgate.net/publication/30995006_A_Block_Smoothing-Based_Method_for_Flicker_Removal_in_Image_Sequences
Has anyone implemented this type of approach in imageJ?

Cheers,
James


*Dr James Burchfield*
The Garvan Institute of Medical Research
384 Victoria Street
Darlinghurst, NSW, 2010
Australia

Email: [hidden email]
Phone:+61 2 92958229
Web: *www.garvan.org.au <http://www.garvan.org.au>*

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Time Series Flicker Correction

Jerry (Gerald) Sedgewick
I've done this very effectively, but not in Image J, by histogram
matching to a target image.  MatLab has code for this, and Photoshop
does it as well (using an oddly named function called Match Color).

Jerry Sedgewick


On 1/23/2014 11:40 PM, James Burchfield wrote:

> Hi all,
> Just wondering if anyone has implemented any "advanced" type of flicker
> correction.
>
> We have image stacks with flicker caused by variation in illumination.  Our
> approach has been to adjust the image mean towards a local (mean from a
> number of temporally close images).
> This works well at a global level, but can make the problem worse in areas
> of low intensity.
> Thus a more localised approach may be required
> eg.
> http://www.researchgate.net/publication/30995006_A_Block_Smoothing-Based_Method_for_Flicker_Removal_in_Image_Sequences
> Has anyone implemented this type of approach in imageJ?
>
> Cheers,
> James
>
>
> *Dr James Burchfield*
> The Garvan Institute of Medical Research
> 384 Victoria Street
> Darlinghurst, NSW, 2010
> Australia
>
> Email: [hidden email]
> Phone:+61 2 92958229
> Web: *www.garvan.org.au <http://www.garvan.org.au>*
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Time Series Flicker Correction

ericbarnhill
In reply to this post by JimmiB
Hi James,

I use the Kalman Stack Filter for something similar, have you tried it?

Eric

> Date:    Fri, 24 Jan 2014 16:40:49 +1100
> From:    James Burchfield <[hidden email]>
> Subject: Time Series Flicker Correction
>
> Hi all,
> Just wondering if anyone has implemented any "advanced" type of flicker
> correction.
>
> We have image stacks with flicker caused by variation in illumination.  Our
> approach has been to adjust the image mean towards a local (mean from a
> number of temporally close images).
> This works well at a global level, but can make the problem worse in areas
> of low intensity.
> Thus a more localised approach may be required
> eg.
> http://www.researchgate.net/publication/30995006_A_Block_Smoothing-Based_Method_for_Flicker_Removal_in_Image_Sequences
> Has anyone implemented this type of approach in imageJ?
>
> Cheers,
> James


--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Time Series Flicker Correction

Kota Miura
In reply to this post by JimmiB
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
Reply | Threaded
Open this post in threaded view
|

Re: Time Series Flicker Correction

Cammer, Michael
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
Reply | Threaded
Open this post in threaded view
|

Re: Time Series Flicker Correction

Zian_Fanti
In reply to this post by JimmiB
Hello in this post http://imagej.1557.x6.nabble.com/normalize-stack-of-pictures-td3689335.html#a3689338 there is a solution  that's maybe works for you.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Time Series Flicker Correction

JimmiB
In reply to this post by Jerry (Gerald) Sedgewick
Hi Jerry,
Thanks for the info, I am guessing that Kota's suggestion is an
implementation of this in image J
*"*




*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."*

The problem is that these are dynamic time series, with changes in mean
intensity (due to increased fluorescence and changes in cell size).  This
means that the histogram matching needs to be implemented in a dynamic
manner in that the histogram would need to change slowly with time.



*Dr James Burchfield*
The Garvan Institute of Medical Research
384 Victoria Street
Darlinghurst, NSW, 2010
Australia

Email: [hidden email]
Phone:+61 2 92958229
Web: *www.garvan.org.au <http://www.garvan.org.au>*


On Sat, Jan 25, 2014 at 1:40 AM, jerry sedgewick
<[hidden email]>wrote:

> I've done this very effectively, but not in Image J, by histogram matching
> to a target image.  MatLab has code for this, and Photoshop does it as well
> (using an oddly named function called Match Color).
>
> Jerry Sedgewick
>
>
>
> On 1/23/2014 11:40 PM, James Burchfield wrote:
>
>> Hi all,
>> Just wondering if anyone has implemented any "advanced" type of flicker
>> correction.
>>
>> We have image stacks with flicker caused by variation in illumination.
>>  Our
>> approach has been to adjust the image mean towards a local (mean from a
>> number of temporally close images).
>> This works well at a global level, but can make the problem worse in areas
>> of low intensity.
>> Thus a more localised approach may be required
>> eg.
>> http://www.researchgate.net/publication/30995006_A_Block_
>> Smoothing-Based_Method_for_Flicker_Removal_in_Image_Sequences
>> Has anyone implemented this type of approach in imageJ?
>>
>> Cheers,
>> James
>>
>>
>> *Dr James Burchfield*
>>
>> The Garvan Institute of Medical Research
>> 384 Victoria Street
>> Darlinghurst, NSW, 2010
>> Australia
>>
>> Email: [hidden email]
>> Phone:+61 2 92958229
>> Web: *www.garvan.org.au <http://www.garvan.org.au>*
>>
>> --
>> 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
Reply | Threaded
Open this post in threaded view
|

Re: Time Series Flicker Correction

JimmiB
In reply to this post by Cammer, Michael
Thanks Michael,
The 'subtract background from ROI' macro forms the starting point for
almost all of my analysis pipelines, including this one.

The float stack macro looks very useful for some other applications, so
thankyou for that.

In this instance the change in intensity overtime is not a constant.  So a
global normalization will not work.  The assumption that can be made is
that this change is very slow relative to the frame by frame flicker caused
by illumination fluctuation.  I may have a play with this if I get time.
Cheers,
James



*Dr James Burchfield*
The Garvan Institute of Medical Research
384 Victoria Street
Darlinghurst, NSW, 2010
Australia

Email: [hidden email]
Phone:+61 2 92958229
Web: *www.garvan.org.au <http://www.garvan.org.au>*


On Mon, Jan 27, 2014 at 5:31 AM, Cammer, Michael <[hidden email]
> wrote:

> 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
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html