Hello Even, To where can I submit the code?
Thanks, Shawn ________________________________________ From: Even Rouault [[email protected]] Sent: March-26-15 12:52 PM To: [email protected] Cc: Shawn Gong Subject: Re: [gdal-dev] NITF2.1 complex data type Shawn, > > > 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? If you can read all the bands with the unmodified driver, then it comes from your changes. > > 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); } -->This looks a bit suspicious as you're modifying the array you're iterating over, but I think that must be still be OK, although as you show only part of the code, it is difficult to tell for sure. Best regards, Even -- Spatialys - Geospatial professional services http://www.spatialys.com _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
