本文整理汇总了C++中BinaryImage::setValue方法的典型用法代码示例。如果您正苦于以下问题:C++ BinaryImage::setValue方法的具体用法?C++ BinaryImage::setValue怎么用?C++ BinaryImage::setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryImage
的用法示例。
在下文中一共展示了BinaryImage::setValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char** argv )
{
trace.beginBlock ( "Example FMMErosion" );
trace.info() << "Args:";
for ( int i = 0; i < argc; ++i )
trace.info() << " " << argv[ i ];
trace.info() << endl;
DGtal::trace.beginBlock("image reading...");
//! [FMMErosionImageReading]
string imageFileName = examplesPath + "samples/cat10.vol";
trace.info() << imageFileName <<std::endl;
typedef ImageContainerBySTLVector<Domain, bool> BinaryImage;
BinaryImage binaryImage = VolReader<BinaryImage>::importVol( imageFileName);
//! [FMMErosionImageReading]
DGtal::trace.endBlock();
DGtal::trace.beginBlock("Search for a bel...");
//space and starting bel
//! [FMMErosionStartingBel]
KSpace ks;
Domain domain = binaryImage.domain();
ks.init( domain.lowerBound(), domain.upperBound(), true );
KSpace::SCell bel;
try {
//getting a bel
bel = Surfaces<KSpace>::findABel( ks, binaryImage, domain.size() );
trace.info() << "starting bel: " << bel << std::endl;
} catch (DGtal::InputException i) {
trace.emphase() << "starting bel not found" << std::endl;
return 0;
}
//! [FMMErosionStartingBel]
DGtal::trace.endBlock();
DGtal::trace.beginBlock("Implicit frontier...");
//implicit frontier
//! [FMMErosionTracking]
typedef functors::FrontierPredicate<KSpace, BinaryImage> SurfelPredicate;
typedef LightExplicitDigitalSurface<KSpace, SurfelPredicate> Frontier;
functors::SCellToIncidentPoints<KSpace> toIncidentPoints( ks );
std::pair<Point,Point> bpair = toIncidentPoints( bel );
SurfelPredicate surfelPredicate( ks, binaryImage,
binaryImage( bpair.first ),
binaryImage( bpair.second ) );
Frontier frontier( ks, surfelPredicate,
SurfelAdjacency<KSpace::dimension>( true ), bel );
//! [FMMErosionTracking]
DGtal::trace.endBlock();
const double maximalDistance = 3.0;
DGtal::trace.beginBlock("FMM...");
//! [FMMErosionFMMTypes]
typedef ImageContainerBySTLMap<Domain,double> DistanceImage;
typedef DigitalSetFromMap<DistanceImage> AcceptedPointSet;
typedef FMM<DistanceImage, AcceptedPointSet, BinaryImage > FMM;
//! [FMMErosionFMMTypes]
//! [FMMErosionFMMInit]
DistanceImage imageDistance( domain, 0.0 );
AcceptedPointSet pointSet( imageDistance );
functors::SCellToInnerPoint<KSpace> toInnerPoint( ks );
for (Frontier::SurfelConstIterator it = frontier.begin(), itEnd = frontier.end();
it != itEnd; ++it)
{
pointSet.insert( toInnerPoint(*it) );
imageDistance.setValue( toInnerPoint(*it), 0.5 );
}
//! [FMMErosionFMMInit]
//! [FMMErosionFMM]
FMM fmm( imageDistance, pointSet, binaryImage,
domain.size(), maximalDistance );
fmm.compute();
trace.info() << fmm << std::endl;
//! [FMMErosionFMM]
DGtal::trace.endBlock();
DGtal::trace.beginBlock("Erosion");
trace.info() << "Erosion of radius: " << maximalDistance << std::endl;
//! [FMMErosionErosion]
for (AcceptedPointSet::ConstIterator it = pointSet.begin(), itEnd = pointSet.end();
it != itEnd; ++it)
{
binaryImage.setValue(*it, 0);
}
//! [FMMErosionErosion]
//.........这里部分代码省略.........