Complex image integration
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
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
Merge request reports
Activity
- Resolved by Antoine Regimbeau
- Resolved by Antoine Regimbeau
- Resolved by Antoine Regimbeau
- Resolved by Antoine Regimbeau
- Resolved by Antoine Regimbeau
- Resolved by Antoine Regimbeau
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; I will keep m_Lower, and m_Upper as it avoids me to call
this->GetFunctor().GetHighest()
which is not even implemented by the way... Do I need to add Getter for a functor?Edited by Antoine Regimbeau
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 { - Resolved by Antoine Regimbeau
- Resolved by Antoine Regimbeau
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 changed this line in version 2 of the diff
changed milestone to %6.6.0
- Resolved by Antoine Regimbeau
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
Toggle commit listadded 1 commit
- ed90bd5f - REFAC: minor modification following Gitlab thread
added 2 commits