本文整理汇总了C++中FactoryResource::release方法的典型用法代码示例。如果您正苦于以下问题:C++ FactoryResource::release方法的具体用法?C++ FactoryResource::release怎么用?C++ FactoryResource::release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FactoryResource
的用法示例。
在下文中一共展示了FactoryResource::release方法的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: getAccessor
DataAccessor getAccessor(int band, bool writable = false) {
FactoryResource<DataRequest> pRequest = FactoryResource<DataRequest>();
pRequest->setRows(pDataDescriptor->getActiveRow(0), pDataDescriptor->getActiveRow(getRowCount() - 1));
pRequest->setColumns(pDataDescriptor->getActiveColumn(0), pDataDescriptor->getActiveColumn(getColumnCount() - 1));
pRequest->setBands(pDataDescriptor->getActiveBand(band), pDataDescriptor->getActiveBand(band));
pRequest->setWritable(writable);
return pRaster->getDataAccessor(pRequest.release());
}
示例3: StartOrtho
void Simulation_GUI::StartOrtho()
{
mpStartOrtho->setEnabled(false);
// Update Grid Information
OrthoGrid.X_Step = X_Spacing->value();
OrthoGrid.Y_Step = Y_Spacing->value();
OrthoGrid.X_Dim = int(OrthoGrid.X_Dim/OrthoGrid.X_Step)+1.0;
OrthoGrid.Y_Dim = int(OrthoGrid.Y_Dim/OrthoGrid.Y_Step)+1.0;
OrthoGrid.Lon_Step = (OrthoGrid.Lon_Max-OrthoGrid.Lon_Min)/OrthoGrid.X_Dim;
OrthoGrid.Lat_Step = (OrthoGrid.Lat_Max-OrthoGrid.Lat_Min)/OrthoGrid.Y_Dim;
//Start Ortho
RasterDataDescriptor* pDesc = static_cast<RasterDataDescriptor*>(pCube->getDataDescriptor());
FactoryResource<DataRequest> pRequest;
DataAccessor pAcc = pCube->getDataAccessor(pRequest.release());
DataDescriptor* dMeta = pCube->getDataDescriptor();
DynamicObject* oMetadata = dMeta->getMetadata();
// RETRIEVE & UPDATE METADATA INFORMATION //
bool control = Metadata->ReadFile(image_path);
Metadata->UpdateMetadata(oMetadata);
SAR_Model *ModProva;
ModProva = new SAR_Slant_Model(*Metadata, 10);
if(Metadata->Projection == "SGF")
{
ModProva = new SAR_Ground_Model(*Metadata,10);
}
SAR_Simulator_Processor ProcessOrtho(pCube, ModProva, OrthoGrid, Height->value());
// RETRIVE SELECTED RESAMPLING METHOD AND EXECUTE ORTHO
int indexR = mpInterpolationList->currentIndex();
//if (mpFlatten->isChecked() ==true)
//{
//VERIFYNRV(ProcessOrtho.process(indexR));
//}
//else
//{
VERIFYNRV(RetrieveDSMGrid());
VERIFYNRV(ProcessOrtho.process(indexR, pDSM, DSMGrid, GeoidOffSet->value(),mpDSMInterpolationList->currentIndex()));
//}
}
示例4: copy
// FileDescriptor
FileDescriptor* FileDescriptorAdapter::copy() const
{
FactoryResource<FileDescriptor> pFileDescriptor;
if (pFileDescriptor->clone(this) == false)
{
return NULL;
}
return pFileDescriptor.release();
}
示例5: getCurrentFrameAccessor
DataAccessor BackgroundSuppressionShell::getCurrentFrameAccessor() const
{
if(mpRaster == NULL)
{
return DataAccessor(NULL, NULL);
}
RasterDataDescriptor *pDesc = static_cast<RasterDataDescriptor*>(mpRaster->getDataDescriptor());
VERIFYRV(pDesc != NULL, DataAccessor(NULL, NULL));
FactoryResource<DataRequest> request;
VERIFYRV(request.get() != NULL, DataAccessor(NULL, NULL));
request->setInterleaveFormat(BSQ);
DimensionDescriptor band = pDesc->getBands()[mCurrentFrame];
request->setBands(band, band, 1);
return mpRaster->getDataAccessor(request.release());
}
示例6: VERIFYRV
DynamicObject *QueryOptions::toDynamicObject() const
{
FactoryResource<DynamicObject> pDynObj;
VERIFYRV(pDynObj.get() != NULL, NULL);
pDynObj->setAttribute(QUERY_NAME, mQueryName);
pDynObj->setAttribute(QUERY_STRING, mQueryString);
pDynObj->setAttribute(SYMBOL_NAME, mSymbolName);
pDynObj->setAttribute(SYMBOL_SIZE, mSymbolSize);
pDynObj->setAttribute(LINE_STATE, mLineState);
pDynObj->setAttribute(LINE_STYLE, mLineStyle);
pDynObj->setAttribute(LINE_WIDTH, mLineWidth);
pDynObj->setAttribute(LINE_COLOR, mLineColor);
pDynObj->setAttribute(LINE_SCALED, mLineScaled);
pDynObj->setAttribute(FILL_COLOR, mFillColor);
pDynObj->setAttribute(FILL_STYLE, mFillStyle);
pDynObj->setAttribute(HATCH_STYLE, mHatchStyle);
return pDynObj.release();
}
示例7: 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;
}
示例8: 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));
//.........这里部分代码省略.........
示例9: process
bool Orthorectification::process(int type, RasterElement *pDSM, GRID DSMGrid, double Geoid_Offset, int DSM_resampling)
{
StepResource pStep("Orthorectification Process", "app", "B4D426EC-E06D-11E1-83C8-42E56088709B");
pStep->addStep("Start","app", "B4D426EC-E06D-11E1-83C8-42E56088709B");
boxsize=0;
res_type = type;
if (res_type == 0)
{
boxsize=0;
}
else if (res_type == 1)
{
boxsize=1;
}
else if (res_type == 2)
{
boxsize=2;
}
else if (res_type == 3)
{
boxsize=3;
}
ProgressResource pResource("ProgressBar");
Progress *pProgress=pResource.get();
pProgress->setSettingAutoClose(false);
RasterDataDescriptor* pDesc = static_cast<RasterDataDescriptor*>(Image->getDataDescriptor());
FactoryResource<DataRequest> pRequest;
DataAccessor pSrcAcc = Image->getDataAccessor(pRequest.release());
RasterDataDescriptor* pDescDSM = static_cast<RasterDataDescriptor*>(pDSM->getDataDescriptor());
FactoryResource<DataRequest> pRequestDSM;
DataAccessor pDSMAcc = pDSM->getDataAccessor(pRequestDSM.release());
unsigned int N_Row = int(OrthoGrid.Y_Dim)+1;
unsigned int N_Col = int(OrthoGrid.X_Dim)+1;
// Check name of raster element //
Service<ModelServices> pModel;
vector<string> mCubeNames = pModel->getElementNames("RasterElement");
int NameIndex = 0, control=0;
stringstream out;
string OutputName=Image->getName();
string OutputName1 = OutputName.substr(0,OutputName.find_last_of("."));
while (control == 0)
{
control = 1;
OutputName = OutputName1+"_ortho_";
out << NameIndex;
OutputName.append(out.str()+".tiff");
for (unsigned int k=0; k<mCubeNames.size(); k++)
{
if (OutputName.compare(mCubeNames[k]) == 0) control = 0;
}
NameIndex++;
out.str("");
out.clear();
}
// Create output raster element and assoiciated descriptor and accessor //
ModelResource<RasterElement> pResultCube(RasterUtilities::createRasterElement(OutputName,N_Row ,N_Col, FLT4BYTES));
RasterDataDescriptor* pResultDesc = static_cast<RasterDataDescriptor*> (pResultCube->getDataDescriptor());
FactoryResource<DataRequest> pResultRequest;
pResultRequest->setWritable(true);
DataAccessor pDestAcc = pResultCube->getDataAccessor(pResultRequest.release());
double NodeLat, NodeLon, H_IJ=0;
//int DSM_I, DSM_J;
for (unsigned int row = 0; row < N_Row; ++row)
{
if (pProgress != NULL)
{
pProgress->updateProgress("Calculating result", row * 100 / N_Row, NORMAL);
}
if (!pDestAcc.isValid())
{
std::string msg = "Unable to access the cube data.";
pProgress->updateProgress(msg, 0, ERRORS);
pStep->finalize(Message::Failure, msg);
return false;
}
//.........这里部分代码省略.........
示例10: execute
bool pagauss::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
StepResource pStep("Tutorial 5", "app", "5EA0CC75-9E0B-4c3d-BA23-6DB7157BBD54");
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);
if (pDesc->getDataType() == INT4SCOMPLEX || pDesc->getDataType() == FLT8COMPLEX)
{
std::string msg = "Edge detection 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() +
"_Edge_Detection_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 (long signed 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 (long signed int col = 0; col < pDesc->getColumnCount(); ++col)
{
switchOnEncoding(pDesc->getDataType(), gauss, pDestAcc->getColumn(), pSrcAcc, row, col,
pDesc->getRowCount(), pDesc->getColumnCount());
pDestAcc->nextColumn();
}
pDestAcc->nextRow();
}
if (!isBatch())
{
Service<DesktopServices> pDesktop;
SpatialDataWindow* pWindow = static_cast<SpatialDataWindow*>(pDesktop->createWindow(pResultCube->getName(),
SPATIAL_DATA_WINDOW));
//.........这里部分代码省略.........
示例11: 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();
}
}
//.........这里部分代码省略.........
示例12: execute
bool NefImporter::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
if (pInArgList == NULL || pOutArgList == NULL)
{
return false;
}
//setting up mpRasterElement
parseInputArgList(pInArgList);
RasterElement* pRaster = getRasterElement();
VERIFY(pRaster != NULL);
RasterDataDescriptor *pDescriptor = dynamic_cast<RasterDataDescriptor*>(pRaster->getDataDescriptor());
VERIFY(pDescriptor != NULL);
FileDescriptor *pFileDescriptor = pDescriptor->getFileDescriptor();
VERIFY(pFileDescriptor != NULL);
//data accessor
//RED
DimensionDescriptor firstBand = pDescriptor->getActiveBand(0);
FactoryResource<DataRequest> pRequest;
pRequest->setInterleaveFormat(BSQ);
pRequest->setBands(firstBand, firstBand);
pRequest->setWritable(true);
DataAccessor firstBandDa = pRaster->getDataAccessor(pRequest.release());
//GREEN
DimensionDescriptor secondBand = pDescriptor->getActiveBand(1);
FactoryResource<DataRequest> qRequest;
qRequest->setInterleaveFormat(BSQ);
qRequest->setBands(secondBand, secondBand);
qRequest->setWritable(true);
DataAccessor secondBandDa = pRaster->getDataAccessor(qRequest.release());
//BLUE
DimensionDescriptor thirdBand = pDescriptor->getActiveBand(2);
FactoryResource<DataRequest> rRequest;
rRequest->setInterleaveFormat(BSQ);
rRequest->setBands(thirdBand, thirdBand);
rRequest->setWritable(true);
DataAccessor thirdBandDa = pRaster->getDataAccessor(rRequest.release());
std::string filename = pRaster->getFilename();
Progress *pProgress = getProgress();
FactoryResource<Filename> pFilename;
pFilename->setFullPathAndName(filename);
LibRaw RawProcessor;
putenv ((char*)"TZ=UTC");
#define P1 RawProcessor.imgdata.idata
#define S RawProcessor.imgdata.sizes
#define C RawProcessor.imgdata.color
#define T RawProcessor.imgdata.thumbnail
#define P2 RawProcessor.imgdata.other
#define OUT RawProcessor.imgdata.params
const char *fname=filename.c_str();
RawProcessor.open_file(fname);
// Let us unpack the image
if (RawProcessor.unpack() != LIBRAW_SUCCESS)
{
return false;
}
/*
unsigned int *r=NULL;
unsigned int *g=NULL;
unsigned int *b=NULL;
unsigned int *h=NULL;
*/
unsigned int *zero=0;
int row=0,col=0,r=0,c=0;
/*
r=(unsigned int*)(&RawProcessor.imgdata.image[i][0]);
g=(unsigned int*)(&RawProcessor.imgdata.image[i][1]);
b=(unsigned int*)(&RawProcessor.imgdata.image[i][2]);
h=(unsigned int*)(&RawProcessor.imgdata.image[i][3]);
*/
//secondBandDa->toPixel(row,col);
//thirdBandDa->toPixel(row,col);
unsigned short *pData=reinterpret_cast<unsigned short*>(pRaster->getRawData());
if (pData == NULL)
{
return NULL;
}
memcpy(pData, RawProcessor.imgdata.rawdata.raw_image, sizeof(unsigned short) * RawProcessor.imgdata.sizes.raw_height * RawProcessor.imgdata.sizes.raw_width);
//.........这里部分代码省略.........
示例13: 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));
//.........这里部分代码省略.........
示例14: 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);
//.........这里部分代码省略.........
示例15: 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);
//.........这里部分代码省略.........