Skip to content
Snippets Groups Projects

Complex image integration

Merged 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

Merged by Antoine RegimbeauAntoine Regimbeau 7 years ago (Feb 21, 2018 1:38pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 122 this->GetFunctor().GetOutputSize ( sizeIn ) );
    128 123 }
    129 124
    130 125 private:
    131 ClampImageFilter(const Self&); //purposely not implemented
    132 void operator=(const Self&); //purposely not implemented
    126 ClampImageFilter(const Self&) = delete ;
    127 void operator=(const Self&) = delete ;
    133 128
    134 129 double m_DLower;
    135 130 double m_DUpper;
    136 131
    137 OutputImagePixelType m_Lower;
    138 OutputImagePixelType m_Upper;
    132 OutputPixelValueType m_Lower;
    133 OutputPixelValueType m_Upper;
  • 39 class ConvertTypeFunctor
    40 {
    41 public:
    42 typedef TInputPixelType InputPixelType;
    43 typedef TOutputPixelType OutputPixelType;
    44 typedef ConvertTypeFunctor Self;
    45
    46 typedef typename itk::NumericTraits < InputPixelType > :: ValueType InputInternalPixelType;
    47 typedef typename itk::NumericTraits < OutputPixelType > :: ValueType OutputInternalPixelType;
    48
    49 typedef typename itk::NumericTraits < InputInternalPixelType > :: ValueType InputPixelValueType;
    50 typedef typename itk::NumericTraits < OutputInternalPixelType > :: ValueType OutputPixelValueType;
    51
    52 // template < class InternalPixelType >
    53 unsigned int GetOutputSize( unsigned int sizeIn )
    54 {
  • 171 *********************************************************************/
    147 172
    148 otbGenericDefineCastImageMacro(ComplexFloatImageType, )
    149 otbGenericDefineCastImageMacro(ComplexDoubleImageType, )
    173 // otbGenericDefineCastImageMacro(ComplexFloatImageType, )
    174 // otbGenericDefineCastImageMacro(ComplexDoubleImageType, )
    150 175
    151 176
    152 177 /*********************************************************************
    153 178 ********************** VectorImage -> VectorImage
    154 179 **********************************************************************/
    155 otbGenericDefineCastImageMacro(ComplexFloatVectorImageType, Vector)
    156 otbGenericDefineCastImageMacro(ComplexDoubleVectorImageType, Vector)
    180 // otbGenericDefineCastImageMacro(ComplexFloatVectorImageType, Vector)
    181 // otbGenericDefineCastImageMacro(ComplexDoubleVectorImageType, Vector)
    157 182
  • Manuel Grizonnet changed milestone to %6.6.0

    changed milestone to %6.6.0

  • Guillaume Pasero changed the description

    changed the description

  • added 8 commits

    • 344a0b3b - REFAC: take into account merge request comments
    • 02f45c83 - ENH: change the way the size is treated
    • a99d54f0 - ENH: change for better nd lighter implementation of GetOutputSize()
    • f39175b2 - TEST: add new test cases
    • 547117b7 - ENH: make some member const
    • 707df065 - REFAC: cleaning commented code
    • e686968f - REFAC: Major cleaning of commented code
    • 7d9ca32f - ENH: change static const for static constexpr

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Some changed have been made in the ConvertTypeFunctor class... Implementation of void SetInputComponents( unsigned int sizeIn ) and unsigned int GetOutputSize(). And some computations have been moved away from operator() to improve efficiency.

  • added 1 commit

    • ed90bd5f - REFAC: minor modification following Gitlab thread

    Compare with previous version

  • Guillaume Pasero added 2 commits

    added 2 commits

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading