本文整理汇总了C++中Match::SetRegion方法的典型用法代码示例。如果您正苦于以下问题:C++ Match::SetRegion方法的具体用法?C++ Match::SetRegion怎么用?C++ Match::SetRegion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match::SetRegion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nnFieldIterator
void PatchMatch<TImage, TPropagation, TRandomSearch>::RandomlyInitializeNNField()
{
itk::ImageRegion<2> internalRegion = ITKHelpers::GetInternalRegion(this->Image->GetLargestPossibleRegion(),
this->PatchRadius);
this->NNField->SetRegions(this->Image->GetLargestPossibleRegion());
this->NNField->Allocate();
itk::ImageRegionIteratorWithIndex<NNFieldType> nnFieldIterator(this->NNField, internalRegion);
while(!nnFieldIterator.IsAtEnd())
{
itk::ImageRegion<2> targetRegion = ITKHelpers::GetRegionInRadiusAroundPixel(nnFieldIterator.GetIndex(), this->PatchRadius);
itk::ImageRegion<2> randomRegion = PatchMatchHelpers::GetRandomRegionInRegion(internalRegion, this->PatchRadius);
Match randomMatch;
randomMatch.SetRegion(randomRegion);
randomMatch.SetScore(this->RandomSearchFunctor->GetPatchDistanceFunctor()->Distance(randomRegion, targetRegion));
nnFieldIterator.Set(randomMatch);
++nnFieldIterator;
}
}
示例2: ReadNNField
void ReadNNField(const std::string& fileName, const unsigned int patchRadius, NNFieldType* const nnField)
{
typedef itk::ImageFileReader<CoordinateImageType> NNFieldReaderType;
NNFieldReaderType::Pointer nnFieldReader = NNFieldReaderType::New();
nnFieldReader->SetFileName(fileName);
nnFieldReader->Update();
itk::ImageRegionIterator<CoordinateImageType>
imageIterator(nnFieldReader->GetOutput(),
nnFieldReader->GetOutput()->GetLargestPossibleRegion());
while(!imageIterator.IsAtEnd())
{
Match match;
itk::Index<2> center = {{static_cast<unsigned int>(imageIterator.Get()[0]),
static_cast<unsigned int>(imageIterator.Get()[1])}};
itk::ImageRegion<2> region = ITKHelpers::GetRegionInRadiusAroundPixel(center, patchRadius);
match.SetRegion(region);
nnField->SetPixel(imageIterator.GetIndex(), match);
++imageIterator;
}
}