本文整理汇总了C++中DataAccessor::getColumn方法的典型用法代码示例。如果您正苦于以下问题:C++ DataAccessor::getColumn方法的具体用法?C++ DataAccessor::getColumn怎么用?C++ DataAccessor::getColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataAccessor
的用法示例。
在下文中一共展示了DataAccessor::getColumn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copyImage
bool bilinear_bayer::copyImage(RasterElement * pRaster,
RasterElement * dRaster, int i,
Progress * pProgress)
{
VERIFY(pRaster != NULL);
RasterDataDescriptor *pDesc =
dynamic_cast < RasterDataDescriptor * >(pRaster->getDataDescriptor());
VERIFY(dRaster != NULL);
RasterDataDescriptor *rDesc =
dynamic_cast < RasterDataDescriptor * >(dRaster->getDataDescriptor());
DimensionDescriptor thirdBand = pDesc->getActiveBand(i); // get active
// band
// source
FactoryResource < DataRequest > pRequest;
pRequest->setInterleaveFormat(BSQ);
pRequest->setBands(thirdBand, thirdBand);
DataAccessor thirdBandDa = pRaster->getDataAccessor(pRequest.release());
thirdBand = rDesc->getActiveBand(i);
// destination
FactoryResource < DataRequest > pResultRequest;
pResultRequest->setWritable(true);
pRequest->setInterleaveFormat(BSQ);
pResultRequest->setBands(thirdBand, thirdBand);
DataAccessor pDestAcc = dRaster->getDataAccessor(pResultRequest.release());
VERIFY(thirdBandDa.isValid());
VERIFY(pDestAcc.isValid());
for (unsigned int curRow = 0; curRow < pDesc->getRowCount(); ++curRow)
{
for (unsigned int curCol = 0; curCol < pDesc->getColumnCount();
++curCol)
{
switchOnEncoding(pDesc->getDataType(), bilinear,
pDestAcc->getColumn(), thirdBandDa, curRow,
curCol, pDesc->getRowCount(),
pDesc->getColumnCount(), i, pRaster);
pDestAcc->nextColumn();
}
pDestAcc->nextRow();
}
return true;
}
示例2: getResampledSignatureValues
bool SpectralLibraryManager::getResampledSignatureValues(const RasterElement* pRaster, const Signature* pSignature,
std::vector<double>& values)
{
values.clear();
if (pRaster == NULL || pSignature == NULL)
{
return false;
}
const RasterElement* pLibData = getResampledLibraryData(pRaster);
if (pLibData == NULL)
{
return false;
}
int index = getSignatureIndex(pSignature);
if (index < 0)
{
return false;
}
const RasterDataDescriptor* pLibDesc = dynamic_cast<const RasterDataDescriptor*>(pLibData->getDataDescriptor());
VERIFY(pLibDesc != NULL);
unsigned int numBands = pLibDesc->getBandCount();
values.reserve(numBands);
FactoryResource<DataRequest> pRqt;
unsigned int row = static_cast<unsigned int>(index);
pRqt->setInterleaveFormat(BIP);
pRqt->setRows(pLibDesc->getActiveRow(row), pLibDesc->getActiveRow(row), 1);
DataAccessor acc = pLibData->getDataAccessor(pRqt.release());
VERIFY(acc.isValid());
double* pDbl = reinterpret_cast<double*>(acc->getColumn());
for (unsigned int band = 0; band < numBands; ++band)
{
values.push_back(*pDbl);
++pDbl;
}
return true;
}
示例3: execute
bool EdgeDetector::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
StepResource pStep("Edge Detector", "app", "37C57772-DD49-4532-8BC6-9CFB8587D0C9");
if (pInArgList == NULL || pOutArgList == NULL)
{
return false;
}
Progress* pProgress = pInArgList->getPlugInArgValue<Progress>(Executable::ProgressArg());
RasterElement* pCube = pInArgList->getPlugInArgValue<RasterElement>(Executable::DataElementArg());
if (pCube == NULL)
{
std::string msg = "A raster cube must be specified.";
pStep->finalize(Message::Failure, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ERRORS);
}
return false;
}
RasterDataDescriptor* pDesc = static_cast<RasterDataDescriptor*>(pCube->getDataDescriptor());
VERIFY(pDesc != NULL);
EncodingType ResultType = INT1UBYTE;
FactoryResource<DataRequest> pRequest;
pRequest->setInterleaveFormat(BSQ);
DataAccessor pSrcAcc = pCube->getDataAccessor(pRequest.release());
ModelResource<RasterElement> pResultCube(RasterUtilities::createRasterElement(pCube->getName() +
"_Edge_Detect_Result", pDesc->getRowCount(), pDesc->getColumnCount(), ResultType));
if (pResultCube.get() == NULL)
{
std::string msg = "A raster cube could not be created.";
pStep->finalize(Message::Failure, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ERRORS);
}
return false;
}
FactoryResource<DataRequest> pResultRequest;
pResultRequest->setWritable(true);
DataAccessor pDestAcc = pResultCube->getDataAccessor(pResultRequest.release());
Service<DesktopServices> pDesktop;
EdgeRatioThresholdDlg dlg(pDesktop->getMainWidget(), SMALL_WINDOW_THRESHOLD, MEDIAN_WINDOW_THRESHOLD, LARGE_WINDOW_THRESHOLD);
int stat = dlg.exec();
if (stat == QDialog::Accepted)
{
for (unsigned int row = 0; row < pDesc->getRowCount(); ++row)
{
if (pProgress != NULL)
{
pProgress->updateProgress("Edge detect ", row * 100 / pDesc->getRowCount(), NORMAL);
}
if (isAborted())
{
std::string msg = getName() + " has been aborted.";
pStep->finalize(Message::Abort, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ABORT);
}
return false;
}
if (!pDestAcc.isValid())
{
std::string msg = "Unable to access the cube data.";
pStep->finalize(Message::Failure, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ERRORS);
}
return false;
}
for (unsigned int col = 0; col < pDesc->getColumnCount(); ++col)
{
switchOnEncoding(ResultType, EdgeDetectSAR, pDestAcc->getColumn(), pSrcAcc, row, col,
pDesc->getRowCount(), pDesc->getColumnCount(), pDesc->getDataType(),
dlg.getSmallThreshold(), dlg.getMedianThreshold(), dlg.getLargeThreshold());
pDestAcc->nextColumn();
}
pDestAcc->nextRow();
}
if (!isBatch())
{
//Service<DesktopServices> pDesktop;
SpatialDataWindow* pWindow = static_cast<SpatialDataWindow*>(pDesktop->createWindow(pResultCube->getName(),
SPATIAL_DATA_WINDOW));
SpatialDataView* pView = (pWindow == NULL) ? NULL : pWindow->getSpatialDataView();
if (pView == NULL)
{
std::string msg = "Unable to create view.";
pStep->finalize(Message::Failure, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ERRORS);
//.........这里部分代码省略.........
示例4: getPixel
T getPixel(int x, int y) {
toPixel(x, y);
return *((T*) dataAccessor->getColumn());
}
示例5: getReporter
void ConvolutionFilterShell::ConvolutionFilterThread::convolve(const T*)
{
int numResultsCols = mInput.mpIterCheck->getNumSelectedColumns();
if (mInput.mpResult == NULL)
{
return;
}
const RasterDataDescriptor* pResultDescriptor = static_cast<const RasterDataDescriptor*>(
mInput.mpResult->getDataDescriptor());
// account for AOIs which extend outside the dataset
int maxRowNum = static_cast<int>(mInput.mpDescriptor->getRowCount()) - 1;
mRowRange.mFirst = std::max(0, mRowRange.mFirst);
mRowRange.mLast = std::min(mRowRange.mLast, maxRowNum);
unsigned int bandCount = mInput.mBands.size();
for (unsigned int bandNum = 0; bandNum < bandCount; ++bandNum)
{
FactoryResource<DataRequest> pResultRequest;
pResultRequest->setRows(pResultDescriptor->getActiveRow(mRowRange.mFirst),
pResultDescriptor->getActiveRow(mRowRange.mLast));
pResultRequest->setColumns(pResultDescriptor->getActiveColumn(0),
pResultDescriptor->getActiveColumn(numResultsCols - 1));
pResultRequest->setBands(pResultDescriptor->getActiveBand(bandNum),
pResultDescriptor->getActiveBand(bandNum));
pResultRequest->setWritable(true);
DataAccessor resultAccessor = mInput.mpResult->getDataAccessor(pResultRequest.release());
if (!resultAccessor.isValid())
{
return;
}
int oldPercentDone = -1;
int rowOffset = static_cast<int>(mInput.mpIterCheck->getOffset().mY);
int startRow = mRowRange.mFirst + rowOffset;
int stopRow = mRowRange.mLast + rowOffset;
int columnOffset = static_cast<int>(mInput.mpIterCheck->getOffset().mX);
int startColumn = columnOffset;
int stopColumn = numResultsCols + columnOffset - 1;
int yshift = (mInput.mKernel.Nrows() - 1) / 2;
int xshift = (mInput.mKernel.Ncols() - 1) / 2;
FactoryResource<DataRequest> pRequest;
pRequest->setRows(mInput.mpDescriptor->getActiveRow(std::max(0, startRow - yshift)),
mInput.mpDescriptor->getActiveRow(std::min(maxRowNum, stopRow + mInput.mKernel.Nrows() - yshift)));
pRequest->setColumns(mInput.mpDescriptor->getActiveColumn(startColumn),
mInput.mpDescriptor->getActiveColumn(stopColumn));
pRequest->setBands(mInput.mpDescriptor->getActiveBand(mInput.mBands[bandNum]),
mInput.mpDescriptor->getActiveBand(mInput.mBands[bandNum]));
DataAccessor accessor = mInput.mpRaster->getDataAccessor(pRequest.release());
if (!accessor.isValid())
{
return;
}
Service<ModelServices> model;
ModelServices* pModel = model.get();
int numRows = stopRow - startRow + 1;
for (int row_index = startRow; row_index <= stopRow; ++row_index)
{
int percentDone = 100 * ((bandNum * numRows) + (row_index - startRow)) / (numRows * bandCount);
if (percentDone > oldPercentDone)
{
oldPercentDone = percentDone;
getReporter().reportProgress(getThreadIndex(), percentDone);
}
if (mInput.mpAbortFlag != NULL && *mInput.mpAbortFlag)
{
break;
}
for (int col_index = startColumn; col_index <= stopColumn; ++col_index)
{
double accum = 0.0;
if (mInput.mpIterCheck->getPixel(col_index, row_index))
{
for (int kernelrow = 0; kernelrow < mInput.mKernel.Nrows(); kernelrow++)
{
int neighbor_row = row_index - yshift + kernelrow;
int real_row = std::min(std::max(0, neighbor_row),
static_cast<int>(mInput.mpDescriptor->getRowCount()) - 1);
for (int kernelcol = 0; kernelcol < mInput.mKernel.Ncols(); kernelcol++)
{
int neighbor_col = col_index - xshift + kernelcol;
int real_col = std::min(std::max(0, neighbor_col),
static_cast<int>(mInput.mpDescriptor->getColumnCount()) - 1);
accessor->toPixel(real_row, real_col);
if (accessor.isValid() == false)
{
return;
}
double val = 0.0;
pModel->getDataValue<T>(reinterpret_cast<T*>(accessor->getColumn()), COMPLEX_MAGNITUDE, 0, val);
accum += mInput.mKernel(kernelrow+1, kernelcol+1) * val / mInput.mKernel.Storage();
}
}
//.........这里部分代码省略.........
示例6: execute
bool HIGHPASS::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
StepResource pStep("Tutorial 5", "app", "219F1882-A59F-4835-BE2A-E83C0C8111EB");
if (pInArgList == NULL || pOutArgList == NULL)
{
return false;
}
Progress* pProgress = pInArgList->getPlugInArgValue<Progress>(Executable::ProgressArg());
RasterElement* pCube = pInArgList->getPlugInArgValue<RasterElement>(Executable::DataElementArg());
if (pCube == NULL)
{
std::string msg = "A raster cube must be specified.";
pStep->finalize(Message::Failure, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ERRORS);
}
return false;
}
RasterDataDescriptor* pDesc = static_cast<RasterDataDescriptor*>(pCube->getDataDescriptor());
VERIFY(pDesc != NULL);
FactoryResource<DataRequest> pRequest;
pRequest->setInterleaveFormat(BSQ);
DataAccessor pSrcAcc = pCube->getDataAccessor(pRequest.release());
ModelResource<RasterElement> pResultCube(RasterUtilities::createRasterElement(pCube->getName() +
"DResult", pDesc->getRowCount(), pDesc->getColumnCount(), pDesc->getDataType()));
if (pResultCube.get() == NULL)
{
std::string msg = "A raster cube could not be created.";
pStep->finalize(Message::Failure, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ERRORS);
}
return false;
}
FactoryResource<DataRequest> pResultRequest;
pResultRequest->setWritable(true);
DataAccessor pDestAcc = pResultCube->getDataAccessor(pResultRequest.release());
int rowSize= pDesc->getRowCount();
int colSize = pDesc->getColumnCount();
int zero=0;
int prevCol = 0;
int prevRow = 0;
int nextCol = 0;
int nextRow = 0;
int prevCol1 = 0;
int prevRow1= 0;
int nextCol1= 0;
int nextRow1= 0;
for (unsigned int row = 0; row < pDesc->getRowCount(); ++row)
{
if (pProgress != NULL)
{
pProgress->updateProgress("Calculating result", row * 100 / pDesc->getRowCount(), NORMAL);
}
if (isAborted())
{
std::string msg = getName() + " has been aborted.";
pStep->finalize(Message::Abort, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ABORT);
}
return false;
}
if (!pDestAcc.isValid())
{
std::string msg = "Unable to access the cube data.";
pStep->finalize(Message::Failure, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ERRORS);
}
return false;
}
for (unsigned int col = 0; col < pDesc->getColumnCount(); ++col)
{
double value=edgeDetection7(pSrcAcc, row, col, pDesc->getRowCount(), pDesc->getColumnCount());
switchOnEncoding(pDesc->getDataType(), conversion, pDestAcc->getColumn(), value);
pDestAcc->nextColumn();
}
pDestAcc->nextRow();
}
if (!isBatch())
{
Service<DesktopServices> pDesktop;
SpatialDataWindow* pWindow = static_cast<SpatialDataWindow*>(pDesktop->createWindow(pResultCube->getName(),
SPATIAL_DATA_WINDOW));
//.........这里部分代码省略.........
示例7: execute
bool ThresholdData::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
VERIFY(pInArgList != NULL);
StepResource pStep("Execute Wizard Item", "app", "{2501975d-7cd5-49b0-a3e7-49f7106793c0}");
pStep->addProperty("Item", getName());
mpStep = pStep.get();
if (!extractInputArgs(pInArgList))
{
return false;
}
const RasterDataDescriptor* pDesc = static_cast<const RasterDataDescriptor*>(mpInputElement->getDataDescriptor());
VERIFY(pDesc);
DimensionDescriptor band;
if (mDisplayBandNumber > 0)
{
band = pDesc->getOriginalBand(mDisplayBandNumber - 1);
if (band.isValid() == false)
{
reportError("The specified band is invalid.", "{a529538b-5b82-425d-af10-385a2581beec}");
return false;
}
}
else
{
band = pDesc->getActiveBand(mDisplayBandNumber);
}
FactoryResource<DataRequest> pReq;
pReq->setInterleaveFormat(BSQ);
pReq->setBands(band, band, 1);
DataAccessor acc = mpInputElement->getDataAccessor(pReq.release());
if (!acc.isValid())
{
reportError("Unable to access data element.", "{b5f1b7dd-7cf7-4cd5-b5bc-7b747d3561b9}");
return false;
}
// If necessary, convert region units
if (mRegionUnits != RAW_VALUE)
{
Statistics* pStatistics = mpInputElement->getStatistics(band);
if (pStatistics == NULL)
{
reportError("Unable to calculate data statistics.", "{61a44ced-a4aa-4423-b379-5783137eb980}");
return false;
}
mFirstThreshold = convertToRawUnits(pStatistics, mRegionUnits, mFirstThreshold);
mSecondThreshold = convertToRawUnits(pStatistics, mRegionUnits, mSecondThreshold);
}
FactoryResource<BitMask> pBitmask;
for (unsigned int row = 0; row < pDesc->getRowCount(); ++row)
{
reportProgress("Thresholding data", 100 * row / pDesc->getRowCount(),
"{2fc3dbea-1307-471c-bba2-bf86032be518}");
for (unsigned int col = 0; col < pDesc->getColumnCount(); ++col)
{
VERIFY(acc.isValid());
double val = ModelServices::getDataValue(pDesc->getDataType(), acc->getColumn(), 0);
switch (mPassArea)
{
case UPPER:
if (val >= mFirstThreshold)
{
pBitmask->setPixel(col, row, true);
}
break;
case LOWER:
if (val <= mFirstThreshold)
{
pBitmask->setPixel(col, row, true);
}
break;
case MIDDLE:
if (val >= mFirstThreshold && val <= mSecondThreshold)
{
pBitmask->setPixel(col, row, true);
}
break;
case OUTSIDE:
if (val <= mFirstThreshold || val >= mSecondThreshold)
{
pBitmask->setPixel(col, row, true);
}
break;
default:
reportError("Unknown or invalid pass area.", "{19c92b3b-52e9-442b-a01f-b545f819f200}");
return false;
}
acc->nextColumn();
}
acc->nextRow();
}
std::string aoiName = pDesc->getName() + "_aoi";
ModelResource<AoiElement> pAoi(aoiName, mpInputElement);
if (pAoi.get() == NULL)
{
reportWarning("Overwriting existing AOI.", "{d953a030-dd63-43a1-98db-b0f491dee123}");
Service<ModelServices>()->destroyElement(
Service<ModelServices>()->getElement(aoiName, TypeConverter::toString<AoiElement>(), mpInputElement));
//.........这里部分代码省略.........
示例8: ComputeSam
void SamThread::ComputeSam(const T* pDummyData)
{
int reSamBan_index = 0, row_index = 0, col_index = 0;
float* pResultsData = NULL;
int oldPercentDone = -1;
double spectrumMag = 0.0;
const T* pData=NULL;
const RasterDataDescriptor* pDescriptor = static_cast<const RasterDataDescriptor*>(
mInput.mpCube->getDataDescriptor());
unsigned int numCols = pDescriptor->getColumnCount();
unsigned int numBands = pDescriptor->getBandCount();
unsigned int numRows = (mRowRange.mLast - mRowRange.mFirst + 1);
int numResultsCols = 0;
//Sets area to apply the SAM algortihm to. Either
//the entire cube, or a selected ROI.
if (mInput.mIterCheck.useAllPixels())
{
//Total number of Columns in cube.
numResultsCols = numCols;
}
else
{
numResultsCols = mInput.mIterCheck.getNumSelectedColumns();
}
if (mInput.mpResultsMatrix == NULL)
{
return;
}
const RasterDataDescriptor* pResultDescriptor = static_cast<const RasterDataDescriptor*>(
mInput.mpResultsMatrix->getDataDescriptor());
// Gets results matrix that was initialized in ProcessAll()
mRowRange.mFirst = std::max(0, mRowRange.mFirst);
mRowRange.mLast = std::min(mRowRange.mLast, static_cast<int>(pDescriptor->getRowCount()) - 1);
FactoryResource<DataRequest> pResultRequest;
pResultRequest->setRows(pResultDescriptor->getActiveRow(mRowRange.mFirst),
pResultDescriptor->getActiveRow(mRowRange.mLast));
pResultRequest->setColumns(pResultDescriptor->getActiveColumn(0),
pResultDescriptor->getActiveColumn(numResultsCols - 1));
pResultRequest->setWritable(true);
DataAccessor resultAccessor = mInput.mpResultsMatrix->getDataAccessor(pResultRequest.release());
if (!resultAccessor.isValid())
{
return;
}
// Resamples and sets search signature
for (reSamBan_index = 0; reSamBan_index < (int) mInput.mResampledBands.size(); ++reSamBan_index)
{
spectrumMag += mInput.mSpectrum[reSamBan_index] * mInput.mSpectrum[reSamBan_index];
}
spectrumMag = sqrt(spectrumMag);
int rowOffset = mInput.mIterCheck.getOffset().mY;
int startRow = (mRowRange.mFirst + rowOffset);
int stopRow = (mRowRange.mLast + rowOffset);
int columnOffset = mInput.mIterCheck.getOffset().mX;
int startColumn = columnOffset;
int stopColumn = (numResultsCols + columnOffset - 1);
FactoryResource<DataRequest> pRequest;
pRequest->setInterleaveFormat(BIP);
pRequest->setRows(pDescriptor->getActiveRow(startRow), pDescriptor->getActiveRow(stopRow));
pRequest->setColumns(pDescriptor->getActiveColumn(startColumn), pDescriptor->getActiveColumn(stopColumn));
DataAccessor accessor = mInput.mpCube->getDataAccessor(pRequest.release());
if (!accessor.isValid())
{
return;
}
for (row_index = startRow; row_index <= stopRow; ++row_index)
{
int percentDone = mRowRange.computePercent(row_index-rowOffset);
if (percentDone > oldPercentDone)
{
oldPercentDone = percentDone;
getReporter().reportProgress(getThreadIndex(), percentDone);
}
if (mInput.mpAbortFlag != NULL && *mInput.mpAbortFlag)
{
break;
}
for (col_index = startColumn; col_index <= stopColumn; ++col_index)
{
VERIFYNRV(resultAccessor.isValid());
VERIFYNRV(accessor.isValid());
// Pointer to results data
pResultsData = reinterpret_cast<float*>(resultAccessor->getColumn());
if (pResultsData == NULL)
{
return;
}
if (mInput.mIterCheck.getPixel(col_index, row_index))
{
//Pointer to cube/sensor data
pData = reinterpret_cast<T*>(accessor->getColumn());
//.........这里部分代码省略.........
示例9: processAll
bool SamAlgorithm::processAll()
{
auto_ptr<Wavelengths> pWavelengths;
ProgressTracker progress(getProgress(), "Starting SAM", "spectral", "C4320027-6359-4F5B-8820-8BC72BF1B8F0");
progress.getCurrentStep()->addProperty("Interactive", isInteractive());
RasterElement* pElement = getRasterElement();
if (pElement == NULL)
{
progress.report(SAMERR012, 0, ERRORS, true);
return false;
}
progress.getCurrentStep()->addProperty("Cube", pElement->getName());
const RasterDataDescriptor* pDescriptor = static_cast<RasterDataDescriptor*>(pElement->getDataDescriptor());
VERIFY(pDescriptor != NULL);
BitMaskIterator iter(getPixelsToProcess(), pElement);
unsigned int numRows = iter.getNumSelectedRows();
unsigned int numColumns = iter.getNumSelectedColumns();
unsigned int numBands = pDescriptor->getBandCount();
Opticks::PixelOffset layerOffset(iter.getColumnOffset(), iter.getRowOffset());
// get cube wavelengths
DynamicObject* pMetadata = pElement->getMetadata();
if (pMetadata != NULL)
{
pWavelengths.reset(new Wavelengths(pMetadata));
if (!pWavelengths->isEmpty() && (!pWavelengths->hasEndValues() || !pWavelengths->hasStartValues()))
{
pWavelengths->calculateFwhm();
}
}
VERIFY(pWavelengths.get() != NULL);
int sig_index = 0;
bool bSuccess = true;
if (mInputs.mSignatures.empty())
{
progress.report(SAMERR005, 0, ERRORS, true);
return false;
}
int iSignatureCount = mInputs.mSignatures.size();
// Get colors for all the signatures
vector<ColorType> layerColors, excludeColors;
excludeColors.push_back(ColorType(0, 0, 0));
excludeColors.push_back(ColorType(255, 255, 255));
ColorType::getUniqueColors(iSignatureCount, layerColors, excludeColors);
// Create a vector for the signature names
vector<string> sigNames;
// Create a pseudocolor results matrix if necessary
RasterElement* pPseudocolorMatrix = NULL;
RasterElement* pLowestSAMValueMatrix = NULL;
// Check for multiple Signatures and if the user has selected
// to combined multiple results in one pseudocolor output layer
if (iSignatureCount > 1 && mInputs.mbCreatePseudocolor)
{
pPseudocolorMatrix = createResults(numRows, numColumns, mInputs.mResultsName);
pLowestSAMValueMatrix = createResults(numRows, numColumns, "LowestSAMValue");
if (pPseudocolorMatrix == NULL || pLowestSAMValueMatrix == NULL )
{
progress.report(SAMERR007, 0, ERRORS, true);
return false;
}
FactoryResource<DataRequest> pseudoRequest;
pseudoRequest->setWritable(true);
string failedDataRequestErrorMessage =
SpectralUtilities::getFailedDataRequestErrorMessage(pseudoRequest.get(), pPseudocolorMatrix);
DataAccessor pseudoAccessor = pPseudocolorMatrix->getDataAccessor(pseudoRequest.release());
if (!pseudoAccessor.isValid())
{
string msg = "Unable to access results.";
if (!failedDataRequestErrorMessage.empty())
{
msg += "\n" + failedDataRequestErrorMessage;
}
progress.report(msg, 0, ERRORS, true);
return false;
}
FactoryResource<DataRequest> lsvRequest;
lsvRequest->setWritable(true);
failedDataRequestErrorMessage =
SpectralUtilities::getFailedDataRequestErrorMessage(lsvRequest.get(), pLowestSAMValueMatrix);
DataAccessor lowestSamValueAccessor = pLowestSAMValueMatrix->getDataAccessor(lsvRequest.release());
if (!lowestSamValueAccessor.isValid())
{
string msg = "Unable to access results.";
if (!failedDataRequestErrorMessage.empty())
{
msg += "\n" + failedDataRequestErrorMessage;
}
//.........这里部分代码省略.........
示例10: execute
bool conservative_filter::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
StepResource pStep("Conservative", "Filter", "5EA0CC75-9E0B-4c3d-BA23-6DB7157BBD55"); //what is this?
if (pInArgList == NULL || pOutArgList == NULL)
{
return false;
}
Service <DesktopServices> pDesktop;
conservative_filter_ui dialog(pDesktop->getMainWidget());
int status = dialog.exec();
if (status == QDialog::Accepted)
{
int radius = dialog.getRadiusValue();
Progress* pProgress = pInArgList->getPlugInArgValue<Progress>(Executable::ProgressArg());
RasterElement* pCube = pInArgList->getPlugInArgValue<RasterElement>(Executable::DataElementArg());
if (pCube == NULL)
{
std::string msg = "A raster cube must be specified.";
pStep->finalize(Message::Failure, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ERRORS);
}
return false;
}
RasterDataDescriptor* pDesc = static_cast<RasterDataDescriptor*>(pCube->getDataDescriptor());
VERIFY(pDesc != NULL);
if (pDesc->getDataType() == INT4SCOMPLEX || pDesc->getDataType() == FLT8COMPLEX)
{
std::string msg = "Conservative Filter cannot be performed on complex types.";
pStep->finalize(Message::Failure, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ERRORS);
}
return false;
}
FactoryResource<DataRequest> pRequest;
pRequest->setInterleaveFormat(BSQ);
DataAccessor pSrcAcc = pCube->getDataAccessor(pRequest.release());
ModelResource<RasterElement> pResultCube(RasterUtilities::createRasterElement(pCube->getName() + "_Conservative_Filter_Result", pDesc->getRowCount(), pDesc->getColumnCount(), pDesc->getDataType()));
if (pResultCube.get() == NULL)
{
std::string msg = "A raster cube could not be created.";
pStep->finalize(Message::Failure, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ERRORS);
}
return false;
}
FactoryResource<DataRequest> pResultRequest;
pResultRequest->setWritable(true);
DataAccessor pDestAcc = pResultCube->getDataAccessor(pResultRequest.release());
for (unsigned int row = 0; row < pDesc->getRowCount(); ++row)
{
if (pProgress != NULL)
{
pProgress->updateProgress("Applying Conservative Filter", row * 100 / pDesc->getRowCount(), NORMAL);
}
if (isAborted())
{
std::string msg = getName() + " has been aborted.";
pStep->finalize(Message::Abort, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ABORT);
}
return false;
}
if (!pDestAcc.isValid())
{
std::string msg = "Unable to access the cube data.";
pStep->finalize(Message::Failure, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ERRORS);
}
return false;
}
for (unsigned int col = 0; col < pDesc->getColumnCount(); ++col)
{
switchOnEncoding(pDesc->getDataType(), verifyRange, pDestAcc->getColumn(), pSrcAcc, row, col, pDesc->getRowCount(), pDesc->getColumnCount(), radius);
pDestAcc->nextColumn();
}
pDestAcc->nextRow();
}
if (!isBatch())
{
Service<DesktopServices> pDesktop;
SpatialDataWindow* pWindow = static_cast<SpatialDataWindow*>(pDesktop->createWindow(pResultCube->getName(),
//.........这里部分代码省略.........
示例11: getPage
RasterPage* ConvertToBsqPager::getPage(DataRequest* pOriginalRequest, DimensionDescriptor startRow,
DimensionDescriptor startColumn, DimensionDescriptor startBand)
{
VERIFYRV(pOriginalRequest != NULL, NULL);
if (pOriginalRequest->getWritable())
{
return NULL;
}
InterleaveFormatType requestedType = pOriginalRequest->getInterleaveFormat();
DimensionDescriptor stopRow = pOriginalRequest->getStopRow();
DimensionDescriptor stopColumn = pOriginalRequest->getStopColumn();
DimensionDescriptor stopBand = pOriginalRequest->getStopBand();
unsigned int concurrentRows = std::min(pOriginalRequest->getConcurrentRows(),
stopRow.getActiveNumber() - startRow.getActiveNumber() + 1);
unsigned int concurrentBands = pOriginalRequest->getConcurrentBands();
VERIFY(requestedType == BSQ);
VERIFY(startBand == stopBand && concurrentBands == 1);
VERIFY(mpRaster != NULL);
const RasterDataDescriptor* pDd = dynamic_cast<const RasterDataDescriptor*>(mpRaster->getDataDescriptor());
VERIFY(pDd != NULL);
InterleaveFormatType interleave = pDd->getInterleaveFormat();
VERIFY(interleave == BIL || interleave == BIP);
unsigned int numRows = pDd->getRowCount();
unsigned int numCols = pDd->getColumnCount();
unsigned int numBands = pDd->getBandCount();
if (startRow.getActiveNumber() >= numRows || stopRow.getActiveNumber() >= numRows ||
startColumn.getActiveNumber() >= numCols || stopColumn.getActiveNumber() >= numCols ||
startBand.getActiveNumber() >= numBands || stopBand.getActiveNumber() >= numBands)
{
return NULL;
}
unsigned int cols = stopColumn.getActiveNumber() - startColumn.getActiveNumber() + 1;
std::auto_ptr<ConvertToBsqPage> pPage(new ConvertToBsqPage(concurrentRows, cols, mBytesPerElement));
unsigned char* pDst = reinterpret_cast<unsigned char*>(pPage->getRawData());
if (pDst == NULL)
{
return NULL;
}
FactoryResource<DataRequest> pRequest;
pRequest->setRows(startRow, stopRow);
pRequest->setColumns(startColumn, stopColumn, cols);
pRequest->setBands(startBand, startBand, 1);
DataAccessor da = mpRaster->getDataAccessor(pRequest.release());
if (interleave == BIP)
{
for (unsigned int row = 0; row < concurrentRows; ++row)
{
for (unsigned int col = 0; col < cols; ++col)
{
if (da.isValid() == false)
{
return NULL;
}
memcpy(pDst, da->getColumn(), mBytesPerElement);
pDst += mBytesPerElement;
da->nextColumn();
}
da->nextRow();
}
}
else if (interleave == BIL)
{
for (unsigned int row = 0; row < concurrentRows; ++row)
{
if (da.isValid() == false)
{
return NULL;
}
memcpy(pDst, da->getRow(), mBytesPerElement * cols);
pDst += mBytesPerElement * cols;
da->nextRow();
}
}
return pPage.release();
}
示例12: execute
bool KDISTRIBUTION::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
StepResource pStep("KDISTRIBUTION", "app10", "F298D57C-D816-42F0-AE27-43DAA02C0544");
if (pInArgList == NULL || pOutArgList == NULL)
{
return false;
}
Progress* pProgress = pInArgList->getPlugInArgValue<Progress>(Executable::ProgressArg());
RasterElement* pCube = pInArgList->getPlugInArgValue<RasterElement>(Executable::DataElementArg());
if (pCube == NULL)
{
std::string msg = "A raster cube must be specified.";
pStep->finalize(Message::Failure, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ERRORS);
}
return false;
}
RasterDataDescriptor* pDesc = static_cast<RasterDataDescriptor*>(pCube->getDataDescriptor());
VERIFY(pDesc != NULL);
FactoryResource<DataRequest> pRequest;
FactoryResource<DataRequest> pRequest2;
pRequest->setInterleaveFormat(BSQ);
pRequest2->setInterleaveFormat(BSQ);
DataAccessor pAcc = pCube->getDataAccessor(pRequest.release());
DataAccessor pAcc2 = pCube->getDataAccessor(pRequest2.release());
ModelResource<RasterElement> pResultCube(RasterUtilities::createRasterElement(pCube->getName() +
"Result", pDesc->getRowCount(), pDesc->getColumnCount(), pDesc->getDataType()));
if (pResultCube.get() == NULL)
{
std::string msg = "A raster cube could not be created.";
pStep->finalize(Message::Failure, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ERRORS);
}
return false;
}
FactoryResource<DataRequest> pResultRequest;
pResultRequest->setWritable(true);
DataAccessor pDestAcc = pResultCube->getDataAccessor(pResultRequest.release());
const RasterDataDescriptor* pDescriptor = dynamic_cast<const RasterDataDescriptor*>(pCube->getDataDescriptor());
int tester_count = 0;
int eastCol = 0;
int northRow = 0;
int westCol = 0;
int southRow = 0;
double zstatistic = 0;
double total = 0.0;
double total_sum = 0.0;
double mean = 0.0;
double std = 0.0;
double a=0;
int rowSize=pDesc->getRowCount();
int colSize=pDesc->getColumnCount();
int prevCol = 0;
int prevRow = 0;
int nextCol = 0;
int nextRow = 0;
double long PFA = 0.0;
int DEPTH1 = 10;
int DEPTH2 = 10;
int DEPTH3 = 1;
int DEPTH4 = 1;
int count=0;
int zero=0;
double long threshold = 100000.0;
double look_table1[24][6];
for(int i=0; i<24; i++)
{
for(int j=0; j<3; j++)
{
look_table1[i][j]=0.0;
}
}
QStringList Names("0.0000001");
QString value = QInputDialog::getItem(Service<DesktopServices>()->getMainWidget(),
"Input a PFA value", "Input a PFA value (0.0000001 or 0.00000001)", Names);
std::string strAoi = value.toStdString();
//.........这里部分代码省略.........
示例13: execute
bool LocalSharpening::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
StepResource pStep("Local Sharpening", "app", "08BB9B79-5D24-4AB0-9F35-92DE77CED8E7");
if (pInArgList == NULL || pOutArgList == NULL)
{
return false;
}
Progress* pProgress = pInArgList->getPlugInArgValue<Progress>(Executable::ProgressArg());
RasterElement* pCube = pInArgList->getPlugInArgValue<RasterElement>(Executable::DataElementArg());
if (pCube == NULL)
{
std::string msg = "A raster cube must be specified.";
pStep->finalize(Message::Failure, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ERRORS);
}
return false;
}
RasterDataDescriptor* pDesc = static_cast<RasterDataDescriptor*>(pCube->getDataDescriptor());
VERIFY(pDesc != NULL);
EncodingType ResultType = pDesc->getDataType();
if (pDesc->getDataType() == INT4SCOMPLEX)
{
ResultType = INT4SBYTES;
}
else if (pDesc->getDataType() == FLT8COMPLEX)
{
ResultType = FLT8BYTES;
}
FactoryResource<DataRequest> pRequest;
pRequest->setInterleaveFormat(BSQ);
DataAccessor pSrcAcc = pCube->getDataAccessor(pRequest.release());
ModelResource<RasterElement> pResultCube(RasterUtilities::createRasterElement(pCube->getName() +
"_Local_Sharpening_Result", pDesc->getRowCount(), pDesc->getColumnCount(), ResultType));
if (pResultCube.get() == NULL)
{
std::string msg = "A raster cube could not be created.";
pStep->finalize(Message::Failure, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ERRORS);
}
return false;
}
FactoryResource<DataRequest> pResultRequest;
pResultRequest->setWritable(true);
DataAccessor pDestAcc = pResultCube->getDataAccessor(pResultRequest.release());
Service<DesktopServices> pDesktop;
LocalSharpeningDlg dlg(pDesktop->getMainWidget());
int stat = dlg.exec();
if (stat != QDialog::Accepted)
{
return true;
}
double contrastVal = dlg.getContrastValue();
int nFilterType = dlg.getCurrentFilterType();
int windowSize = dlg.getCurrentWindowSize();
windowSize = (windowSize-1)/2;
for (unsigned int row = 0; row < pDesc->getRowCount(); ++row)
{
if (pProgress != NULL)
{
pProgress->updateProgress("Local sharpening", row * 100 / pDesc->getRowCount(), NORMAL);
}
if (isAborted())
{
std::string msg = getName() + " has been aborted.";
pStep->finalize(Message::Abort, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ABORT);
}
return false;
}
if (!pDestAcc.isValid())
{
std::string msg = "Unable to access the cube data.";
pStep->finalize(Message::Failure, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ERRORS);
}
return false;
}
for (unsigned int col = 0; col < pDesc->getColumnCount(); ++col)
{
if (nFilterType == 0)
{
switchOnEncoding(ResultType, localAdaptiveSharpening, pDestAcc->getColumn(), pSrcAcc, row, col,
pDesc->getRowCount(), pDesc->getColumnCount(), pDesc->getDataType(), windowSize, contrastVal);
}
else
{
switchOnEncoding(ResultType, localExtremeSharpening, pDestAcc->getColumn(), pSrcAcc, row, col,
//.........这里部分代码省略.........
示例14: setPixel
void setPixel(int x, int y, T value) {
toPixel(x, y); //qDebug("((%i, %i, %i))", x, y, (int) value);
*((T*) dataAccessor->getColumn()) = value;//value;//value;
}
示例15: execute
bool WaveletKSigmaFilter::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
StepResource pStep("Wavelet K-Sigma Filter", "app", "1A4BDC34-5A95-419B-8E53-C92333AFFC3E");
if (pInArgList == NULL || pOutArgList == NULL)
{
return false;
}
Progress* pProgress = pInArgList->getPlugInArgValue<Progress>(Executable::ProgressArg());
RasterElement* pCube = pInArgList->getPlugInArgValue<RasterElement>(Executable::DataElementArg());
if (pCube == NULL)
{
std::string msg = "A raster cube must be specified.";
pStep->finalize(Message::Failure, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ERRORS);
}
return false;
}
RasterDataDescriptor* pDesc = static_cast<RasterDataDescriptor*>(pCube->getDataDescriptor());
VERIFY(pDesc != NULL);
EncodingType ResultType = pDesc->getDataType();
if (pDesc->getDataType() == INT4SCOMPLEX)
{
ResultType = INT4SBYTES;
}
else if (pDesc->getDataType() == FLT8COMPLEX)
{
ResultType = FLT8BYTES;
}
FactoryResource<DataRequest> pRequest;
pRequest->setInterleaveFormat(BSQ);
DataAccessor pSrcAcc = pCube->getDataAccessor(pRequest.release());
ModelResource<RasterElement> pResultCube(RasterUtilities::createRasterElement(pCube->getName() +
"_Noise_Removal_Result", pDesc->getRowCount(), pDesc->getColumnCount(), ResultType));
if (pResultCube.get() == NULL)
{
std::string msg = "A raster cube could not be created.";
pStep->finalize(Message::Failure, msg);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ERRORS);
}
return false;
}
FactoryResource<DataRequest> pResultRequest;
pResultRequest->setWritable(true);
DataAccessor pDestAcc = pResultCube->getDataAccessor(pResultRequest.release());
Service<DesktopServices> pDesktop;
WaveletKSigmaDlg dlg(pDesktop->getMainWidget());
int stat = dlg.exec();
if (stat != QDialog::Accepted)
{
// pProgress->updateProgress("Level 4 " + StringUtilities::toDisplayString(dlg.getLevelThreshold(3))
// + " Level5 " + StringUtilities::toDisplayString(dlg.getLevelThreshold(4)), dlg.getLevelThreshold(0), NORMAL);
return true;
}
unsigned int rowLoops;
unsigned int colLoops;
unsigned int rowIndex = 0;
unsigned int colIndex = 0;
double ScaleKValue[MAX_WAVELET_LEVELS] = {0.0};
for (int k=0; k<MAX_WAVELET_LEVELS;k++)
{
ScaleKValue[k] = dlg.getLevelThreshold(k);
}
if (0 == pDesc->getRowCount()%rowBlocks)
{
rowLoops = pDesc->getRowCount()/rowBlocks;
}
else
{
rowLoops = pDesc->getRowCount()/rowBlocks + 1;
}
if (0 == pDesc->getColumnCount()%colBlocks)
{
colLoops = pDesc->getColumnCount()/colBlocks;
}
else
{
colLoops = pDesc->getColumnCount()/colBlocks + 1;
}
for (unsigned int i = 0; i < rowLoops; i++)
{
if ( rowIndex + rowBlocks > pDesc->getRowCount())
{
rowIndex = pDesc->getRowCount() - rowBlocks;
}
colIndex = 0;
for (unsigned int j = 0; j < colLoops; j++)
//.........这里部分代码省略.........