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


C++ Mask2DPtr::Width方法代码示例

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


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

示例1: LineRemover

void StatisticalFlagger::LineRemover(Mask2DPtr mask, size_t maxTimeContamination, size_t maxFreqContamination)
{
	for(size_t x=0;x<mask->Width();++x)
	{
		size_t count = 0;
		for(size_t y=0;y<mask->Height();++y)
		{
			if(mask->Value(x,y))
				++count;
		}
		if(count > maxFreqContamination)
			FlagTime(mask, x);
	}

	for(size_t y=0;y<mask->Height();++y)
	{
		size_t count = 0;
		for(size_t x=0;x<mask->Width();++x)
		{
			if(mask->Value(x,y))
				++count;
		}
		if(count > maxTimeContamination)
			FlagFrequency(mask, y);
	}
}
开发者ID:jjdmol,项目名称:LOFAR,代码行数:26,代码来源:statisticalflagger.cpp

示例2: EnlargeFlags

void StatisticalFlagger::EnlargeFlags(Mask2DPtr mask, size_t timeSize, size_t frequencySize)
{
	Mask2DCPtr old = Mask2D::CreateCopy(mask);
	for(size_t y=0;y<mask->Height();++y)
	{
		size_t top, bottom;
		if(y > frequencySize)
			top = y - frequencySize;
		else
			top = 0;
		if(y + frequencySize < mask->Height() - 1)
			bottom = y + frequencySize;
		else
			bottom = mask->Height() - 1;
		
		for(size_t x=0;x<mask->Width();++x)
		{
			size_t left, right;
			if(x > timeSize)
				left = x - timeSize;
			else
				left = 0;
			if(x + timeSize < mask->Width() - 1)
				right = x + timeSize;
			else
				right = mask->Width() - 1;
			
			if(SquareContainsFlag(old, left, top, right, bottom))
				mask->SetValue(x, y, true);
		}
	}
}
开发者ID:jjdmol,项目名称:LOFAR,代码行数:32,代码来源:statisticalflagger.cpp

示例3: DensityTimeFlagger

void StatisticalFlagger::DensityTimeFlagger(Mask2DPtr mask, num_t minimumGoodDataRatio)
{
	num_t width = 2.0;
	size_t iterations = 0, step = 1;
	bool reverse = false;
	
	//"sums represents the number of flags in a certain range
	int **sums = new int*[mask->Height()];
	
	// flagMarks are integers that represent the number of times an area is marked as the
	// start or end of a flagged area. For example, if flagMarks[0][0] = 0, it is not the start or
	// end of an area. If it is 1, it is the start. If it is -1, it is the end. A range of
	// [2 0 -1 -1 0] produces a flag mask [T T T T F].
	int **flagMarks = new int*[mask->Height()];
	
	for(size_t y=0;y<mask->Height();++y)
	{
		sums[y] = new int[mask->Width()];
		flagMarks[y] = new int[mask->Width()];
		for(size_t x=0;x<mask->Width();++x)
			flagMarks[y][x] = 0;
	}
	
	MaskToInts(mask, sums);
	
	while(width < mask->Width())
	{
		++iterations;
		SumToLeft(mask, sums, (size_t) width, step, reverse);
		const int maxFlagged = (int) floor((1.0-minimumGoodDataRatio)*(num_t)(width));
		ThresholdTime(mask, flagMarks, sums, maxFlagged, (size_t) width);
	
		num_t newWidth = width * 1.05;
		if((size_t) newWidth == (size_t) width)
			newWidth = width + 1.0;
		step = (size_t) (newWidth - width);
		width = newWidth;
		reverse = !reverse;
	}
	
	ApplyMarksInTime(mask, flagMarks);

	for(size_t y=0;y<mask->Height();++y)
	{
		delete[] sums[y];
		delete[] flagMarks[y];
	}
	delete[] sums;
	delete[] flagMarks;
}
开发者ID:jjdmol,项目名称:LOFAR,代码行数:50,代码来源:statisticalflagger.cpp

示例4: FlagFrequency

void StatisticalFlagger::FlagFrequency(Mask2DPtr mask, size_t y)
{
	for(size_t x=0;x<mask->Width();++x)
	{
		mask->SetValue(x, y, true);
	}
}
开发者ID:jjdmol,项目名称:LOFAR,代码行数:7,代码来源:statisticalflagger.cpp

示例5: DensityFrequencyFlagger

void StatisticalFlagger::DensityFrequencyFlagger(Mask2DPtr mask, num_t minimumGoodDataRatio)
{
	num_t width = 2.0;
	size_t iterations = 0, step = 1;
	bool reverse = false;
	
	Mask2DPtr newMask = Mask2D::CreateCopy(mask);
	
	int **sums = new int*[mask->Height()];
	int **flagMarks = new int*[mask->Height()];
	
	for(size_t y=0;y<mask->Height();++y)
	{
		sums[y] = new int[mask->Width()];
		flagMarks[y] = new int[mask->Width()];
		for(size_t x=0;x<mask->Width();++x)
			flagMarks[y][x] = 0;
	}
	
	MaskToInts(mask, sums);
	
	while(width < mask->Height())
	{
		++iterations;
		SumToTop(mask, sums, (size_t) width, step, reverse);
		const int maxFlagged = (int) floor((1.0-minimumGoodDataRatio)*(num_t)(width));
		ThresholdFrequency(mask, flagMarks, sums, maxFlagged, (size_t) width);
	
		num_t newWidth = width * 1.05;
		if((size_t) newWidth == (size_t) width)
			newWidth = width + 1.0;
		step = (size_t) (newWidth - width);
		width = newWidth;
		reverse = !reverse;
	}

	ApplyMarksInFrequency(mask, flagMarks);

	for(size_t y=0;y<mask->Height();++y)
	{
		delete[] sums[y];
		delete[] flagMarks[y];
	}
	delete[] sums;
	delete[] flagMarks;
}
开发者ID:jjdmol,项目名称:LOFAR,代码行数:46,代码来源:statisticalflagger.cpp

示例6: DilateFlagsVertically

void StatisticalFlagger::DilateFlagsVertically(Mask2DPtr mask, size_t frequencySize)
{
	if(frequencySize != 0)
	{
		Mask2DPtr destination = Mask2D::CreateUnsetMaskPtr(mask->Width(), mask->Height());
		if(frequencySize > mask->Height()) frequencySize = mask->Height();
		const int intSize = (int) frequencySize;
		
		for(size_t x=0;x<mask->Width();++x)
		{
			int dist = intSize + 1;
			for(size_t y=0;y<frequencySize;++y)
			{
				if(mask->Value(x, y))
					dist = - intSize;
				dist++;
			}
			for(size_t y=0;y<mask->Height() - frequencySize;++y)
			{
				if(mask->Value(x, y + frequencySize))
					dist = -intSize;
				if(dist <= intSize)
				{
					destination->SetValue(x, y, true);
					dist++;
				} else {
					destination->SetValue(x, y, false);
				}
			}
			for(size_t y=mask->Height() - frequencySize;y<mask->Height();++y)
			{
				if(dist <= intSize)
				{
					destination->SetValue(x, y, true);
					dist++;
				} else {
					destination->SetValue(x, y, false);
				}
			}
		}
		mask->Swap(destination);
	}
}
开发者ID:jjdmol,项目名称:LOFAR,代码行数:43,代码来源:statisticalflagger.cpp

示例7: ApplyMarksInFrequency

void StatisticalFlagger::ApplyMarksInFrequency(Mask2DPtr mask, int **flagMarks)
{
	for(size_t x=0;x<mask->Width();++x)
	{
		int startedCount = 0;
		for(size_t y=0;y<mask->Height();++y)
		{
			startedCount += flagMarks[y][x];
			if(startedCount > 0)
				mask->SetValue(x, y, true);
		}
	}
}
开发者ID:jjdmol,项目名称:LOFAR,代码行数:13,代码来源:statisticalflagger.cpp

示例8: VerticalSumThresholdLarge

void ThresholdMitigater::VerticalSumThresholdLarge(Image2DCPtr input, Mask2DPtr mask, num_t threshold)
{
	Mask2DPtr maskCopy = Mask2D::CreateCopy(mask);
	const size_t width = mask->Width(), height = mask->Height();
	if(Length <= height)
	{
		for(size_t x=0;x<width;++x)
		{
			num_t sum = 0.0;
			size_t count = 0, yTop, yBottom;

			for(yBottom=0;yBottom<Length-1;++yBottom)
			{
				if(!mask->Value(x, yBottom))
				{
					sum += input->Value(x, yBottom);
					++count;
				}
			}

			yTop = 0;
			while(yBottom < height)
			{
				// add the sample at the bottom
				if(!mask->Value(x, yBottom))
				{
					sum += input->Value(x, yBottom);
					++count;
				}
				// Check
				if(count>0 && fabs(sum/count) > threshold)
				{
					for(size_t i=0;i<Length;++i)
						maskCopy->SetValue(x, yTop + i, true);
				}
				// subtract the sample at the top
				if(!mask->Value(x, yTop))
				{
					sum -= input->Value(x, yTop);
					--count;
				}
				++yTop;
				++yBottom;
			}
		}
	}
	mask->Swap(maskCopy);
}
开发者ID:pkgw,项目名称:aoflagger,代码行数:48,代码来源:thresholdmitigater.cpp

示例9: HorizontalSumThresholdLarge

void ThresholdMitigater::HorizontalSumThresholdLarge(Image2DCPtr input, Mask2DPtr mask, num_t threshold)
{
	Mask2DPtr maskCopy = Mask2D::CreateCopy(mask);
	const size_t width = mask->Width(), height = mask->Height();
	if(Length <= width)
	{
		for(size_t y=0;y<height;++y)
		{
			num_t sum = 0.0;
			size_t count = 0, xLeft, xRight;

			for(xRight=0;xRight<Length-1;++xRight)
			{
				if(!mask->Value(xRight, y))
				{
					sum += input->Value(xRight, y);
					count++;
				}
			}

			xLeft = 0;
			while(xRight < width)
			{
				// add the sample at the right
				if(!mask->Value(xRight, y))
				{
					sum += input->Value(xRight, y);
					++count;
				}
				// Check
				if(count>0 && fabs(sum/count) > threshold)
				{
					maskCopy->SetHorizontalValues(xLeft, y, true, Length);
				}
				// subtract the sample at the left
				if(!mask->Value(xLeft, y))
				{
					sum -= input->Value(xLeft, y);
					--count;
				}
				++xLeft;
				++xRight;
			}
		}
	}
	mask->Swap(maskCopy);
}
开发者ID:pkgw,项目名称:aoflagger,代码行数:47,代码来源:thresholdmitigater.cpp


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