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

Robert Atwood mailinglists+insight at atwood.org.uk
Mon Jan 16 14:28:54 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?

If so I can begin putting a paper to the journal.

Or is it too trivial to be worthwhile having a separate filter? But, the advanced c++ required to define a new functor, I can guarantee is a roadblock for some


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




More information about the Insight-developers mailing list