[gdal-dev] NITF2.1 complex data type

Shawn Gong SGONG at mdacorporation.com
Thu Mar 26 07:38:56 PDT 2015


Hi list,



We receive SAR SLC (single look complex) images in NITF2.1. But the I and O bands are separate (HH_I, HH_Q, VV_I, VV_Q, etc)

My colleague modified the gdal NITF driver nitfdataset.cpp to rewrite them as NITFComplexRasterBand (see below)
It works with a single-pol SLC and outputs as I+jQ. However dual- and quad-pol don't work. All three RGB bands show the same HH_I + j*HH_Q

Are we doing it wrong, or NITF2.1 doesn't allow multi-pol Complex data type?

Thanks,
Shawn
GDALDataset *NITFDataset::OpenInternal( GDALOpenInfo * poOpenInfo,
                                GDALDataset *poWritableJ2KDataset,
                                int bOpenForCreate)
{
.....
.....

    GDALDataType dt = bandList[0]->GetRasterDataType();
    if (EQUAL(psImage->szICAT,"SAR")    //SAR image...
        && nUsableBands==psImage->nBands && nUsableBands%2==0     //...with 2 bands ... (modified to allow an even number - spec seems to indicate only 2 bands allowed?)
        && dt==bandList[1]->GetRasterDataType()   //...that have the same datatype...
        && !GDALDataTypeIsComplex(dt)   //...and are not complex...
        && (dt==GDT_Int16 || dt==GDT_Int32 || dt==GDT_Float32 || dt==GDT_Float64))      //..and can be mapped directly to a complex type
    {
  bool allBandsIQ = true;
  for (int i = 0; i < nUsableBands; i+=2)
  {
   NITFBandInfo *psBandInfo1 = psImage->pasBandInfo + i;
   NITFBandInfo *psBandInfo2 = psImage->pasBandInfo + i + 1;
   //check that the ISUBCAT is labelled "I" and "Q" on the 2 bands
   if (!EQUAL(psBandInfo1->szISUBCAT, "I") || !EQUAL(psBandInfo2->szISUBCAT, "Q"))
   {
    allBandsIQ = false;
    break;
   }
  }
  if (allBandsIQ)
  {
   nUsableBands /= 2;
   for (int i = 0; i < nUsableBands; i++)
   {
    //wrap the I and Q bands into a single complex band
    bandList[i] = new NITFComplexRasterBand(poDS, bandList[2 * i], bandList[2 * i + 1], i+1);
   }
  }
    }
/* -------------------------------------------------------------------- */
/*      Add bands to dataset                                            */
/* -------------------------------------------------------------------- */
    for( iBand = 0; iBand < nUsableBands; iBand++ )
      poDS->SetBand( iBand+1, bandList[iBand] );
    CPLFree(bandList);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20150326/ea70b47b/attachment-0001.html>


More information about the gdal-dev mailing list