[Insight-users] absolute value : and new filters for complex images

Luis Ibanez luis.ibanez at kitware.com
Fri May 27 12:23:40 EDT 2005


Hi Jakub,


You are right,
your proposed naming is way more consistent that was I was suggesting.
and you pointed out also that the Adaptors should be created for the
same goal.


For your convinience we just committed the following new classes
to the CVS repository:


      Insight/Code/Common/
        itkComplexToModulusImageAdaptor.h
        itkComplexToPhaseImageAdaptor.h


      Insight/Code/BasicFilters/
        itkComplexToModulusImageFilter.h
        itkComplexToPhaseImageFilter.h



Please update your CVS checkout and let us know if you find any problem
with these new classes.


     Thanks


         Luis


---------------------

Jakub Bican wrote:

> Hi Luis,
> 
> thanks, this will be good solution. I need all the filters, so i can implement
> them next week.
> 
> But, isn't that problem, that there are implemented these classes in ITK: ?
> ComplexToImaginary (itk::Function) 
> ComplexToImaginaryImageAdaptor (itk)
> ComplexToImaginaryImageFilter (itk)
> ComplexToImaginaryPixelAccessor (itk::Accessor)
> ComplexToReal (itk::Function)
> ComplexToRealImageAdaptor (itk)
> ComplexToRealImageFilter (itk)
> ComplexToRealPixelAccessor (itk::Accessor)   
> 
> Wouldn't it be better to implement rather ComplexToModulusXXX and
> ComplexToPhasorXXX classes??
> 
> 
> Regards,
> Jakub
> 
> 
> 
> ---------- Original Message -----------
> From: Luis Ibanez <luis.ibanez at kitware.com>
> To: Jakub Bican <jakub.bican at matfyz.cz>
> Cc: "Miller, James V (Research)" <millerjv at crd.ge.com>, insight-users at itk.org
> Sent: Thu, 26 May 2005 12:44:26 -0400
> Subject: Re: [Insight-users] absolute value : and new filters for complex images
> 
> 
>>Hi Jakub,
>>
>>I would suggest that we create a "Modulus" filter
>>that will call the function abs().  Modulus is
>>probably a more formal name for the computation
>>that you are intending to apply on the complex
>>numbers.
>>
>>http://mathworld.wolfram.com/ComplexNumber.html
>>
>>The filter will be just a copy/pasted version
>>of the AbsImageFilter, renamed as ModulusImageFilter,
>>and calling "abs()" instead of using the "if".
>>
>>In this way we don't have to compromise the performance
>>of the AbsImageFilter.
>>
>>By the same token we could add other filters that may
>>be useful when dealing with complex numbers.
>>
>>For example:
>>
>>         itkImaginaryPartImageFilter
>>         itkRealPartImageFilter
>>         itkPhasorImageFilter
>>
>>Please let us know if you find this reasonable,
>>
>>    Thanks
>>
>>        Luis
>>
>>--------------------
>>Jakub Bican wrote:
>>
>>
>>>OK, i understand that.
>>>
>>>So, is there some way to adjust AbsImageFilter to use abs() function for any
>>>type, that is not a C++ scalar numeric value? I took a look inside filter's
>>>code and i did not found a good solution that will not affect the
>>>performance. But, of course, it doesn't mean that it do not exist :))
>>>
>>>I prefer to adjust current filter  - once it is a Abs filter templated over
>>>types, it would compute absolute value for all types for which is the abs()
>>>function defined....
>>>
>>>Thanks,
>>>
>>>        Jakub
>>>
>>>
>>>----- Original Message ----- 
>>>From: "Miller, James V (Research)" <millerjv at crd.ge.com>
>>>To: "Jakub Bican" <jakub.bican at matfyz.cz>; <insight-users at itk.org>
>>>Sent: Wednesday, May 25, 2005 2:31 PM
>>>Subject: RE: [Insight-users] absolute value
>>>
>>>
>>>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
>>>
>>>_______________________________________________
>>>Insight-users mailing list
>>>Insight-users at itk.org
>>>http://www.itk.org/mailman/listinfo/insight-users
>>>
>>>
> 
> ------- End of Original Message -------
> 
> 
> 





More information about the Insight-users mailing list