Skip to content

Complex image integration

Antoine Regimbeau requested to merge complexImage_integration into develop

Summary

Gives a short summary of the changes.

Rationale

Application will be able to run with a complex image if it is possible (ExtractRoi, ReadImageInfo ...).

Check #1514

https://wiki.orfeo-toolbox.org/index.php/Request_for_changes-125:_Merge_Complex_and_standard_Image_Parameter

Implementation Details

The only change in the API is that now if you want to get a complex image from an input image parameter you need to call GetComplexTypeImage(). GetImage() will return a float vector image, not a complex float vector image as before. Inside a filter has been modified to handle the conversion and the clamping.

Classes and files

In the following files a new implementation of ClampImageFilter has been developed :

M       Modules/Filtering/ImageManipulation/include/otbClampImageFilter.h
M       Modules/Filtering/ImageManipulation/include/otbClampImageFilter.txx

The idea was to generalize the whole interaction between complex/real image/vectorImage. ClampFilter is now able to convert any type of input into any type of output with the following rules :

  • real to complex transformation : the two first components of the real input will be transform in the first complex component of the output, and so on for the other components.
  • real with odd number of component into complex will result in the last component of the output containing complex with imaginary part equal to zero.
  • complex to real transformation : the two first components of the real output will be the real part and the imaginary part of the input's first complex component, and so on for the other components.

In order for this to be possible a functor based on DefaultConvertPixelTraits class has been written. This DefaultConvertPixelTraits has been changed to inherit from the corresponding class in itk.

M       Modules/Core/ImageBase/include/otbDefaultConvertPixelTraits.h
A       Modules/Filtering/ImageManipulation/include/otbConvertTypeFunctor.h

Thanks to this new tool one has been able to clean lots of stuff in the ApplicationEngine module :

  • no more ImageWriter only VectorImageWriter
  • one ClampAndWrite function
  • one template cast function (no more specialization and simplecast or vectorcast)
M       Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h
M       Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexInputImageParameter.h
M       Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexInputImageParameter.txx
M       Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexOutputImageParameter.h
M       Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.h
M       Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.txx
M       Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h
M       Modules/Wrappers/ApplicationEngine/include/otbWrapperTypes.h
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexInputImageParameter.cxx
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterMacros.h
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx
M       Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputImageParameter.cxx
M       Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetComplexOutputImageParameter.cxx

Two new types are now available : cint16 and cint32. Some macros have been changed and thus some files are no longer useful, the following are deprecated :

M       Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterDouble.cxx
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterFloat.cxx
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt16.cxx
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt32.cxx
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt16.cxx
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt32.cxx
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt8.cxx
M       Modules/Filtering/ImageManipulation/include/otbOneRIBandImageToOneComplexBandImage.h
M       Modules/Filtering/ImageManipulation/include/otbRealImageToComplexImageFilter.h
M       Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.h
M       Modules/Filtering/ImageManipulation/include/otbClampVectorImageFilter.h

Applications

In the following applications complex image parameter have been changed to simple image parameter. But in order to get complex image out of the parameter one need to call GetComplexTypeImage("") whereas before a GetImage("") would have been enough.

M       Modules/Applications/AppDomainTransform/app/otbDomainTransform.cxx
M       Modules/Applications/AppSARCalibration/app/otbSARCalibration.cxx
M       Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx
M       Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx
M       Modules/Applications/AppSARPolarSynth/app/otbSARPolarSynth.cxx
M       Modules/Applications/AppSARUtils/app/otbComputeModulusAndPhase.cxx

In this application ClampVectorImageFilter has been changed to ClampImageFilter :

M       Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx

Tests

Add two test on extractROI and readImageInfo with complex images.

M       Modules/Applications/AppImageUtils/test/CMakeLists.txt

And adding all possible conversion between vector/image real/complex of the clam filter :

M       Modules/Filtering/ImageManipulation/test/CMakeLists.txt
M       Modules/Filtering/ImageManipulation/test/otbClampImageFilter.cxx
M       Modules/Filtering/ImageManipulation/test/otbImageManipulationTestDriver.cxx

Also add test for output parameter but did not register them as it will use a lot of data space for baseline

Edited by Guillaume Pasero

Merge request reports

Loading