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


C++ ColorMap::NumberPixels方法代码示例

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


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

示例1: writeARMap

void writeARMap(ColorMap*& map, const string& filename, const vector<EUVImage*>& images, ParameterSection& parameters, bool compressed)
{
	/*! Clean everything above the radius */
	map->nullifyAboveRadius(1.);
	
	/*! We get the map of aggregated AR */
	ColorMap* aggregatedMap = parameters["projection"].is_set() ? getAggregatedARMap(map, parameters["cleaning"], parameters["aggregation"], parameters["projection"]) : getAggregatedARMap(map, parameters["cleaning"], parameters["aggregation"], "none");
	
	if(parameters["aggregated"])
	{
		delete map;
		map = aggregatedMap;
	}
	else
	{
		/*! Color the pixels using the aggregated map */
		for (unsigned j = 0; j < aggregatedMap->NumberPixels(); ++j)
		{
			if(map->pixel(j) == 1)
			{
				map->pixel(j) = aggregatedMap->pixel(j);
			}
		}
	}
	
	#if defined DEBUG
	map->writeFits(filenamePrefix + "all.fits");
	#endif
	
	/*! Erase the small regions */
	if(parameters["useRawArea"])
		map->thresholdRegionsByRawArea(parameters["minimalSize"]);
	else
		map->thresholdRegionsByRealArea(parameters["minimalSize"]);

	#if defined DEBUG
	map->writeFits(filenamePrefix + "large.fits");
	#endif
	
	/*! We write the map of AR to the fits file */
	FitsFile file(filename, FitsFile::overwrite);
	map->writeFits(file, compressed ? FitsFile::compress : 0, "ActiveRegionMap");
	
	/*! We write some info about the map creation */
	Header header = map->getHeader();
	fillHeaderAR(header, parameters);
	file.writeHeader(header);
	
	/*! We get the regions */
	vector<Region*> regions = getRegions(map);
	
	/*! We write the regions to the fits file */
	file.writeTable("Regions");
	writeRegions(file, regions);
	
	/*! We get the chaincode and write them to the fits file */
	if(parameters["chaincodeMaxPoints"].as<int>() > 0)
	{
		#if defined DEBUG
		ColorMap chaincode_map(map);
		#endif
		
		file.writeTable("ChainCodes");
		for (unsigned r = 0; r < regions.size(); ++r)
		{
			vector<PixLoc> chaincode = regions[r]->chainCode(aggregatedMap, parameters["chaincodeMinPoints"], parameters["chaincodeMaxPoints"], parameters["chaincodeMaxDeviation"]);
			file.writeColumn(toString(regions[r]->Id(),7), chaincode);
		
			#if defined DEBUG
			for (unsigned c = 0; c < chaincode.size(); ++c)
			{
				chaincode_map.drawCircle(chaincode[c], 3, r+10);
			}
			#endif
		}
		#if defined DEBUG
		chaincode_map.writeFits(filenamePrefix + "chaincodes.fits");
		#endif
	}
	
	/*! We write intensities statistics relative to image */
	for(unsigned i = 0; i < images.size(); ++i)
	{
		EUVImage* image = images[i];
		/*! We get the stats of the AR */
		vector<RegionStats*> regions_stats =  getRegionStats(map, image, regions);
	
		/*! We write the AR Stats into the fits */
		file.writeTable(image->Channel()+"_ActiveRegionStats");
		writeRegions(file, regions_stats);
		
		/*! We write some info about the image in the header of the table */
		Header tableHeader;
		tableHeader.set("CHANNEL", image->Channel(), "Channel of the intensity image.");
		tableHeader.set("WAVELNTH", image->Wavelength(), "Wavelength of the intensity image.");
		tableHeader.set("DATE-OBS", image->ObservationDate(), "Observation Date of the intensity image.");
		tableHeader.set("INSTRUME", image->Instrument(), "Instrument of the intensity image.");
		const Header& imageHeader = image->getHeader();
		if(imageHeader.has("LVL_NUM"))
			tableHeader.set("LVL_NUM", imageHeader.get<float>("LVL_NUM"), "Level number of the intensity image.");
//.........这里部分代码省略.........
开发者ID:bmampaey,项目名称:SPoCA,代码行数:101,代码来源:ActiveRegion.cpp


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