本文整理汇总了C++中SpatialDataView::setPrimaryRasterElement方法的典型用法代码示例。如果您正苦于以下问题:C++ SpatialDataView::setPrimaryRasterElement方法的具体用法?C++ SpatialDataView::setPrimaryRasterElement怎么用?C++ SpatialDataView::setPrimaryRasterElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpatialDataView
的用法示例。
在下文中一共展示了SpatialDataView::setPrimaryRasterElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: displayResult
SpatialDataView* ConvolutionFilterShell::displayResult()
{
VERIFY(mInput.mpResult != NULL);
if (Service<ApplicationServices>()->isBatch())
{
return NULL;
}
SpatialDataWindow* pWindow = static_cast<SpatialDataWindow*>(
Service<DesktopServices>()->createWindow(mInput.mpResult->getName(), SPATIAL_DATA_WINDOW));
SpatialDataView* pView = (pWindow == NULL) ? NULL : pWindow->getSpatialDataView();
if (pView == NULL)
{
Service<DesktopServices>()->deleteWindow(pWindow);
mProgress.report("Unable to create view.", 0, ERRORS, true);
return NULL;
}
pView->setPrimaryRasterElement(mInput.mpResult);
RasterLayer* pLayer = NULL;
{ // scope
UndoLock lock(pView);
pLayer = static_cast<RasterLayer*>(pView->createLayer(RASTER, mInput.mpResult));
}
if (pLayer == NULL)
{
//#pragma message(__FILE__ "(" STRING(__LINE__) ") : warning : This would be cleaner with a WindowResource. If one " \
// "becomes available, use it instead. (tclarke)")
Service<DesktopServices>()->deleteWindow(pWindow);
mProgress.report("Unable to create layer.", 0, ERRORS, true);
return NULL;
}
return pView;
}
示例2: displayResult
bool NormalizeData::displayResult()
{
if (isBatch())
{
return true;
}
if (mInput.mpResult == NULL)
{
return false;
}
SpatialDataWindow* pWindow = static_cast<SpatialDataWindow*>(
Service<DesktopServices>()->createWindow(mInput.mpResult->getName(), SPATIAL_DATA_WINDOW));
SpatialDataView* pView = (pWindow == NULL) ? NULL : pWindow->getSpatialDataView();
if (pView == NULL)
{
mProgress.report("Unable to create view.", 0, ERRORS, true);
return false;
}
pView->setPrimaryRasterElement(mInput.mpResult);
UndoLock lock(pView);
RasterLayer* pLayer = static_cast<RasterLayer*>(pView->createLayer(RASTER, mInput.mpResult));
if (pLayer == NULL)
{
mProgress.report("Unable to create view.", 0, ERRORS, true);
return false;
}
return true;
}
示例3: createReturnGuiElement
bool BandMath::createReturnGuiElement()
{
bool bSuccess = false;
if (mbInteractive || (mbDisplayResults && Service<ApplicationServices>()->isBatch() == false))
{
SpatialDataWindow* pWindow = NULL;
if (mbAsLayerOnExistingView)
{
pWindow = static_cast<SpatialDataWindow*>(mpDesktop->getWindow(mpCube->getName(), SPATIAL_DATA_WINDOW));
}
else
{
pWindow = static_cast<SpatialDataWindow*>(mpDesktop->createWindow(mResultsName.c_str(), SPATIAL_DATA_WINDOW));
}
if (pWindow == NULL)
{
return false;
}
SpatialDataView* pView = pWindow->getSpatialDataView();
VERIFYRV(pView != NULL, NULL);
UndoLock lock(pView);
if (!mbAsLayerOnExistingView)
{
pView->setPrimaryRasterElement(mpResultData);
}
LayerList* pLayerList = pView->getLayerList();
if (pLayerList != NULL)
{
Layer* pLayer = pLayerList->getLayer(RASTER, mpResultData);
if (pLayer == NULL)
{
if (pView->createLayer(RASTER, mpResultData) != NULL)
{
bSuccess = true;
}
if (!mbAsLayerOnExistingView)
{
Service<ModelServices> pModel;
vector<DataElement*> elements = pModel->getElements(mpResultData, "GcpList");
for_each(elements.begin(), elements.end(),
boost::bind(&SpatialDataView::createLayer, pView, GCP_LAYER, _1));
}
}
}
}
else // no GUI required, method has successfully noop'd
{
bSuccess = true;
}
return bSuccess;
}
示例4: createView
SpatialDataView* VideoImporter::createView() const
{
if ((isBatch()) || (mpRasterElement == NULL))
{
return NULL;
}
mProgress.report("Creating view...", 85, NORMAL);
// Get the data set name
std::string name = mpRasterElement->getName();
if (name.empty())
{
mProgress.report("The data set name is invalid! A view cannot be created.", 0, ERRORS, true);
return NULL;
}
// Create the spatial data window
SpatialDataWindow* pWindow = static_cast<SpatialDataWindow*>(Service<DesktopServices>()->createWindow(name, SPATIAL_DATA_WINDOW));
SpatialDataView* pView = (pWindow == NULL) ? NULL : pWindow->getSpatialDataView();
if (pView == NULL)
{
mProgress.report("Could not create the view window!", 0, ERRORS, true);
return NULL;
}
// Set the spatial data in the view
pView->setPrimaryRasterElement(mpRasterElement);
// Block undo actions when creating the layers
UndoLock lock(pView);
// Add the cube layer
RasterLayer* pLayer = static_cast<RasterLayer*>(pView->createLayer(RASTER, mpRasterElement));
if (pLayer == NULL)
{
mProgress.report("Could not create the cube layer!", 0, ERRORS, true);
return NULL;
}
pLayer->setStretchUnits(RED, RAW_VALUE);
pLayer->setStretchUnits(GREEN, RAW_VALUE);
pLayer->setStretchUnits(BLUE, RAW_VALUE);
pLayer->setStretchValues(RED, 0, 255);
pLayer->setStretchValues(GREEN, 0, 255);
pLayer->setStretchValues(BLUE, 0, 255);
if (pLayer->isGpuImageSupported())
{
pLayer->enableGpuImage(true);
}
return pView;
}
示例5: createWindow
bool MultiLayerMovie::createWindow()
{
bool bSuccess = false;
mpWindow = static_cast<SpatialDataWindow*>(
Service<DesktopServices>()->createWindow(
"Multi-Layer Movie",
SPATIAL_DATA_WINDOW));
VERIFY(mpWindow != NULL);
SpatialDataView* pView = mpWindow->getSpatialDataView();
VERIFY(pView != NULL);
UndoLock lock(pView);
pView->setPrimaryRasterElement(mpRaster1);
bSuccess = createLayer(pView, mpRaster1, mpLayer1) &&
createLayer(pView, mpRaster2, mpLayer2, 0.5, 5, 0.5, 5) &&
createLayer(pView, mpRaster3, mpLayer3, 2, -5, 2, -5);
return bSuccess;
}
示例6: 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);
//.........这里部分代码省略.........
示例7: getPreview
//.........这里部分代码省略.........
// Do not georeference
GeoreferenceDescriptor* pLoadGeorefDescriptor = pLoadDescriptor->getGeoreferenceDescriptor();
if (pLoadGeorefDescriptor != NULL)
{
pLoadGeorefDescriptor->setGeoreferenceOnImport(false);
}
// Validate the preview
string errorMessage;
bool bValidPreview = validate(pLoadDescriptor, vector<const DataDescriptor*>(), errorMessage);
if (bValidPreview == false)
{
// Try an in-memory preview
pLoadDescriptor->setProcessingLocation(IN_MEMORY);
bValidPreview = validate(pLoadDescriptor, vector<const DataDescriptor*>(), errorMessage);
}
QWidget* pPreviewWidget = NULL;
if (bValidPreview == true)
{
// Create the model element
RasterElement* pRasterElement = static_cast<RasterElement*>(mpModel->createElement(pLoadDescriptor));
if (pRasterElement != NULL)
{
// Add the progress and raster element to an input arg list
PlugInArgList* pInArgList = NULL;
bool bSuccess = getInputSpecification(pInArgList);
if ((bSuccess == true) && (pInArgList != NULL))
{
bSuccess = pInArgList->setPlugInArgValue(Executable::ProgressArg(), pProgress);
if (bSuccess)
{
bSuccess = pInArgList->setPlugInArgValue(Importer::ImportElementArg(), pRasterElement);
}
}
// Load the data in batch mode
bool bBatch = isBatch();
setBatch();
bSuccess = execute(pInArgList, NULL);
// Restore to interactive mode if necessary
if (bBatch == false)
{
setInteractive();
}
// Create the spatial data view
if (bSuccess == true)
{
string name = pRasterElement->getName();
SpatialDataView* pView = static_cast<SpatialDataView*>(mpDesktop->createView(name, SPATIAL_DATA_VIEW));
if (pView != NULL)
{
// Set the spatial data in the view
pView->setPrimaryRasterElement(pRasterElement);
// Add the cube layer
RasterLayer* pLayer = static_cast<RasterLayer*>(pView->createLayer(RASTER, pRasterElement));
if (pLayer != NULL)
{
// Get the widget from the view
pPreviewWidget = pView->getWidget();
}
else
{
string message = "Could not create the cube layer!";
if (pProgress != NULL)
{
pProgress->updateProgress(message, 0, ERRORS);
}
mpModel->destroyElement(pRasterElement);
}
}
else
{
string message = "Could not create the view!";
if (pProgress != NULL)
{
pProgress->updateProgress(message, 0, ERRORS);
}
mpModel->destroyElement(pRasterElement);
}
}
else
{
mpModel->destroyElement(pRasterElement);
}
}
}
// Delete the data descriptor copy
mpModel->destroyDataDescriptor(pLoadDescriptor);
return pPreviewWidget;
}
示例8: execute
//.........这里部分代码省略.........
}
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,
pDesc->getRowCount(), pDesc->getColumnCount(), pDesc->getDataType(), windowSize);
}
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);
}
return false;
}
pView->setPrimaryRasterElement(pResultCube.get());
pView->createLayer(RASTER, pResultCube.get());
}
if (pProgress != NULL)
{
pProgress->updateProgress("Local sharpening is compete.", 100, NORMAL);
}
pOutArgList->setPlugInArgValue("Local sharpening Result", pResultCube.release());
pStep->finalize();
return true;
}
示例9: process
//.........这里部分代码省略.........
for (unsigned int col = 0; col < N_Col; ++col)
{
NodeLat = OrthoGrid.Lat_Min+row*OrthoGrid.Lat_Step;
NodeLon = OrthoGrid.Lon_Min+col*OrthoGrid.Lon_Step;
// RETRIEVE HEIGHT VALUE FROM DSM
if (DSM_resampling == 0)
{
int DSM_I = int((NodeLon - DSMGrid.Lon_Min)/DSMGrid.Lon_Step);
int DSM_J = pDescDSM->getRowCount() - int((NodeLat - DSMGrid.Lat_Min)/DSMGrid.Lat_Step);
pDSMAcc->toPixel(DSM_J,DSM_I);
VERIFY(pDSMAcc.isValid());
H_IJ = (pDSMAcc->getColumnAsDouble());
}
else
{
double DSM_I = ((NodeLon - DSMGrid.Lon_Min)/DSMGrid.Lon_Step);
double DSM_J = pDescDSM->getRowCount() - ((NodeLat - DSMGrid.Lat_Min)/DSMGrid.Lat_Step);
H_IJ = bilinear_height(pDSMAcc,DSM_I,DSM_J);
}
P_COORD NodeImage = Model->SAR_GroundToImage(NodeLon,NodeLat,H_IJ+Geoid_Offset);
if ((NodeImage.I>1 && NodeImage.I< Model->Metadata.Width-1) && (NodeImage.J>1 && NodeImage.J< Model->Metadata.Height-1))
{
switchOnEncoding(pResultDesc->getDataType(), copypixel3, pDestAcc->getColumn(), pSrcAcc, int(NodeImage.I), int(NodeImage.J),boxsize, H_IJ);
}
pDestAcc->nextColumn();
}
pDestAcc->nextRow();
}
Service<DesktopServices> pDesktop;
Service<ModelServices> pMod;
GcpList* GcpL = static_cast<GcpList*>(pMod->createElement("corner coordinate","GcpList",pResultCube.get()));
// Update GCPs Information: to account for Opticks reading gcp lat&lon values the opposite way around,
// here it is necessary to switch the value to assign lat to gcp.mCoordinate.mX and lon to gcp.mCoordinate.mY
GcpPoint Punto;
Punto.mCoordinate.mX = OrthoGrid.Lat_Min;
Punto.mCoordinate.mY = OrthoGrid.Lon_Min;
Punto.mCoordinate.mZ = 0.0;
Punto.mPixel.mX = 0.0;
Punto.mPixel.mY = 0.0;
GcpL->addPoint(Punto);
Punto.mCoordinate.mX = OrthoGrid.Lat_Max;
Punto.mCoordinate.mY = OrthoGrid.Lon_Min;
Punto.mCoordinate.mZ = 0.0;
Punto.mPixel.mX = 0.0;
Punto.mPixel.mY = OrthoGrid.Y_Dim;
GcpL->addPoint(Punto);
Punto.mCoordinate.mX = OrthoGrid.Lat_Min;
Punto.mCoordinate.mY = OrthoGrid.Lon_Max;
Punto.mCoordinate.mZ = 0.0;
Punto.mPixel.mX = OrthoGrid.X_Dim;
Punto.mPixel.mY = 0.0;
GcpL->addPoint(Punto);
Punto.mCoordinate.mX = OrthoGrid.Lat_Max;
Punto.mCoordinate.mY = OrthoGrid.Lon_Max;
Punto.mCoordinate.mZ = 0.0;
Punto.mPixel.mX = OrthoGrid.X_Dim;
Punto.mPixel.mY = OrthoGrid.Y_Dim;
GcpL->addPoint(Punto);
SpatialDataWindow* pWindow = static_cast<SpatialDataWindow*>(pDesktop->createWindow(pResultCube->getName(),
SPATIAL_DATA_WINDOW));
SpatialDataView* pView = (pWindow == NULL) ? NULL : pWindow->getSpatialDataView();
pView->setPrimaryRasterElement(pResultCube.get());
pView->createLayer(RASTER, pResultCube.get());
pView->createLayer(GCP_LAYER,GcpL,"GCP");
pView->setDataOrigin(LOWER_LEFT);
pResultCube.release();
pProgress->updateProgress("Orthorectification is complete.", 100, NORMAL);
pStep->addStep("End","app", "B4D426EC-E06D-11E1-83C8-42E56088709B");
pStep->finalize();
return true;
}
示例10: execute
//.........这里部分代码省略.........
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);
}
return false;
}
pView->setPrimaryRasterElement(pResultCube.get());
pView->createLayer(RASTER, pResultCube.get());
}
if (pProgress != NULL)
{
pProgress->updateProgress("Edge detect compete.", 100, NORMAL);
}
pOutArgList->setPlugInArgValue("Edge detect result", pResultCube.release());
pStep->finalize();
}
return true;
}
示例11: execute
//.........这里部分代码省略.........
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;
}
pView->setPrimaryRasterElement(pResultCube.get());
pView->createLayer(RASTER, pResultCube.get());
}
pOutArgList->setPlugInArgValue("bilinear_bayer_Result", pResultCube.release()); // for
// saving
// data
pStep->finalize();
return true;
}
示例12: mergeData
//.........这里部分代码省略.........
{
QMessageBox::critical(NULL, "Spectral Data Merge", "Merge Data Format Error!", "OK");
pStep->finalize(Message::Failure, "Merge Data Column Format Error!");
return false;
}
// QMessageBox::about(this, "Test", "Here2");
FactoryResource<DataRequest> pRequest;
pRequest->setInterleaveFormat(BIP);
// pRequest->setWritable(true);
DataAccessor pSrcAcc = pData->getDataAccessor(pRequest.release());
switchOnEncoding(pDesc->getDataType(), mergeElement, NULL, rowCount,
colCount, pSrcAcc, pDesAcc, i, band, pProgress, mergeList->count());
// QMessageBox::about(this, "Test", "Here5");
}
else {
QMessageBox::critical(this, "Error", "pData is NULL");
return false;
}
// mergeElementList.push_back(filenameMap[tmpItemText.toStdString()]);
}
Service<DesktopServices> pDesktop;
SpatialDataWindow* pWindow = static_cast<SpatialDataWindow*>(pDesktop->createWindow("DataMergeResult",
SPATIAL_DATA_WINDOW));
SpatialDataView* pView = (pWindow == NULL) ? NULL : pWindow->getSpatialDataView();
if (pView == NULL)
{
pStep->finalize(Message::Failure, "SpatialDataView error!");
return false;
}
pView->setPrimaryRasterElement(pDesRaster);
pView->createLayer(RASTER, pDesRaster);
if (pDesc != NULL)
{
const RasterFileDescriptor* pFileDescriptor = dynamic_cast<const RasterFileDescriptor*>(pDesc->getFileDescriptor());
if (pFileDescriptor != NULL)
{
Service<ModelServices> pModel;
if (pModel.get() != NULL)
{
list<GcpPoint> gcps;
gcps = pFileDescriptor->getGcps();
if (gcps.empty() == true)
{
if (pInitData->isGeoreferenced())
{
GcpPoint gcp;
// Lower left
gcp.mPixel.mX = 0.0;
gcp.mPixel.mY = 0.0;
gcp.mCoordinate = pInitData->convertPixelToGeocoord(gcp.mPixel);
gcps.push_back(gcp);
// Lower right
gcp.mPixel.mX = colCount - 1;
gcp.mPixel.mY = 0.0;
gcp.mCoordinate = pInitData->convertPixelToGeocoord(gcp.mPixel);
gcps.push_back(gcp);
// Upper left
示例13: execute
//.........这里部分代码省略.........
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);
if (pProgress != NULL)
{
pProgress->updateProgress(msg, 0, ERRORS);
}
return false;
}
pView->setPrimaryRasterElement(pResultCube.get());
pView->createLayer(RASTER, pResultCube.get());
}
if (pProgress != NULL)
{
pProgress->updateProgress("Image segmentation is compete.", 100, NORMAL);
}
pOutArgList->setPlugInArgValue("Image segmentation result", pResultCube.release());
pStep->finalize();
return true;
}
示例14: execute
//.........这里部分代码省略.........
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));
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;
}
pView->setPrimaryRasterElement(pResultCube.get());
pView->createLayer(RASTER, pResultCube.get());
}
if (pProgress != NULL)
{
pProgress->updateProgress("HighPass is compete.", 100, NORMAL);
}
pOutArgList->setPlugInArgValue("Result", pResultCube.release());
pStep->finalize();
return true;
}
示例15: execute
//.........这里部分代码省略.........
pAcc->nextRow();
}
// Create a GCP layer
/*
SpatialDataWindow* pWindow = dynamic_cast<SpatialDataWindow*>(Service<DesktopServices>()->createWindow(pResultCube.get()->getName(), SPATIAL_DATA_WINDOW));
SpatialDataView* pView = pWindow->getSpatialDataView();
*/
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;
}
pView->setPrimaryRasterElement(pResultCube.get());
pView->createLayer(RASTER, pResultCube.get());
// Create the GCP list
if (pCube->isGeoreferenced() == true)
{
const vector<DimensionDescriptor>& rows = pDescriptor->getRows();
const vector<DimensionDescriptor>& columns = pDescriptor->getColumns();
if ((rows.empty() == false) && (columns.empty() == false))
{
// Get the geocoordinates at the chip corners
/*
VERIFYNRV(rows.front().isActiveNumberValid() == true);
VERIFYNRV(rows.back().isActiveNumberValid() == true);
VERIFYNRV(columns.front().isActiveNumberValid() == true);
VERIFYNRV(columns.back().isActiveNumberValid() == true);
*/
unsigned int startRow = rows.front().getActiveNumber();
unsigned int endRow = rows.back().getActiveNumber();
unsigned int startCol = columns.front().getActiveNumber();
unsigned int endCol = columns.back().getActiveNumber();
GcpPoint ulPoint;
ulPoint.mPixel = LocationType(startCol, startRow);
ulPoint.mCoordinate = pCube->convertPixelToGeocoord(ulPoint.mPixel);
GcpPoint urPoint;
urPoint.mPixel = LocationType(endCol, startRow);