Request for changes-125: Merge Complex and standard Image Parameter

From OTBWiki
Jump to: navigation, search

[Request for Changes - 125] Merge Complex and standard Image Parameter


  • Author: Antoine
  • Additional Contributors (if different than authors)
  • Submitted on 23/11/2017
  • Proposed target release 6.4
  • Adopted / Rejected (with vote results)
  • git complexImage_integration
  • Merged :


Allow image parameters to hold complex images. Thus, we no longer need distinction between ParameterType_ComplexInputImage and ParameterType_InputImage (same with output).


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

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


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


Add two test on extractROI and readImageInfo with complex images.

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


Additional notes