Skip to content

Commit

Permalink
BUG: We must also now the return type of the pixel function (for inst…
Browse files Browse the repository at this point in the history
…ance conj is CFloat64, but mod is Float64)
  • Loading branch information
jmichel-otb committed Jul 8, 2016
1 parent b0abc50 commit e1c072a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions gdal/frmts/derived/deriveddataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ GDALDataset * DerivedDataset::Open(GDALOpenInfo * poOpenInfo)
bool datasetFound = false;

unsigned int nbSupportedDerivedDS(0);
GDALDataType type = GDT_Float64;

const DerivedDatasetDescription * poDDSDesc = GDALGetDerivedDatasetDescriptions(&nbSupportedDerivedDS);

Expand All @@ -90,6 +91,7 @@ GDALDataset * DerivedDataset::Open(GDALOpenInfo * poOpenInfo)
{
datasetFound = true;
pixelFunctionName = poDDSDesc[derivedId].pszPixelFunction;
type = GDALGetDataTypeByName(poDDSDesc[derivedId].pszOutputPixelType);
}
}

Expand Down Expand Up @@ -142,8 +144,6 @@ GDALDataset * DerivedDataset::Open(GDALOpenInfo * poOpenInfo)
for(int nBand = 1; nBand <= nbBands; ++nBand)
{
VRTDerivedRasterBand * poBand;

GDALDataType type = GDT_Float64;

poBand = new VRTDerivedRasterBand(poDS,nBand,type,nCols,nRows);
poDS->SetBand(nBand,poBand);
Expand Down
14 changes: 7 additions & 7 deletions gdal/frmts/derived/derivedlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ CPL_C_START

static const DerivedDatasetDescription asDDSDesc [] =
{
{ "AMPLITUDE", "Amplitude of input bands", "mod", "complex"},
{ "PHASE", "Phase of input bands", "phase", "complex"},
{ "REAL", "Real part of input bands", "real", "complex"},
{ "IMAG", "Imaginary part of input bands", "imag", "complex"},
{ "CONJ", "Conjugate of input bands", "conj", "complex"},
{ "INTENSITY", "Intensity (squared amplitude) of input bands", "intensity", "complex"},
{ "LOGAMPLITUDE", "log10 of amplitude of input bands", "log10", "all"}
{ "AMPLITUDE", "Amplitude of input bands", "mod", "complex","Float64"},
{ "PHASE", "Phase of input bands", "phase", "complex","Float64"},
{ "REAL", "Real part of input bands", "real", "complex","Float64"},
{ "IMAG", "Imaginary part of input bands", "imag", "complex","Float64"},
{ "CONJ", "Conjugate of input bands", "conj", "complex","CFloat64"},
{ "INTENSITY", "Intensity (squared amplitude) of input bands", "intensity", "complex","Float64"},
{ "LOGAMPLITUDE", "log10 of amplitude of input bands", "log10", "all","Float64"}
};

#define NB_DERIVED_DATASETS (sizeof(asDDSDesc)/sizeof(asDDSDesc[0]))
Expand Down
3 changes: 2 additions & 1 deletion gdal/frmts/derived/derivedlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ typedef struct
const char * pszDatasetName;
const char * pszDatasetDescritpion;
const char * pszPixelFunction;
const char * pszTargetPixelType;
const char * pszInputPixelType;
const char * pszOutputPixelType;
} DerivedDatasetDescription;

const DerivedDatasetDescription* CPL_DLL CPL_STDCALL GDALGetDerivedDatasetDescriptions(unsigned int * pnDescriptionCount);
Expand Down
2 changes: 1 addition & 1 deletion gdal/gcore/gdaldataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3322,7 +3322,7 @@ char ** GDALDataset::GetMetadata(const char * pszDomain)
for(unsigned int derivedId = 0; derivedId<nbSupportedDerivedDS;++derivedId)
{

if(hasAComplexBand || CPLString(poDDSDesc[derivedId].pszTargetPixelType) != "complex")
if(hasAComplexBand || CPLString(poDDSDesc[derivedId].pszInputPixelType) != "complex")
{
oDerivedMetadataList.SetNameValue(CPLSPrintf("DERIVED_SUBDATASET_%i_NAME",derivedId),CPLSPrintf("DERIVED_SUBDATASET:%s:%s",poDDSDesc[derivedId].pszDatasetName,GetDescription()));

Expand Down

0 comments on commit e1c072a

Please sign in to comment.