File: otbSARPolarMatrixConvert.cxx

package info (click to toggle)
otb 7.2.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,005,476 kB
  • sloc: cpp: 270,143; xml: 128,722; ansic: 4,367; sh: 1,768; python: 1,084; perl: 92; makefile: 72
file content (589 lines) | stat: -rw-r--r-- 25,559 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
/*
 * Copyright (C) 2005-2020 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.
 */

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

#include "otbSinclairToCoherencyMatrixImageFilter.h"
#include "otbSinclairToCovarianceMatrixImageFilter.h"
#include "otbSinclairToCircularCovarianceMatrixImageFilter.h"
#include "otbSinclairToMuellerMatrixImageFilter.h"

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

#include "otbMuellerToReciprocalCovarianceImageFilter.h"
#include "otbMuellerToPolarisationDegreeAndPowerImageFilter.h"

#include "otbReciprocalCoherencyToReciprocalMuellerImageFilter.h"
#include "otbReciprocalCovarianceToCoherencyDegreeImageFilter.h"
#include "otbReciprocalCovarianceToReciprocalCoherencyImageFilter.h"
#include "otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.h"

namespace otb
{
namespace Wrapper
{

class SARPolarMatrixConvert : public Application
{
public:
  /** Standard class typedefs. */
  typedef SARPolarMatrixConvert         Self;
  typedef Application                   Superclass;
  typedef itk::SmartPointer<Self>       Pointer;
  typedef itk::SmartPointer<const Self> ConstPointer;

  // Monostatic case
  using RCohSRFilterType = SinclairToReciprocalCoherencyMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
  using RCovSRFilterType = SinclairToReciprocalCovarianceMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
  using RCCSRFilterType  = SinclairToReciprocalCircularCovarianceMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;

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

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

  // Bistatic case
  using CohSRFilterType = SinclairToCoherencyMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
  using CovSRFilterType = SinclairToCovarianceMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
  using CCSRFilterType  = SinclairToCircularCovarianceMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
  using MSRFilterType   = SinclairToMuellerMatrixImageFilter<ComplexDoubleImageType, DoubleVectorImageType>;

  using MRCFilterType  = otb::MuellerToReciprocalCovarianceImageFilter<DoubleVectorImageType, ComplexDoubleVectorImageType>;
  using MPDPFilterType = otb::MuellerToPolarisationDegreeAndPowerImageFilter<DoubleVectorImageType, DoubleVectorImageType>;

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

  itkTypeMacro(SARPolarMatrixConvert, otb::Application);

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

    // Documentation
    SetDocLongDescription(

        "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)"

        );
    SetDocLimitations("None");
    SetDocAuthors("OTB-Team");
    SetDocSeeAlso("SARPolarSynth, SARDecompositions");

    AddDocTag(Tags::SAR);

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

    AddParameter(ParameterType_InputImage, "inf", "Input multi-band real image");
    SetParameterDescription("inf", "Input: multi-band real image");
    MandatoryOff("inf");


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

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

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

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

    AddParameter(ParameterType_OutputImage, "outc", "Output Complex Image");
    SetParameterDescription("outc", "Output Complex image.");
    MandatoryOff("outc");

    AddParameter(ParameterType_OutputImage, "outf", "Output Real Image");
    SetParameterDescription("outf", "Output Real image.");
    MandatoryOff("outf");


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

    // Monostatic case

    // #1
    // SinclairToReciprocalCoherency
    AddChoice("conv.msinclairtocoherency", "1 Monostatic: Sinclair matrix to coherency matrix (complex output)");
    SetParameterDescription("conv.msinclairtocoherency", "1 Monostatic: Sinclair matrix to coherency matrix (complex output)");

    // #2
    // SinclairToReciprocalCovariance
    AddChoice("conv.msinclairtocovariance", "2 Monostatic: Sinclair matrix to covariance matrix (complex output)");
    SetParameterDescription("conv.msinclairtocovariance", "2 Monostatic: Sinclair matrix to covariance matrix (complex output)");

    // #3
    // SinclairToReciprocalCircularCovariance
    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)");

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

    // #5
    // ReciprocalCovarianceToCoherencyDegreeImageFilter
    AddChoice("conv.mcovariancetocoherencydegree", "5 Monostatic: Covariance matrix to coherency degree");
    SetParameterDescription("conv.mcovariancetocoherencydegree", "5 Monostatic: Covariance matrix to coherency degree ");

    // #6
    // ReciprocalCovarianceToReciprocalCoherencyImageFilter
    AddChoice("conv.mcovariancetocoherency", "6 Monostatic: Covariance matrix to coherency matrix (complex output)");
    SetParameterDescription("conv.mcovariancetocoherency", "6 Monostatic: Covariance matrix to coherency matrix (complex output)");

    // #7
    // ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter
    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)");

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

    // Bistatic case

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

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

    // #11
    // SinclairToCircularCovariance
    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)");

    // Both case

    // #12
    // SinclairToMueller
    AddChoice("conv.sinclairtomueller", "12 Bi/mono: Sinclair matrix to Mueller matrix");
    SetParameterDescription("conv.sinclairtomueller", "12 Bi/mono: Sinclair matrix to Mueller matrix");


    // #13
    // MuellerToPolarisationDegreeAndPowerImageFilter
    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");

    AddRAMParameter();

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

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

    SetOfficialDocLink();
  }

  void DoUpdateParameters() override
  {

    int convType = GetParameterInt("conv");

    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);
    }
  }

  void DoExecute() override
  {

    //****************************************
    //* Check inputs and outputs consistency *
    //****************************************

    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");

    int convType = GetParameterInt("conv");


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


    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.");
    }

    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.");
    }


    switch (GetParameterInt("conv"))
    {

    //***************************************
    //*             MONOSTATIC              *
    //***************************************

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

      if (inhv)
        m_RCohSRFilter->SetInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("inhv"));
      else if (invh)
        m_RCohSRFilter->SetInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("invh"));

      m_RCohSRFilter->SetInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
      m_RCohSRFilter->SetInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));

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

      break;


    case 1: // SinclairToReciprocalCovariance

      m_RCovSRFilter = RCovSRFilterType::New();

      if (inhv)
        m_RCovSRFilter->SetInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("inhv"));
      else if (invh)
        m_RCovSRFilter->SetInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("invh"));

      m_RCovSRFilter->SetInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
      m_RCovSRFilter->SetInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));

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

      break;


    case 2: // SinclairToReciprocalCircularCovariance

      m_RCCSRFilter = RCCSRFilterType::New();

      if (inhv)
        m_RCCSRFilter->SetInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("inhv"));
      else if (invh)
        m_RCCSRFilter->SetInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("invh"));

      m_RCCSRFilter->SetInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
      m_RCCSRFilter->SetInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));

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

      break;


    case 3: // ReciprocalCoherencyToReciprocalMuellerImageFilter

      m_RCRMFilter = RCRMFilterType::New();
      m_RCRMFilter->SetInput<0>(GetParameterComplexDoubleVectorImage("inc"));

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

      break;


    case 4: // ReciprocalCovarianceToCoherencyDegreeImageFilter

      m_RCCDFilter = RCCDFilterType::New();
      m_RCCDFilter->SetInput<0>(GetParameterComplexDoubleVectorImage("inc"));

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

      break;


    case 5: // ReciprocalCovarianceToReciprocalCoherencyImageFilter

      m_RCRCFilter = RCRCFilterType::New();
      m_RCRCFilter->SetInput<0>(GetParameterComplexDoubleVectorImage("inc"));

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

      break;


    case 6: // ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter

      m_RLCRCCFilter = RLCRCCFilterType::New();
      m_RLCRCCFilter->SetInput<0>(GetParameterComplexDoubleVectorImage("inc"));

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

      break;


    case 7: // MuellerToReciprocalCovarianceImageFilter

      m_MRCFilter = MRCFilterType::New();

      m_MRCFilter->SetInput<0>(GetParameterDoubleVectorImage("inf"));

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

      break;


    //***************************************
    //*               BISTATIC              *
    //***************************************

    case 8: // SinclairToCoherency

      m_CohSRFilter = CohSRFilterType::New();
      m_CohSRFilter->SetInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
      m_CohSRFilter->SetInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv"));
      m_CohSRFilter->SetInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh"));
      m_CohSRFilter->SetInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));

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

      break;


    case 9: // SinclairToCovariance

      m_CovSRFilter = CovSRFilterType::New();
      m_CovSRFilter->SetInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
      m_CovSRFilter->SetInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv"));
      m_CovSRFilter->SetInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh"));
      m_CovSRFilter->SetInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));

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

      break;


    case 10: // SinclairToCircularCovariance

      m_CCSRFilter = CCSRFilterType::New();
      m_CCSRFilter->SetInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
      m_CCSRFilter->SetInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv"));
      m_CCSRFilter->SetInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh"));
      m_CCSRFilter->SetInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));

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

      break;


    //***************************************
    //*             BOTH CASES              *
    //***************************************


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

      m_MSRFilter->SetInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
      m_MSRFilter->SetInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv"));
      m_MSRFilter->SetInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh"));
      m_MSRFilter->SetInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));

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

      break;


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

      m_MPDPFilter->SetInput<0>(GetParameterDoubleVectorImage("inf"));

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

      break;
    }
  }

  // Monostatic
  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;

  // Bistatic
  CohSRFilterType::Pointer m_CohSRFilter;
  CovSRFilterType::Pointer m_CovSRFilter;
  CCSRFilterType::Pointer  m_CCSRFilter;
  MSRFilterType::Pointer   m_MSRFilter;

  // Both cases
  MRCFilterType::Pointer  m_MRCFilter;
  MPDPFilterType::Pointer m_MPDPFilter;
};

} // end namespace Wrapper
} // end namespace otb

OTB_APPLICATION_EXPORT(otb::Wrapper::SARPolarMatrixConvert)