[Insight-users] X-ray flat field correction filter

Robert.Atwood at diamond.ac.uk Robert.Atwood at diamond.ac.uk
Sun Jan 15 16:47:45 EST 2012


Hi,

I've created a filter for applying the simple (S-D)/(F-D) correction that we use for eliminating the effect of spatial variation in the incoming beam intensity; I didn't find such a filter present already ; but I simply copied TernaryAddImageFilter and changed the formula (and the name). However I did this without understanding how it works; the functor is defined in the header file but nowhere can I find where the functor is actually set in the class that is derived from the parent TernaryFunctorImageFilter class . (i.e. the call to SetFunctor(), where is it?) I suppose this is done by some clever trick.

It does, however, appear to work.

I did not incorporate any rescaling or casting of data types into the filter, so this must be done in a pipeline if using the filter with e.g. ushort data and expecting useful results (because the result of the division will usually be between 0 and 1, so the filter will work fine and return 0 everywhere except where noise has caused the image 'S' to have a greater value than 'F' or less than 'D' ) I think keeping it simple is best and doing the required transformations. 
For example, I may have 1000 images for which I wish to apply the same F and D, but I want to use these in a tomo reconstruction and so I don't want independant rescaling based on each image's contents. My first test applet thus applies the filter for one image, then runs the output through RescaleIntensityImageFilter, calls the Get*() functions , applys a little margin and sets the factors for IntensityWindowingFilter to apply to each of the images in the set. Other applications might require a different approach i.e. automatic scaling to each image's range might be desirable.

Would it be useful to contribute these (albeit minor) modifications , I've called it TernaryFlatcorrImageFilter;  or is this already in the library and I've missed it?
 
(I suppose one could have used the parent class, defined a functor and used SetFunctor, but actually copying TernaryAdd and modifying it seemed easier!)

Regards
Robert


 54 /** \class TernaryFlatcorrImageFilter
 55  * \brief Pixel-wise flat field correction using three images.
 56  *
 57  * Applying the formula I = ( (S-D) / (F-D))
 58  * where input1 is S (signal i.e input image)
 59  *       input2 is F (Flat or White Field Image)
 60  *       input3 is D (Dark field image)
 61  *       GetOutput() returns I (corrected Intensity)

-- 
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. 
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
 





More information about the Insight-users mailing list