本文整理汇总了C++中RasterElement::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ RasterElement::getName方法的具体用法?C++ RasterElement::getName怎么用?C++ RasterElement::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RasterElement
的用法示例。
在下文中一共展示了RasterElement::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addSourcePage
void ReplaceBandInputWizard::addSourcePage()
{
QWizardPage* pPage = new QWizardPage(this);
pPage->setTitle("Select source data element");
QLabel* pPageLabel = new QLabel("Select the source data element.", pPage);
pPageLabel->setWordWrap(true);
mpSource = new QComboBox(pPage);
mpSource->setEditable(false);
const RasterDataDescriptor* pDestDesc = static_cast<const RasterDataDescriptor*>(mpDest->getDataDescriptor());
std::vector<DataElement*> rasters = Service<ModelServices>()->getElements(TypeConverter::toString<RasterElement>());
for(std::vector<DataElement*>::iterator raster = rasters.begin(); raster != rasters.end(); ++raster)
{
RasterElement* pRaster = static_cast<RasterElement*>(*raster);
if (pRaster == mpDest)
{
continue;
}
const RasterDataDescriptor* pDesc = static_cast<const RasterDataDescriptor*>(pRaster->getDataDescriptor());
if (pDesc->getRowCount() == pDestDesc->getRowCount() &&
pDesc->getColumnCount() == pDestDesc->getColumnCount() &&
pDesc->getDataType() == pDestDesc->getDataType())
{
mpSource->addItem(QString::fromStdString(pRaster->getName()), reinterpret_cast<qulonglong>(pRaster));
}
}
QVBoxLayout* pLayout = new QVBoxLayout();
pLayout->addWidget(pPageLabel);
pLayout->addWidget(mpSource);
pPage->setLayout(pLayout);
addPage(pPage);
}
示例2: elementModified
void SpectralLibraryMatchResults::elementModified(Subject& subject, const std::string& signal, const boost::any& value)
{
// check for rename
RasterElement* pRaster = dynamic_cast<RasterElement*>(&subject);
if (pRaster != NULL)
{
ResultsPage* pPage = getPage(pRaster);
if (pPage != NULL)
{
int index = mpTabWidget->indexOf(pPage);
if (index != -1 && mpTabWidget->tabToolTip(index).toStdString() != pRaster->getName())
{
mpTabWidget->setTabText(index, QString::fromStdString(pRaster->getDisplayName(true)));
mpTabWidget->setTabToolTip(index, QString::fromStdString(pRaster->getName()));
}
}
}
}
示例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: execute
bool TextureSegmentation::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
StepResource pStep("SAR image segmentation", "app", "CC430C1A-9D8C-4bb5-9254-FCF7EECAFA3C");
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() +
"_Segmentation_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());
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 (NULL != pBuffer)
{
free(pBuffer);
}
pBuffer = (float *)malloc(sizeof(float)*pDesc->getRowCount()*pDesc->getColumnCount());
MakeSegmentation(pSrcAcc, pBuffer, pBuffer, pDesc->getRowCount(), pDesc->getColumnCount(), pDesc->getDataType());
//Output the value
unsigned int nCount = 0;
for (unsigned int j = 0; j < pDesc->getColumnCount(); j++)
{
for (unsigned int i = 0; i < pDesc->getRowCount(); i++)
{
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;
}
pDestAcc->toPixel(i, j);
switchOnEncoding(ResultType, restoreSegmentationValue, pDestAcc->getColumn(), (pBuffer+nCount));
nCount++;
}
}
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);
//.........这里部分代码省略.........
示例5: execute
bool adaptive_median::execute(PlugInArgList * pInArgList,
PlugInArgList * pOutArgList)
{
StepResource pStep("adap_median", "noise",
"5EA0CC75-9E0B-4c3d-BA23-6DB7157BBD55");
if (pInArgList == NULL || pOutArgList == NULL)
{
return false;
}
std::string msg = "Noise Reduction by Adaptive Median Filter ";
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 =
"Noise Reduction 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());
RasterElement *dRas =
RasterUtilities::createRasterElement(pCube->getName() +
"Noise_reduction_Median_filter",
pDesc->getRowCount(),
pDesc->getColumnCount(), 3,
pDesc->getDataType(), BSQ);
pProgress->updateProgress(msg, 50, NORMAL);
copyImage4(pCube, dRas, 0, pProgress);
pProgress->updateProgress(msg + "RED complete", 60, NORMAL);
copyImage4(pCube, dRas, 1, pProgress);
pProgress->updateProgress(msg + "GREEN complete", 70, NORMAL);
copyImage4(pCube, dRas, 2, pProgress);
pProgress->updateProgress(msg + "BLUE complete", 80, NORMAL);
// new model resource
RasterDataDescriptor *rDesc =
dynamic_cast < RasterDataDescriptor * >(dRas->getDataDescriptor());
rDesc->setDisplayMode(RGB_MODE); // enable color mode
rDesc->setDisplayBand(RED, rDesc->getActiveBand(0));
rDesc->setDisplayBand(GREEN, rDesc->getActiveBand(1));
rDesc->setDisplayBand(BLUE, rDesc->getActiveBand(2));
ModelResource < RasterElement > pResultCube(dRas);
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;
}
pProgress->updateProgress("Final", 100, NORMAL);
pProgress->updateProgress(msg, 100, NORMAL);
if (!isBatch())
{
Service < DesktopServices > pDesktop;
SpatialDataWindow *pWindow =
static_cast <
SpatialDataWindow *
>(pDesktop->
createWindow(pResultCube->getName(), SPATIAL_DATA_WINDOW));
//.........这里部分代码省略.........
示例6: getName
std::string getName() { return pRaster->getName(); }
示例7: 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));
//.........这里部分代码省略.........
示例8: createView
void ChippingWindow::createView()
{
if (mpChippingWidget == NULL)
{
return;
}
RasterElement* pRaster = getRasterElement();
if (pRaster == NULL)
{
return;
}
// Create the new raster element from the primary element of the source.
// Note that this does not chip displayed elements if they differ from the primary element.
// This causes a special case below where the stretch values are being applied to the chipped layer.
RasterElement* pRasterChip = pRaster->createChip(pRaster->getParent(), "_chip",
mpChippingWidget->getChipRows(), mpChippingWidget->getChipColumns(), mpChippingWidget->getChipBands());
if (pRasterChip == NULL)
{
QMessageBox::critical(this, windowTitle(), "Unable to create a new cube!");
return;
}
const RasterDataDescriptor* pDescriptor =
dynamic_cast<const RasterDataDescriptor*>(pRasterChip->getDataDescriptor());
VERIFYNRV(pDescriptor != NULL);
// Create a view for the new chip
SpatialDataWindow* pWindow = dynamic_cast<SpatialDataWindow*>(
Service<DesktopServices>()->createWindow(pRasterChip->getName(), SPATIAL_DATA_WINDOW));
if (pWindow == NULL)
{
return;
}
SpatialDataView* pView = pWindow->getSpatialDataView();
if (pView == NULL)
{
Service<DesktopServices>()->deleteWindow(pWindow);
return;
}
UndoLock lock(pView);
if (pView->setPrimaryRasterElement(pRasterChip) == false)
{
Service<DesktopServices>()->deleteWindow(pWindow);
return;
}
// RasterLayerImp is needed for the call to setCurrentStretchAsOriginalStretch().
RasterLayerImp* pLayer = dynamic_cast<RasterLayerImp*>(pView->createLayer(RASTER, pRasterChip));
if (pLayer == NULL)
{
Service<DesktopServices>()->deleteWindow(pWindow);
return;
}
string origName = pRaster->getName();
SpatialDataWindow* pOrigWindow = dynamic_cast<SpatialDataWindow*>(
Service<DesktopServices>()->getWindow(origName, SPATIAL_DATA_WINDOW));
if (pOrigWindow != NULL)
{
SpatialDataView* pOrigView = pOrigWindow->getSpatialDataView();
if (pOrigView != NULL)
{
LayerList* pLayerList = pOrigView->getLayerList();
if (pLayerList != NULL)
{
RasterLayer* pOrigLayer = static_cast<RasterLayer*>(pLayerList->getLayer(RASTER, pRaster));
if (pOrigLayer != NULL)
{
// Set the stretch type first so that stretch values are interpreted correctly.
pLayer->setStretchType(GRAYSCALE_MODE, pOrigLayer->getStretchType(GRAYSCALE_MODE));
pLayer->setStretchType(RGB_MODE, pOrigLayer->getStretchType(RGB_MODE));
pLayer->setDisplayMode(pOrigLayer->getDisplayMode());
// Set the properties of the cube layer in the new view.
// For each channel, display the first band if the previously displayed band was chipped.
vector<RasterChannelType> channels = StringUtilities::getAllEnumValues<RasterChannelType>();
for (vector<RasterChannelType>::const_iterator iter = channels.begin(); iter != channels.end(); ++iter)
{
bool bandCopied = true;
DimensionDescriptor newBand;
DimensionDescriptor oldBand = pOrigLayer->getDisplayedBand(*iter);
if (oldBand.isOriginalNumberValid() == true)
{
newBand = pDescriptor->getOriginalBand(oldBand.getOriginalNumber());
}
if (newBand.isValid() == false)
{
bandCopied = false;
newBand = pDescriptor->getBands().front();
}
// No need to explicitly set the RasterElement here since the new view only has one RasterElement.
pLayer->setDisplayedBand(*iter, newBand);
//.........这里部分代码省略.........
示例9: 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++)
//.........这里部分代码省略.........
示例10: 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;
}
//.........这里部分代码省略.........
示例11: 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(),
//.........这里部分代码省略.........
示例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: execute
bool bilinear_bayer::execute(PlugInArgList * pInArgList,
PlugInArgList * pOutArgList)
{
StepResource pStep("bilinear_bayer", "pratik",
"27170298-10CE-4E6C-AD7A-97E8058C29FF");
if (pInArgList == NULL || pOutArgList == NULL)
{
return false;
}
Progress *pProgress =
pInArgList->getPlugInArgValue < Progress > (Executable::ProgressArg());
RasterElement *pCube = pInArgList->getPlugInArgValue < RasterElement > (Executable::DataElementArg()); // pCube
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;
}
pProgress->updateProgress("Starting calculations", 10, NORMAL);
RasterDataDescriptor *pDesc =
static_cast < RasterDataDescriptor * >(pCube->getDataDescriptor());
VERIFY(pDesc != NULL);
std::string msg = "De-bayerize by bilinear interpolation \n";
pProgress->updateProgress(msg, 20, NORMAL); // show initial R,G and B
// values
RasterElement *dRas =
RasterUtilities::createRasterElement(pCube->getName() + "RGB",
pDesc->getRowCount(),
pDesc->getColumnCount(), 3,
pDesc->getDataType(), BSQ);
// request
pProgress->updateProgress(msg, 50, NORMAL);
copyImage(pCube, dRas, 0, pProgress);
pProgress->updateProgress(msg + "RED complete", 60, NORMAL);
copyImage(pCube, dRas, 1, pProgress);
pProgress->updateProgress(msg + "GREEN complete", 70, NORMAL);
copyImage(pCube, dRas, 2, pProgress);
pProgress->updateProgress(msg + "BLUE complete", 80, NORMAL);
// new model resource
RasterDataDescriptor *rDesc =
dynamic_cast < RasterDataDescriptor * >(dRas->getDataDescriptor());
rDesc->setDisplayMode(RGB_MODE); // enable color mode
rDesc->setDisplayBand(RED, rDesc->getActiveBand(0));
rDesc->setDisplayBand(GREEN, rDesc->getActiveBand(1));
rDesc->setDisplayBand(BLUE, rDesc->getActiveBand(2));
ModelResource < RasterElement > pResultCube(dRas);
pProgress->updateProgress("Final", 100, NORMAL);
// create window
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);
}
return false;
}
//.........这里部分代码省略.........
示例15: execute
bool ChangeUpDirection::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
if (pInArgList == NULL || pOutArgList == NULL)
{
return false;
}
ProgressTracker progress(pInArgList->getPlugInArgValue<Progress>(Executable::ProgressArg()),
"Rotating data.", "app", "{11adadb9-c133-49de-8cf5-a16372da2578}");
RasterElement* pData = pInArgList->getPlugInArgValue<RasterElement>(Executable::DataElementArg());
if (pData == NULL)
{
progress.report("No data element specified.", 0, ERRORS, true);
return false;
}
bool display = false;
if (!pInArgList->getPlugInArgValue("Display Results", display))
{
progress.report("Unsure if results should be displayed. Invalid argument.", 0, ERRORS, true);
return false;
}
double rotation = 0.0;
SpatialDataView* pOrigView = NULL;
if (isBatch())
{
if (!pInArgList->getPlugInArgValue("Rotation", rotation))
{
progress.report("No rotation specified.", 0, ERRORS, true);
return false;
}
}
else
{
pOrigView = pInArgList->getPlugInArgValue<SpatialDataView>(Executable::ViewArg());
if (pOrigView == NULL)
{
progress.report("No view specified.", 0, ERRORS, true);
return false;
}
GraphicLayer* pLayer = dynamic_cast<GraphicLayer*>(pOrigView->getActiveLayer());
if (pLayer == NULL)
{
pLayer = dynamic_cast<GraphicLayer*>(pOrigView->getTopMostLayer(ANNOTATION));
}
GraphicObject* pArrow = NULL;
if (pLayer != NULL)
{
std::list<GraphicObject*> objects;
pLayer->getObjects(ARROW_OBJECT, objects);
if (!objects.empty())
{
pArrow = objects.back();
}
if (objects.size() > 1)
{
progress.report("Multiple arrow objects found. Using the most recently added one.", 0, WARNING, true);
}
}
if (pArrow == NULL)
{
progress.report("Unable to locate up direction. Add an arrow annotation and re-run this plugin.",
0, ERRORS, true);
return false;
}
LocationType ur = pArrow->getUrCorner();
LocationType ll = pArrow->getLlCorner();
double xlen = ur.mX - ll.mX;
double ylen = ur.mY - ll.mY;
// Initial rotatation value. The 90 degrees is due to the difference
// in the "0 point" (right vs. up). Also account for explicit rotation
// of the annotation object. Convert this to radians.
rotation = GeoConversions::convertDegToRad(90 + pArrow->getRotation());
// Determine a rotation adjustment based on the bounding box
rotation += atan2(ylen, xlen);
}
progress.report("Rotating data.", 10, NORMAL);
ModelResource<RasterElement> pRotated(pData->copyShallow(pData->getName() + "_rotated", pData->getParent()));
if (pRotated.get() == NULL)
{
progress.report("Unable to create destination raster element.", 0, ERRORS, true);
return false;
}
int defaultBadValue(0); // the rotate method will handle setting the default bad values into the rotated raster
if (!RasterUtilities::rotate(pRotated.get(), pData, rotation, defaultBadValue,
INTERP_NEAREST_NEIGHBOR, progress.getCurrentProgress(), &mAbort))
{
// error message already reported by rotate()
return false;
}
pOutArgList->setPlugInArgValue("Rotated Element", pRotated.get());
if (display)
{
SpatialDataWindow* pWindow = static_cast<SpatialDataWindow*>(
Service<DesktopServices>()->createWindow(pRotated->getName(), SPATIAL_DATA_WINDOW));
SpatialDataView* pView = (pWindow == NULL) ? NULL : pWindow->getSpatialDataView();
//.........这里部分代码省略.........