[Insight-users] absolute value

Miller, James V (Research) millerjv at crd.ge.com
Wed May 25 08:31:48 EDT 2005


The AbsImageFilter uses this code instead of C++ calls for speed.

MS Windows systems are exceptionally slow at taking an absolute 
value.  The simple "if" check below is substantially faster on 
Windows systems.  I can't recall if this is a general Intel
processor issue or a MS Windows issue.  If it is an Intel issue, 
then the "if" version of the code would also be faster on Linux
systems.

I would suggest having a separate filter (or path through the AbsImageFilter)
for complex<> data.

Jim



-----Original Message-----
From: insight-users-bounces+millerjv=crd.ge.com at itk.org
[mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of
Jakub Bican
Sent: Wednesday, May 25, 2005 3:44 AM
To: insight-users at itk.org
Subject: Re: [Insight-users] absolute value



Hi

i recently wanted to use AbsImageFilter and i found out, that it is not
using standard C++ abs() function (and overloads), but does something like
this:
if (A<0)
    return -1*A;
else
    return A;

This is a big problem with e.g. complex<> values! So, Isabelle, be aware of
the AbsImageFilter!

ITK team> should be AbsImageFilter changed to use standard abs() function
and it's overloads, please? Or is there any reason why it is not so?

Thanks,
Jakub


----- Original Message ----- 
From: "Gavin Baker" <gavinb+xtk at cs.mu.OZ.AU>
To: "Renaud Isabelle" <renauisa at yahoo.fr>
Cc: "insight-users" <insight-users at itk.org>
Sent: Wednesday, May 25, 2005 8:49 AM
Subject: Re: [Insight-users] absolute value and Hilbert transform


>
> Bonjour Isabelle,
>
> On Tue, May 24, 2005 at 07:43:21PM +0200, Renaud Isabelle wrote:
>
> > I am working on RF images. In order to visualize these ones, I have
> > to compute the absolute value of the image and then rescale image
> > data.
> >
> > I am wondering if there is already an ITK function adapted to
> > calculate the absolute value of an image. Or should I use abs()
> > function of math library in C?
>
> Yes, ITK has a filter to calculate the absolute value per-pixel.  It
> is one of many unary functors, as described here:
>
>   http://www.itk.org/Doxygen/html/classitk_1_1AbsImageFilter.html
>
> You may also be interested in these filters (for the rescaling):
>
>
http://www.itk.org/Doxygen/html/classitk_1_1RescaleIntensityImageFilter.html
>   http://www.itk.org/Doxygen/html/classitk_1_1ShiftScaleImageFilter.html
>
http://www.itk.org/Doxygen/html/classitk_1_1IntensityWindowingImageFilter.html
>
> > In future, I would have to transform RF images in B-mode images for
> > a better visualization. This is by computing the absolute value of
> > the Hilbert transform of RF image data. Is it also an ITK Hilbert
> > transform already computed?
>
> ITK doesn't currently provide such a filter (AFAIK).  The Software
> Guide has a section on writing new filters, and you should be able to
> base your new filter on an existing filter (most likely starting with
> ImageToImageFilter).  The VNL library has quite a comprehensive matrix
> math library, which should provide what you need for the implementation.
>
> Good luck,
>
>   :: Gavin
>
> -- 
> Gavin Baker                                      Complex Systems Group
> http://www.cs.mu.oz.au/~gavinb             The University of Melbourne
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>

_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list