当前位置: 首页>>代码示例>>C++>>正文


C++ RasterElement::getFilename方法代码示例

本文整理汇总了C++中RasterElement::getFilename方法的典型用法代码示例。如果您正苦于以下问题:C++ RasterElement::getFilename方法的具体用法?C++ RasterElement::getFilename怎么用?C++ RasterElement::getFilename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RasterElement的用法示例。


在下文中一共展示了RasterElement::getFilename方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: execute

bool SioImporter::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
   // Read the statistics from the file and set into the raster element
   RasterElement* pRaster = NULL;
   if (pInArgList != NULL)
   {
      pRaster = pInArgList->getPlugInArgValue<RasterElement>(Importer::ImportElementArg());
   }

   if (pRaster != NULL)
   {
      // Get the filename
      string filename = pRaster->getFilename();

      // Read the file
      FileResource pFile(filename.c_str(), "rb");

      SioFile sioFile;
      if (sioFile.deserialize(pFile.get()) == true)
      {
         if (sioFile.mOriginalVersion == 9 && isBatch())
         {
            //Since version 9 sio's are not officially supported
            //don't load them in batch to force users to load them
            //interactively which will show them the reason why.
            return false;
         }

         const RasterDataDescriptor* pDescriptor =
            dynamic_cast<const RasterDataDescriptor*>(pRaster->getDataDescriptor());

         if (pDescriptor != NULL && 
            RasterUtilities::isSubcube(pDescriptor, false) == false &&
            Service<SessionManager>()->isSessionLoading() == false)
         {
            const vector<DimensionDescriptor>& bands = pDescriptor->getBands();
            for (unsigned int i = 0; i < bands.size(); ++i)
            {
               Statistics* pStatistics = pRaster->getStatistics(bands[i]);
               if (pStatistics != NULL)
               {
                  // Bad values
                  if (i < sioFile.mBadValues.size())
                  {
                     vector<int> badValues = sioFile.mBadValues[i];
                     pStatistics->setBadValues(badValues);
                  }

                  // Min
                  if (i < sioFile.mStatMin.size())
                  {
                     double dMin = sioFile.mStatMin[i];
                     pStatistics->setMin(dMin);
                  }

                  // Max
                  if (i < sioFile.mStatMax.size())
                  {
                     double dMax = sioFile.mStatMax[i];
                     pStatistics->setMax(dMax);
                  }

                  // Average
                  if (i < sioFile.mStatAvg.size())
                  {
                     double dAverage = sioFile.mStatAvg[i];
                     pStatistics->setAverage(dAverage);
                  }

                  // Standard deviation
                  if (i < sioFile.mStatStdDev.size())
                  {
                     double dStdDev = sioFile.mStatStdDev[i];
                     pStatistics->setStandardDeviation(dStdDev);
                  }

                  // Percentiles
                  if (i < sioFile.mStatPercentile.size())
                  {
                     double* pPercentiles = sioFile.mStatPercentile[i];
                     pStatistics->setPercentiles(pPercentiles);
                  }

                  // Histogram
                  if ((i < sioFile.mStatBinCenter.size()) && (i < sioFile.mStatHistogram.size()))
                  {
                     double* pBinCenters = sioFile.mStatBinCenter[i];
                     unsigned int* pCounts = sioFile.mStatHistogram[i];
                     pStatistics->setHistogram(pBinCenters, pCounts);
                  }
               }
            }
         }
      }
   }

   return RasterElementImporterShell::execute(pInArgList, pOutArgList);
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:98,代码来源:SioImporter.cpp

示例2: 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);


//.........这里部分代码省略.........
开发者ID:pratikone,项目名称:gsoc2011-opticks,代码行数:101,代码来源:NefImporter.cpp


注:本文中的RasterElement::getFilename方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。