本文整理汇总了C++中KSpace::sLowerIncident方法的典型用法代码示例。如果您正苦于以下问题:C++ KSpace::sLowerIncident方法的具体用法?C++ KSpace::sLowerIncident怎么用?C++ KSpace::sLowerIncident使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KSpace
的用法示例。
在下文中一共展示了KSpace::sLowerIncident方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
trace.info() << "File extension not recognized: "<< extension << std::endl;
return 0;
}
if(extension=="vol" || extension=="pgm3d" || extension=="pgm3D"
#ifdef WITH_ITK
|| extension =="dcm"
#endif
){
trace.beginBlock( "Loading image into memory." );
#ifdef WITH_ITK
int dicomMin = vm["dicomMin"].as<int>();
int dicomMax = vm["dicomMax"].as<int>();
typedef DGtal::functors::Rescaling<int ,unsigned char > RescalFCT;
Image image = extension == "dcm" ? DicomReader< Image, RescalFCT >::importDicom( inputFilename,
RescalFCT(dicomMin,
dicomMax,
0, 255) ) :
GenericReader<Image>::import( inputFilename );
#else
Image image = GenericReader<Image>::import (inputFilename );
#endif
trace.info() << "Image loaded: "<<image<< std::endl;
trace.endBlock();
trace.beginBlock( "Construct the Khalimsky space from the image domain." );
Domain domain = image.domain();
KSpace ks;
bool space_ok = ks.init( domain.lowerBound(), domain.upperBound(), true );
if (!space_ok)
{
trace.error() << "Error in the Khamisky space construction."<<std::endl;
return 2;
}
trace.endBlock();
trace.beginBlock( "Wrapping a digital set around image. " );
typedef functors::IntervalForegroundPredicate<Image> ThresholdedImage;
ThresholdedImage thresholdedImage( image, thresholdMin, thresholdMax );
trace.endBlock();
trace.beginBlock( "Extracting boundary by scanning the space. " );
typedef KSpace::SurfelSet SurfelSet;
typedef SetOfSurfels< KSpace, SurfelSet > MySetOfSurfels;
typedef DigitalSurface< MySetOfSurfels > MyDigitalSurface;
MySurfelAdjacency surfAdj( true ); // interior in all directions.
MySetOfSurfels theSetOfSurfels( ks, surfAdj );
Surfaces<KSpace>::sMakeBoundary( theSetOfSurfels.surfelSet(),
ks, thresholdedImage,
domain.lowerBound(),
domain.upperBound() );
MyDigitalSurface digSurf( theSetOfSurfels );
trace.info() << "Digital surface has " << digSurf.size() << " surfels."
<< std::endl;
trace.endBlock();
trace.beginBlock( "Exporting everything." );
Board3D<Space,KSpace> board(ks);
board << SetMode3D( ks.unsigns( *digSurf.begin() ).className(), "Basic" );
typedef MyDigitalSurface::ConstIterator ConstIterator;
if ( mode == "BDRY" )
for ( ConstIterator it = digSurf.begin(), itE = digSurf.end(); it != itE; ++it )
board << ks.unsigns( *it );
else if ( mode == "INNER" )
for ( ConstIterator it = digSurf.begin(), itE = digSurf.end(); it != itE; ++it )
board << ks.sCoords( ks.sDirectIncident( *it, ks.sOrthDir( *it ) ) );
else if ( mode == "OUTER" )
for ( ConstIterator it = digSurf.begin(), itE = digSurf.end(); it != itE; ++it )
board << ks.sCoords( ks.sIndirectIncident( *it, ks.sOrthDir( *it ) ) );
else if (mode == "CLOSURE")
{
std::set<KSpace::Cell> container;
for ( ConstIterator it = digSurf.begin(), itE = digSurf.end(); it != itE; ++it )
{
container.insert( ks.unsigns( *it ) );
KSpace::SCells oneNeig = ks.sLowerIncident(*it);
//Processing linels
for(KSpace::SCells::ConstIterator itt = oneNeig.begin(), ittend = oneNeig.end(); itt != ittend; ++itt)
{
container.insert( ks.unsigns( *itt) );
KSpace::SCells oneNeig2 = ks.sLowerIncident(*itt);
//Processing pointels
for(KSpace::SCells::ConstIterator ittt = oneNeig2.begin(), itttend = oneNeig2.end(); ittt != itttend; ++ittt)
container.insert( ks.unsigns(*ittt) );
}
}
trace.info()<< "Exporting "<< container.size() << " cells"<<std::endl;
for(auto cell: container)
board << cell;
}
string outputFilename = vm["output"].as<std::string>();
board.saveOBJ(outputFilename, normalization);
trace.endBlock();
}
return 0;
}