otbSARPolarMatrixConvert.cxx 25.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/*
 * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
 *
 * This file is part of Orfeo Toolbox
 *
 *     https://www.orfeo-toolbox.org/
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
20 21 22 23

#include "otbWrapperApplication.h"
#include "otbWrapperApplicationFactory.h"

24 25 26 27 28 29 30 31 32
#include "otbSinclairToCoherencyMatrixImageFilter.h"
#include "otbSinclairToCovarianceMatrixImageFilter.h"
#include "otbSinclairToCircularCovarianceMatrixImageFilter.h"
#include "otbSinclairToMuellerMatrixImageFilter.h"

#include "otbSinclairToReciprocalCoherencyMatrixImageFilter.h"
#include "otbSinclairToReciprocalCovarianceMatrixImageFilter.h"
#include "otbSinclairToReciprocalCircularCovarianceMatrixImageFilter.h"

33 34 35
#include "otbMuellerToReciprocalCovarianceImageFilter.h"
#include "otbMuellerToPolarisationDegreeAndPowerImageFilter.h"

36 37 38 39 40
#include "otbReciprocalCoherencyToReciprocalMuellerImageFilter.h"
#include "otbReciprocalCovarianceToCoherencyDegreeImageFilter.h"
#include "otbReciprocalCovarianceToReciprocalCoherencyImageFilter.h"
#include "otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.h"

41 42 43 44 45
namespace otb
{
namespace Wrapper
{

46
class SARPolarMatrixConvert : public Application
47 48 49
{
public:
  /** Standard class typedefs. */
50 51 52 53
  typedef SARPolarMatrixConvert         Self;
  typedef Application                   Superclass;
  typedef itk::SmartPointer<Self>       Pointer;
  typedef itk::SmartPointer<const Self> ConstPointer;
54

55
  // Monostatic case
56 57 58
  using RCohSRFilterType = SinclairToReciprocalCoherencyMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
  using RCovSRFilterType = SinclairToReciprocalCovarianceMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
  using RCCSRFilterType  = SinclairToReciprocalCircularCovarianceMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
59

60 61 62
  using RCRMFilterType = otb::ReciprocalCoherencyToReciprocalMuellerImageFilter<ComplexDoubleVectorImageType, DoubleVectorImageType>;
  using RCCDFilterType = otb::ReciprocalCovarianceToCoherencyDegreeImageFilter<ComplexDoubleVectorImageType, ComplexDoubleVectorImageType>;
  using RCRCFilterType = otb::ReciprocalCovarianceToReciprocalCoherencyImageFilter<ComplexDoubleVectorImageType, ComplexDoubleVectorImageType>;
63

64
  using RLCRCCFilterType = otb::ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter<ComplexDoubleVectorImageType, ComplexDoubleVectorImageType>;
65

66
  // Bistatic case
67 68 69 70
  using CohSRFilterType = SinclairToCoherencyMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
  using CovSRFilterType = SinclairToCovarianceMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
  using CCSRFilterType  = SinclairToCircularCovarianceMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
  using MSRFilterType   = SinclairToMuellerMatrixImageFilter<ComplexDoubleImageType, DoubleVectorImageType>;
71

72
  using MRCFilterType  = otb::MuellerToReciprocalCovarianceImageFilter<DoubleVectorImageType, ComplexDoubleVectorImageType>;
73
  using MPDPFilterType = otb::MuellerToPolarisationDegreeAndPowerImageFilter<DoubleVectorImageType, DoubleVectorImageType>;
74 75 76 77

  /** Standard macro */
  itkNewMacro(Self);

78
  itkTypeMacro(SARPolarMatrixConvert, otb::Application);
79 80

private:
81
  void DoInit() override
82
  {
83
    SetName("SARPolarMatrixConvert");
84 85 86
    SetDescription("This applications allows converting classical polarimetric matrices to each other.");

    // Documentation
87
    SetDocName("SARPolarMatrixConvert");
88
    SetDocLongDescription(
89

90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
        "This application allows converting classical polarimetric matrices to each other.\n"
        "For instance, it is possible to get the coherency matrix from the Sinclar one, or the Mueller matrix from the coherency one.\n"
        "The filters used in this application never handle matrices, but images where each band is related to their elements.\n"
        "As most of the time SAR polarimetry handles symmetric/hermitian matrices, only the relevant elements are stored, so that the images representing them "
        "have a minimal number of bands.\n"
        "For instance, the coherency matrix size is 3x3 in the monostatic case, and 4x4 in the bistatic case: it will thus be stored in a 6-band or a 10-band "
        "complex image (the diagonal and the upper elements of the matrix).\n"
        "\n"
        "The Sinclair matrix is a special case: it is always represented as 3 or 4 one-band complex images (for mono or bistatic case).\n"
        "The available conversions are listed below:\n"

        "\n--- Monostatic case ---\n"

        "1 msinclairtocoherency --> Sinclair matrix to coherency matrix (input: 3 x 1 complex channel (HH, HV or VH, VV) | output:  6 complex channels)\n"
        "2 msinclairtocovariance --> Sinclair matrix to covariance matrix (input: 3 x 1 complex channel (HH, HV or VH, VV) | output:  6 complex channels)\n"
        "3 msinclairtocircovariance --> Sinclair matrix to circular covariance matrix (input: 3 x 1 complex channel (HH, HV or VH, VV) | output:  6 complex "
        "channels)\n"
        "4 mcoherencytomueller --> Coherency matrix to Mueller matrix (input: 6 complex channels | 16 real channels)\n"
        "5 mcovariancetocoherencydegree --> Covariance matrix to coherency degree (input: 6 complex channels | 3 complex channels)\n"
        "6 mcovariancetocoherency --> Covariance matrix to coherency matrix (input: 6 complex channels | 6 complex channels)\n"
        "7 mlinearcovariancetocircularcovariance --> Covariance matrix to circular covariance matrix (input: 6 complex channels | output: 6 complex channels)\n"

        "\n--- Bistatic case ---\n"

        "8 bsinclairtocoherency --> Sinclair matrix to coherency matrix (input: 4 x 1 complex channel (HH, HV, VH, VV) | 10 complex channels)\n"
        "9 bsinclairtocovariance --> Sinclair matrix to covariance matrix (input: 4 x 1 complex channel (HH, HV, VH, VV) | output: 10 complex channels)\n"
        "10 bsinclairtocircovariance --> Sinclair matrix to circular covariance matrix (input: 4 x 1 complex channel (HH, HV, VH, VV) | output: 10 complex "
        "channels)\n"

        "\n--- Both cases ---\n"

        "11 sinclairtomueller --> Sinclair matrix to Mueller matrix (input: 4 x 1 complex channel (HH, HV, VH, VV) | output: 16 real channels)\n"
        "12 muellertomcovariance --> Mueller matrix to covariance matrix (input: 16 real channels | output: 6 complex channels)\n"
        "13 muellertopoldegandpower --> Mueller matrix to polarization degree and power (input: 16 real channels | output: 4 real channels)"

    );
126 127
    SetDocLimitations("None");
    SetDocAuthors("OTB-Team");
128
    SetDocSeeAlso("SARPolarSynth, SARDecompositions");
129 130 131

    AddDocTag(Tags::SAR);

132
    AddParameter(ParameterType_InputImage, "inc", "Input multi-band complex image");
133
    SetParameterDescription("inc", "Input: multi-band complex image");
134
    MandatoryOff("inc");
135

136
    AddParameter(ParameterType_InputImage, "inf", "Input multi-band real image");
137
    SetParameterDescription("inf", "Input: multi-band real image");
138 139 140
    MandatoryOff("inf");


141
    AddParameter(ParameterType_InputImage, "inhh", "Input one-band complex image (HH)");
142
    SetParameterDescription("inhh", "Input: one-band complex image (HH)");
143
    MandatoryOff("inhh");
144

145
    AddParameter(ParameterType_InputImage, "inhv", "Input one-band complex image (HV)");
146
    SetParameterDescription("inhv", "Input: one-band complex image (HV)");
147
    MandatoryOff("inhv");
148

149
    AddParameter(ParameterType_InputImage, "invh", "Input one-band complex image (VH)");
150
    SetParameterDescription("invh", "Input: one-band complex image (VH)");
151
    MandatoryOff("invh");
152

153
    AddParameter(ParameterType_InputImage, "invv", "Input one-band complex image (VV)");
154
    SetParameterDescription("invv", "Input: one-band complex image (VV)");
155
    MandatoryOff("invv");
156

157
    AddParameter(ParameterType_OutputImage, "outc", "Output Complex Image");
158 159
    SetParameterDescription("outc", "Output Complex image.");
    MandatoryOff("outc");
160

161
    AddParameter(ParameterType_OutputImage, "outf", "Output Real Image");
162 163
    SetParameterDescription("outf", "Output Real image.");
    MandatoryOff("outf");
164 165


166
    AddParameter(ParameterType_Choice, "conv", "Conversion");
167

168
    // Monostatic case
169

Christophe Palmann's avatar
Christophe Palmann committed
170
    // #1
171
    // SinclairToReciprocalCoherency
172 173
    AddChoice("conv.msinclairtocoherency","1 Monostatic: Sinclair matrix to coherency matrix (complex output)");
    SetParameterDescription("conv.msinclairtocoherency","1 Monostatic: Sinclair matrix to coherency matrix (complex output)");
174

Christophe Palmann's avatar
Christophe Palmann committed
175
    // #2
176
    // SinclairToReciprocalCovariance
177 178
    AddChoice("conv.msinclairtocovariance","2 Monostatic: Sinclair matrix to covariance matrix (complex output)");
    SetParameterDescription("conv.msinclairtocovariance","2 Monostatic: Sinclair matrix to covariance matrix (complex output)");
179 180

    // #3
181
    // SinclairToReciprocalCircularCovariance
182 183
    AddChoice("conv.msinclairtocircovariance","3 Monostatic: Sinclair matrix to circular covariance matrix (complex output)");
    SetParameterDescription("conv.msinclairtocircovariance","3 Monostatic: Sinclair matrix to circular covariance matrix (complex output)");
184 185

    // #4
186
    // ReciprocalCoherencyToReciprocalMuellerImageFilter
187 188
    AddChoice("conv.mcoherencytomueller", "4 Monostatic: Coherency matrix to Mueller matrix");
    SetParameterDescription("conv.mcoherencytomueller", "4 Monostatic: Coherency matrix to Mueller matrix");
189

Christophe Palmann's avatar
Christophe Palmann committed
190
    // #5
191
    // ReciprocalCovarianceToCoherencyDegreeImageFilter
192 193
    AddChoice("conv.mcovariancetocoherencydegree", "5 Monostatic: Covariance matrix to coherency degree");
    SetParameterDescription("conv.mcovariancetocoherencydegree", "5 Monostatic: Covariance matrix to coherency degree ");
194

Christophe Palmann's avatar
Christophe Palmann committed
195
    // #6
196
    // ReciprocalCovarianceToReciprocalCoherencyImageFilter
197 198
    AddChoice("conv.mcovariancetocoherency", "6 Monostatic: Covariance matrix to coherency matrix (complex output)");
    SetParameterDescription("conv.mcovariancetocoherency", "6 Monostatic: Covariance matrix to coherency matrix (complex output)");
199

Christophe Palmann's avatar
Christophe Palmann committed
200
    // #7
201
    // ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter
202 203
    AddChoice("conv.mlinearcovariancetocircularcovariance", "7 Monostatic: Covariance matrix to circular covariance matrix (complex output)");
    SetParameterDescription("conv.mlinearcovariancetocircularcovariance", "7 Monostatic: Covariance matrix to circular covariance matrix (complex output)");
204

205
    // #8
206
    // MuellerToReciprocalCovarianceImageFilter
207 208
    AddChoice("conv.muellertomcovariance","8 Bi/mono: Mueller matrix to monostatic covariance matrix");
    SetParameterDescription("conv.muellertomcovariance","8 Bi/mono: Mueller matrix to monostatic covariance matrix");
209

210
    //Bistatic case
211

212
    // #9
213
    // SinclairToCoherency
214 215
    AddChoice("conv.bsinclairtocoherency","9 Bistatic: Sinclair matrix to coherency matrix (complex output)");
    SetParameterDescription("conv.bsinclairtocoherency","9 Bistatic: Sinclair matrix to coherency matrix (complex output)");
216

217
    // #10
218
    // SinclairToCovariance
219 220
    AddChoice("conv.bsinclairtocovariance","10 Bistatic: Sinclair matrix to covariance matrix (complex output)");
    SetParameterDescription("conv.bsinclairtocovariance","10 Bistatic: Sinclair matrix to covariance matrix (complex output)");
221

222
    // #11
223
    // SinclairToCircularCovariance
224 225
    AddChoice("conv.bsinclairtocircovariance","11 Bistatic: Sinclair matrix to circular covariance matrix (complex output)");
    SetParameterDescription("conv.bsinclairtocircovariance","11 Bistatic: Sinclair matrix to circular covariance matrix (complex output)");
226

Christophe Palmann's avatar
Christophe Palmann committed
227
    //Both case
228

229
    // #12
Christophe Palmann's avatar
Christophe Palmann committed
230
    // SinclairToMueller
231 232
    AddChoice("conv.sinclairtomueller","12 Bi/mono: Sinclair matrix to Mueller matrix");
    SetParameterDescription("conv.sinclairtomueller","12 Bi/mono: Sinclair matrix to Mueller matrix");
233 234


Christophe Palmann's avatar
Christophe Palmann committed
235
    // #13
236
    // MuellerToPolarisationDegreeAndPowerImageFilter
237 238
    AddChoice("conv.muellertopoldegandpower","13 Bi/mono: Mueller matrix to polarisation degree and power");
    SetParameterDescription("conv.muellertopoldegandpower","13 Bi/mono: Mueller matrix to polarisation degree and power");
239 240 241 242 243 244 245 246

    AddRAMParameter();

    // Default values
    SetDefaultParameterInt("conv", 0); // SinclairToReciprocalCoherency

    // Doc example parameter settings
    SetDocExampleParameterValue("inhh", "HH.tif");
247 248 249
    SetDocExampleParameterValue("invh", "VH.tif");
    SetDocExampleParameterValue("invv", "VV.tif");
    SetDocExampleParameterValue("conv", "msinclairtocoherency");
250
    SetDocExampleParameterValue("outc", "mcoherency.tif");
251

252
    SetOfficialDocLink();
253 254
  }

255
  void DoUpdateParameters() override
256
  {
257

258
    int convType = GetParameterInt("conv");
259

260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333
    if ((convType >= 0) && (convType <= 2)) // msinclairtocoherency msinclairtocovariance msinclairtocircovariance
    {
      GetParameterByKey("inc")->SetActive(false);
      GetParameterByKey("inf")->SetActive(false);
      GetParameterByKey("inhh")->SetActive(true);
      GetParameterByKey("inhv")->SetActive(true);
      GetParameterByKey("invh")->SetActive(true);
      GetParameterByKey("invv")->SetActive(true);
      GetParameterByKey("outc")->SetActive(true);
      GetParameterByKey("outf")->SetActive(false);
    }
    else if ((convType >= 3) &&
             (convType <= 6)) // mcoherencytomueller mcovariancetocoherencydegree mcovariancetocoherency mlinearcovariancetocircularcovariance
    {
      GetParameterByKey("inc")->SetActive(true);
      GetParameterByKey("inf")->SetActive(false);
      GetParameterByKey("inhh")->SetActive(false);
      GetParameterByKey("inhv")->SetActive(false);
      GetParameterByKey("invh")->SetActive(false);
      GetParameterByKey("invv")->SetActive(false);

      if (convType == 3)
      {
        GetParameterByKey("outc")->SetActive(false);
        GetParameterByKey("outf")->SetActive(true);
      }
      else
      {
        GetParameterByKey("outc")->SetActive(true);
        GetParameterByKey("outf")->SetActive(false);
      }
    }
    else if (convType == 7) // muellertomcovariance
    {
      GetParameterByKey("inc")->SetActive(false);
      GetParameterByKey("inf")->SetActive(true);
      GetParameterByKey("inhh")->SetActive(false);
      GetParameterByKey("inhv")->SetActive(false);
      GetParameterByKey("invh")->SetActive(false);
      GetParameterByKey("invv")->SetActive(false);
      GetParameterByKey("outc")->SetActive(true);
      GetParameterByKey("outf")->SetActive(false);
    }
    else if ((convType >= 8) && (convType <= 11)) // bsinclairtocoherency bsinclairtocovariance bsinclairtocircovariance sinclairtomueller
    {
      GetParameterByKey("inc")->SetActive(false);
      GetParameterByKey("inf")->SetActive(false);
      GetParameterByKey("inhh")->SetActive(true);
      GetParameterByKey("inhv")->SetActive(true);
      GetParameterByKey("invh")->SetActive(true);
      GetParameterByKey("invv")->SetActive(true);

      if (convType == 11)
      {
        GetParameterByKey("outc")->SetActive(false);
        GetParameterByKey("outf")->SetActive(true);
      }
      else
      {
        GetParameterByKey("outc")->SetActive(true);
        GetParameterByKey("outf")->SetActive(false);
      }
    }
    else if (convType == 12) // muellertopoldegandpower
    {
      GetParameterByKey("inc")->SetActive(false);
      GetParameterByKey("inf")->SetActive(true);
      GetParameterByKey("inhh")->SetActive(false);
      GetParameterByKey("inhv")->SetActive(false);
      GetParameterByKey("invh")->SetActive(false);
      GetParameterByKey("invv")->SetActive(false);
      GetParameterByKey("outc")->SetActive(false);
      GetParameterByKey("outf")->SetActive(true);
    }
334 335
  }

336
  void DoExecute() override
337 338 339
  {

    //****************************************
340 341
    //* Check inputs and outputs consistency *
    //****************************************
342

343 344 345 346 347 348 349 350
    bool inc  = HasUserValue("inc");
    bool inf  = HasUserValue("inf");
    bool inhh = HasUserValue("inhh");
    bool inhv = HasUserValue("inhv");
    bool invh = HasUserValue("invh");
    bool invv = HasUserValue("invv");
    bool outc = HasUserValue("outc");
    bool outf = HasUserValue("outf");
351

352
    int convType = GetParameterInt("conv");
353 354


355 356
    if ((!outc) && (!outf))
      otbAppLogFATAL(<< "No output image provided; please, set the parameter 'outc' or 'outf'.");
357 358


359 360 361 362 363 364 365 366 367
    if ((convType >= 0) && (convType <= 2)) // msinclairtocoherency msinclairtocovariance msinclairtocircovariance
    {
      if ((!inhv) && (!invh))
        otbAppLogFATAL(<< "Parameter 'inhv' or 'invh' not set.");
      if (!inhh)
        otbAppLogFATAL(<< "Parameter 'inhh' not set.");
      if (!invv)
        otbAppLogFATAL(<< "Parameter 'invv' not set.");
    }
368

369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384
    else if ((convType >= 3) &&
             (convType <= 6)) // mcoherencytomueller mcovariancetocoherencydegree mcovariancetocoherency mlinearcovariancetocircularcovariance
    {
      if (!inc)
        otbAppLogFATAL(<< "Parameter 'inc' not set.");
    }
    else if ((convType >= 8) && (convType <= 11)) // bsinclairtocoherency bsinclairtocovariance bsinclairtocircovariance sinclairtomueller
    {
      if ((!inhh) || (!inhv) || (!invh) || (!invv))
        otbAppLogFATAL(<< "Please, ensure that HH, HV, VH and VV complex images have been provided (parameters inhh, inhv, invh, invv).");
    }
    else if ((convType == 7) || (convType == 12)) // muellertomcovariance muellertopoldegandpower
    {
      if (!inf)
        otbAppLogFATAL(<< "Parameter 'inf' not set.");
    }
385 386


387 388
    switch (GetParameterInt("conv"))
    {
389

390 391 392
      //***************************************
      //*             MONOSTATIC              *
      //***************************************
393

394 395
    case 0: // SinclairToReciprocalCoherency
      m_RCohSRFilter = RCohSRFilterType::New();
396

397 398 399 400
      if (inhv)
        m_RCohSRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("inhv"));
      else if (invh)
        m_RCohSRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("invh"));
401

402 403
      m_RCohSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
      m_RCohSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));
404

405
      SetParameterOutputImage("outc", m_RCohSRFilter->GetOutput()); // input: 3 x 1 complex channel | output :  6 complex channels
406

407
      break;
408 409


410
    case 1: // SinclairToReciprocalCovariance
411

412
      m_RCovSRFilter = RCovSRFilterType::New();
413

414 415 416 417
      if (inhv)
        m_RCovSRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("inhv"));
      else if (invh)
        m_RCovSRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("invh"));
418

419 420
      m_RCovSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
      m_RCovSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));
421

422
      SetParameterOutputImage("outc", m_RCovSRFilter->GetOutput()); // input: 3 x 1 complex channel | output :  6 complex channels
423

424
      break;
425 426


427
    case 2: // SinclairToReciprocalCircularCovariance
428

429
      m_RCCSRFilter = RCCSRFilterType::New();
430

431 432 433 434
      if (inhv)
        m_RCCSRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("inhv"));
      else if (invh)
        m_RCCSRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("invh"));
435

436 437
      m_RCCSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
      m_RCCSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));
438

439
      SetParameterOutputImage("outc", m_RCCSRFilter->GetOutput()); // input: 3 x 1 complex channel | output :  6 complex channels
440

441
      break;
442 443


444
    case 3: // ReciprocalCoherencyToReciprocalMuellerImageFilter
445

446
      m_RCRMFilter = RCRMFilterType::New();
447
      m_RCRMFilter->SetVariadicInput<0>(GetParameterComplexDoubleVectorImage("inc"));
448

449
      SetParameterOutputImage("outf", m_RCRMFilter->GetOutput()); // input: 6 complex channels | 16 real channels
450

451
      break;
452 453


454
    case 4: // ReciprocalCovarianceToCoherencyDegreeImageFilter
455

456
      m_RCCDFilter = RCCDFilterType::New();
457
      m_RCCDFilter->SetVariadicInput<0>(GetParameterComplexDoubleVectorImage("inc"));
458

459
      SetParameterOutputImage("outc", m_RCCDFilter->GetOutput()); // input: 6 complex channels | 3 complex channels
460

461
      break;
462

463

464
    case 5: // ReciprocalCovarianceToReciprocalCoherencyImageFilter
465

466
      m_RCRCFilter = RCRCFilterType::New();
467
      m_RCRCFilter->SetVariadicInput<0>(GetParameterComplexDoubleVectorImage("inc"));
468

469
      SetParameterOutputImage("outc", m_RCRCFilter->GetOutput()); // input: 6 complex channels | 6 complex channels
470

471
      break;
472 473


474
    case 6: // ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter
475

476
      m_RLCRCCFilter = RLCRCCFilterType::New();
477
      m_RLCRCCFilter->SetVariadicInput<0>(GetParameterComplexDoubleVectorImage("inc"));
478

479
      SetParameterOutputImage("outc", m_RLCRCCFilter->GetOutput()); // input: 6 complex channels | output : 6 complex channels
480

481
      break;
482 483


484
    case 7: // MuellerToReciprocalCovarianceImageFilter
485

486
      m_MRCFilter = MRCFilterType::New();
487

488
      m_MRCFilter->SetVariadicInput<0>(GetParameterDoubleVectorImage("inf"));
489

490
      SetParameterOutputImage("outc", m_MRCFilter->GetOutput()); // input: 16 real channels | output : 6 complex channels
491

492
      break;
493 494


495 496 497
      //***************************************
      //*               BISTATIC              *
      //***************************************
498

499
    case 8: // SinclairToCoherency
500

501 502 503 504 505
      m_CohSRFilter = CohSRFilterType::New();
      m_CohSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
      m_CohSRFilter->SetVariadicNamedInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv"));
      m_CohSRFilter->SetVariadicNamedInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh"));
      m_CohSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));
506

507
      SetParameterOutputImage("outc", m_CohSRFilter->GetOutput()); // input: 4 x 1 complex channel | 10 complex channels
508

509
      break;
510 511


512
    case 9: // SinclairToCovariance
513

514 515 516 517 518
      m_CovSRFilter = CovSRFilterType::New();
      m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
      m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv"));
      m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh"));
      m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));
519

520
      SetParameterOutputImage("outc", m_CovSRFilter->GetOutput()); // input: 4 x 1 complex channel | output : 10 complex channels
521

522
      break;
523 524


525
    case 10: // SinclairToCircularCovariance
526

527 528 529 530 531
      m_CCSRFilter = CCSRFilterType::New();
      m_CCSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
      m_CCSRFilter->SetVariadicNamedInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv"));
      m_CCSRFilter->SetVariadicNamedInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh"));
      m_CCSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));
532

533
      SetParameterOutputImage("outc", m_CCSRFilter->GetOutput()); // input: 4 x 1 complex channel | output : 10 complex channels
534

535
      break;
536 537


538 539 540
      //***************************************
      //*             BOTH CASES              *
      //***************************************
541 542


543 544
    case 11: // SinclairToMueller
      m_MSRFilter = MSRFilterType::New();
545

546 547 548 549
      m_MSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
      m_MSRFilter->SetVariadicNamedInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv"));
      m_MSRFilter->SetVariadicNamedInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh"));
      m_MSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));
550

551
      SetParameterOutputImage("outf", m_MSRFilter->GetOutput()); // input: 4 x 1 complex channel | output : 16 real channels
552

553
      break;
554

555

556 557
    case 12: // MuellerToPolarisationDegreeAndPowerImageFilter
      m_MPDPFilter = MPDPFilterType::New();
558

559
      m_MPDPFilter->SetVariadicInput<0>(GetParameterDoubleVectorImage("inf"));
560

561
      SetParameterOutputImage("outf", m_MPDPFilter->GetOutput()); //  input: 16 real channels | output : 4 real channels
562 563 564

      break;
    }
565 566
  }

567
  // Monostatic
568 569 570 571 572 573 574
  RCohSRFilterType::Pointer m_RCohSRFilter;
  RCovSRFilterType::Pointer m_RCovSRFilter;
  RCCSRFilterType::Pointer  m_RCCSRFilter;
  RCRMFilterType::Pointer   m_RCRMFilter;
  RCCDFilterType::Pointer   m_RCCDFilter;
  RCRCFilterType::Pointer   m_RCRCFilter;
  RLCRCCFilterType::Pointer m_RLCRCCFilter;
575

576
  // Bistatic
577 578 579 580
  CohSRFilterType::Pointer m_CohSRFilter;
  CovSRFilterType::Pointer m_CovSRFilter;
  CCSRFilterType::Pointer  m_CCSRFilter;
  MSRFilterType::Pointer   m_MSRFilter;
581

582 583 584
  // Both cases
  MRCFilterType::Pointer  m_MRCFilter;
  MPDPFilterType::Pointer m_MPDPFilter;
585
};
586

587 588
} // end namespace Wrapper
} // end namespace otb
589

590
OTB_APPLICATION_EXPORT(otb::Wrapper::SARPolarMatrixConvert)