本文整理汇总了C++中Viewer3D::show方法的典型用法代码示例。如果您正苦于以下问题:C++ Viewer3D::show方法的具体用法?C++ Viewer3D::show怎么用?C++ Viewer3D::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Viewer3D
的用法示例。
在下文中一共展示了Viewer3D::show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char** argv )
{
QApplication application(argc,argv);
Viewer3D viewer;
viewer.show();
Point p1( 0, 0, 0 );
Point p2( 20, 20, 20 );
Domain domain(p1, p2);
DigitalSet shape_set( domain );
Shapes<Domain>::addNorm2Ball( shape_set, Point( 10, 10, 10 ), 7 );
viewer << SetMode3D( shape_set.styleName(), "Both" );
viewer << shape_set;
viewer << CustomColors3D(Color(250, 200,0, 100),Color(250, 200,0, 20));
viewer << SetMode3D( p1.styleName(), "Paving" );
//viewer << ClippingPlane(1,0,0,-4.9);
viewer << ClippingPlane(0,1,0.3,-10);
viewer << Viewer3D::updateDisplay;
return application.exec();
}
示例2: main
int main( int argc, char** argv )
{
std::string inputFilename = examplesPath + "samples/pointList3d.pl";
QApplication application(argc,argv);
Viewer3D<> viewer;
viewer.show();
// Importing the 3d set of points contained with the default index (0, 1, 2);
vector<Z3i::Point> vectPoints= PointListReader<Z3i::Point>::getPointsFromFile(inputFilename);
for(unsigned int i=0; i<vectPoints.size();i++){
viewer << vectPoints.at(i);
}
// Importing the 3d set of points with another index definition (0, 2, 1);
vector<unsigned int> vPos;
vPos.push_back(0);
vPos.push_back(2);
vPos.push_back(1);
vectPoints= PointListReader<Z3i::Point>::getPointsFromFile(inputFilename, vPos);
viewer<< CustomColors3D(Color(255,0,0), Color(255,0,0));
for(unsigned int i=0; i<vectPoints.size();i++){
viewer << vectPoints.at(i);
}
viewer << Viewer3D<>::updateDisplay;
return application.exec();
}
示例3: testSphericalViewerInteger
bool testSphericalViewerInteger(int argc, char **argv)
{
QApplication application(argc,argv);
trace.beginBlock ( "Testing Spherical Accumulator Viewer with Integer numbers..." );
typedef Z3i::Vector Vector;
SphericalAccumulator<Vector> accumulator(15);
trace.info()<< accumulator << std::endl;
for(unsigned int i=0; i< 10000; i++)
accumulator.addDirection( Vector (1+(rand()-RAND_MAX/2),
(1+(rand()-RAND_MAX/2)),
(1+(rand()-RAND_MAX/2))));
Viewer3D<> viewer;
viewer.show();
Vector a,b,c,d;
Display3DFactory<Space,KSpace>::draw(viewer,accumulator, Z3i::RealVector(1.0,1.0,1.0), 3.0);
trace.info() << "Bin values: ";
for(SphericalAccumulator<Vector>::ConstIterator it=accumulator.begin(), itend=accumulator.end();
it != itend;
++it)
trace.info() << *it<<" ";
trace.info() << std::endl;
trace.info() << accumulator<<std::endl;
viewer << Viewer3D<>::updateDisplay;
bool res = application.exec();
trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
trace.endBlock();
return res ? 0 : 1;
}
示例4: main
int main( int argc, char** argv )
{
QApplication application(argc,argv);
Viewer3D<> viewer;
viewer.setWindowTitle("simpleViewer");
viewer.show();
trace.beginBlock ( "Testing Polygon 3D display in Viewer3D" );
std::vector<Z3i::RealPoint> polyg1;
polyg1.push_back(Z3i::RealPoint(0,0,0));
polyg1.push_back(Z3i::RealPoint(0,1,0));
polyg1.push_back(Z3i::RealPoint(1,1,0));
viewer.addPolygon(polyg1);
viewer.createNewPolygonList("hop");
std::vector<Z3i::RealPoint> polyg2;
polyg2.push_back(Z3i::RealPoint(0,10,0));
polyg2.push_back(Z3i::RealPoint(0,11,0));
polyg2.push_back(Z3i::RealPoint(11,11,0));
viewer.addPolygon(polyg2);
viewer << Viewer3D<>::updateDisplay;
bool res = application.exec();
trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
trace.endBlock();
return res ? 0 : 1;
}
示例5: main
int main( int argc, char** argv )
{
std::string inputFilename = examplesPath + "samples/Al.100.vol";
QApplication application(argc,argv);
Viewer3D viewer;
viewer.show();
typedef ImageSelector < Z3i::Domain, int>::Type Image;
// Image image = VolReader<Image>::VolReader<Image>::importVol(inputFilename);
Image image = VolReader<Image>::importVol(inputFilename);
Z3i::DigitalSet set3d (image.domain());
SetFromImage<Z3i::DigitalSet>::append<Image>(set3d, image, 0,255);
Z3i::Object18_6 obj3d (Z3i::dt18_6, set3d);
Z3i::Object18_6 border = obj3d.border();
viewer << border;
viewer << ClippingPlane(0,1,0, -40) << Display3D::updateDisplay;
//viewer << ClippingPlane(0,-1,0, 70)<< Viewer3D::updateDisplay;
//viewer << ClippingPlane(1,0.1,0, -50)<< Viewer3D::updateDisplay;
//viewer << ClippingPlane(1,0.1,0, -50)<< Viewer3D::updateDisplay;
return application.exec();
}
示例6: main
int main( int argc, char** argv )
{
if ( argc < 4 )
{
usage( argc, argv );
return 1;
}
std::string inputFilename = argv[ 1 ];
unsigned int minThreshold = atoi( argv[ 2 ] );
unsigned int maxThreshold = atoi( argv[ 3 ] );
//! [volScanBoundary-readVol]
trace.beginBlock( "Reading vol file into an image." );
typedef ImageSelector < Domain, int>::Type Image;
Image image = VolReader<Image>::importVol(inputFilename);
DigitalSet set3d (image.domain());
SetFromImage<DigitalSet>::append<Image>(set3d, image,
minThreshold, maxThreshold);
trace.endBlock();
//! [volScanBoundary-readVol]
//! [volScanBoundary-KSpace]
trace.beginBlock( "Construct the Khalimsky space from the image domain." );
KSpace ks;
bool space_ok = ks.init( image.domain().lowerBound(),
image.domain().upperBound(), true );
if (!space_ok)
{
trace.error() << "Error in the Khamisky space construction."<<std::endl;
return 2;
}
trace.endBlock();
//! [volScanBoundary-KSpace]
//! [volScanBoundary-ExtractingSurface]
trace.beginBlock( "Extracting boundary by scanning the space. " );
KSpace::SCellSet boundary;
Surfaces<KSpace>::sMakeBoundary( boundary, ks, set3d,
image.domain().lowerBound(),
image.domain().upperBound() );
trace.endBlock();
//! [volScanBoundary-ExtractingSurface]
//! [volScanBoundary-DisplayingSurface]
trace.beginBlock( "Displaying surface in Viewer3D." );
QApplication application(argc,argv);
Viewer3D viewer;
viewer.show();
viewer << CustomColors3D(Color(250, 0, 0 ), Color( 128, 128, 128 ) );
unsigned long nbSurfels = 0;
for ( KSpace::SCellSet::const_iterator it = boundary.begin(),
it_end = boundary.end(); it != it_end; ++it, ++nbSurfels )
viewer << *it;
viewer << Viewer3D::updateDisplay;
trace.info() << "nb surfels = " << nbSurfels << std::endl;
trace.endBlock();
return application.exec();
//! [volScanBoundary-DisplayingSurface]
}
示例7: main
int main( int argc, char** argv )
{
//! [MeshUseInitDisplay]
QApplication application(argc,argv);
Viewer3D<> viewer;
viewer.show();
//! [MeshUseInitDisplay]
//! [MeshUseMeshCreation]
// A mesh is constructed and faces are added from the vertex set.
//! [MeshUseMeshConstructor]
Mesh<Point> aMesh(true);
//! [MeshUseMeshConstructor]
//! [MeshUseMeshAddingPoints]
aMesh.addVertex(Point(0,0,0));
aMesh.addVertex(Point(1,0,0));
aMesh.addVertex(Point(1,1,0));
//! [MeshUseMeshAddingPoints]
aMesh.addVertex(Point(0,0,1));
aMesh.addVertex(Point(1,0,1));
aMesh.addVertex(Point(1,1,1));
aMesh.addVertex(Point(0,1,1));
aMesh.addVertex(Point(0,1,0));
aMesh.addVertex(Point(0,2,0));
aMesh.addVertex(Point(0,3,1));
aMesh.addVertex(Point(0,2,2));
aMesh.addVertex(Point(0,1,2));
aMesh.addVertex(Point(0,0,1));
//! [MeshUseMeshAddingBasicFaces]
aMesh.addTriangularFace(0, 1, 2, Color(150,0,150,104));
aMesh.addQuadFace(6,5,4,3, Color::Blue);
//! [MeshUseMeshAddingBasicFaces]
//! [MeshUseMeshAddingPolygonalFaces]
vector<unsigned int> listIndex;
listIndex.push_back(7);
listIndex.push_back(8);
listIndex.push_back(9);
listIndex.push_back(10);
listIndex.push_back(11);
listIndex.push_back(12);
aMesh.addFace(listIndex, Color(150,150,0,54));
//! [MeshUseMeshAddingPolygonalFaces]
//! [MeshUseMeshCreation]
//! [MeshUseDisplay]
viewer.setLineColor(Color(150,0,0,254));
viewer << aMesh;
viewer << Viewer3D<>::updateDisplay;
//! [MeshUseDisplay]
bool res = application.exec();
FATAL_ERROR(res);
return true;
}
示例8: main
int main( int argc, char** argv )
{
typedef DGtal::ImageContainerBySTLVector< DGtal::Z2i::Domain, unsigned char> imageNG;
typedef DGtal::ImageContainerBySTLVector< DGtal::Z2i::Domain, unsigned int> imageCol;
QApplication application(argc,argv);
Viewer3D<> viewer;
viewer.setWindowTitle("simpleViewer");
viewer.show();
Point p1( 0, 0, 0 );
Point p2( 125, 188, 0 );
Point p3( 30, 30, 30 );
std::string filename = testPath + "samples/church-small.pgm";
std::string filename3 = testPath + "samples/color64.ppm";
imageNG image = DGtal::PGMReader<imageNG>::importPGM(filename);
imageNG image2 = DGtal::GenericReader<imageNG>::import(filename);
imageCol image3 = DGtal::GenericReader<imageCol>::import(filename3);
viewer << DGtal::AddTextureImage2DWithFunctor<imageNG, hueFct , Z3i::Space, Z3i::KSpace>(image2, hueFct(), Viewer3D<>::RGBMode );
viewer << image;
viewer << DGtal::AddTextureImage2DWithFunctor<imageCol, DefaultFunctor, Z3i::Space, Z3i::KSpace>(image3, DefaultFunctor(), Viewer3D<>::RGBMode );
viewer << DGtal::UpdateImagePosition<Z3i::Space, Z3i::KSpace>(0, Viewer3D<>::xDirection, 50, 50, 50 );
viewer << DGtal::UpdateImagePosition<Z3i::Space, Z3i::KSpace>(2, Viewer3D<>::yDirection, 0, 0, 0);
viewer << SetMode3D( image.domain().className(), "BoundingBox" );
viewer << image.domain();
viewer << DGtal::Update2DDomainPosition<Z3i::Space, Z3i::KSpace>(0, Viewer3D<>::xDirection, 0, 0, 0);
for(unsigned int i= 0; i< 10; i++){
if(i%4==0){
viewer << SetMode3D( image.className(), "" );
}else if(i%4==1){
viewer << SetMode3D( image.className(), "BoundingBox" );
}else if(i%4==2){
viewer << SetMode3D( image.className(), "Grid" );
}else if(i%4==3){
viewer << SetMode3D( image.className(), "InterGrid" );
}
viewer << image;
viewer << DGtal::UpdateImageData<imageNG>(i+3, image, i*50, i*50, i*50);
}
viewer << p1 << p2 << p3;
viewer << Viewer3D<>::updateDisplay;
bool res = application.exec();
trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
trace.endBlock();
return res ? 0 : 1;
}
示例9: main
int main( int argc, char** argv )
{
trace.beginBlock ( "Testing class MeshFromPointsDisplay" );
trace.info() << "Args:";
for ( int i = 0; i < argc; ++i )
trace.info() << " " << argv[ i ];
trace.info() << endl;
//! [MeshFromPointsUseInitDisplay]
QApplication application(argc,argv);
Viewer3D viewer;
viewer.show();
//! [MeshFromPointsUseInitDisplay]
//! [MeshFromPointsUseMeshCreation]
MeshFromPoints<Point> aMesh(true);
aMesh.addVertex(Point(0,0,0));
aMesh.addVertex(Point(1,0,0));
aMesh.addVertex(Point(1,1,0));
aMesh.addVertex(Point(0,0,1));
aMesh.addVertex(Point(1,0,1));
aMesh.addVertex(Point(1,1,1));
aMesh.addVertex(Point(0,1,1));
aMesh.addVertex(Point(0,1,0));
aMesh.addVertex(Point(0,2,0));
aMesh.addVertex(Point(0,3,1));
aMesh.addVertex(Point(0,2,2));
aMesh.addVertex(Point(0,1,2));
aMesh.addVertex(Point(0,0,1));
aMesh.addTriangularFace(0, 1, 2, Color(150,0,150,104));
aMesh.addQuadFace(6,5,4,3, Color::Blue);
vector<unsigned int> listIndex;
listIndex.push_back(7);
listIndex.push_back(8);
listIndex.push_back(9);
listIndex.push_back(10);
listIndex.push_back(11);
listIndex.push_back(12);
aMesh.addFace(listIndex, Color(150,150,0,54));
//! [MeshFromPointsUseMeshCreation]
//! [MeshFromPointsUseDisplay]
viewer.setLineColor(Color(150,0,0,254));
viewer << aMesh;
viewer << Viewer3D::updateDisplay;
bool res = application.exec();
//! [MeshFromPointsUseDisplay]
trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
trace.endBlock();
return res ? 0 : 1;
}
示例10: main
int main( int argc, char** argv )
{
std::string inputFilename = examplesPath + "samples/Al.100.vol";
QApplication application(argc,argv);
Viewer3D<> viewer;
viewer.show();
typedef ImageSelector < Z3i::Domain, int>::Type Image;
Image image = VolReader<Image>::importVol(inputFilename);
Z3i::DigitalSet set3d (image.domain());
SetFromImage<Z3i::DigitalSet>::append<Image>(set3d, image, 0,255);
viewer << SetMode3D(image.domain().className(), "BoundingBox");
viewer << set3d << image.domain() << Viewer3D<>::updateDisplay;
return application.exec();
}
示例11: main
int main( int argc, char** argv )
{
typedef DGtal::ImageContainerBySTLVector< DGtal::Z3i::Domain, unsigned char> Image3D;
QApplication application(argc,argv);
Viewer3D<> viewer;
viewer.setWindowTitle("simpleViewer");
viewer.show();
trace.beginBlock("Testing Viewer with display of 3D Image ");
Point p1( 0, 0, 0 );
Point p2( 125, 188, 0 );
Point p3( 30, 30, 30 );
std::string filename = testPath + "samples/lobsterCroped.vol";
viewer.setFillTransparency(150);
Image3D image3d = VolReader<Image3D>::importVol(filename);
viewer << SetMode3D(image3d.className(), "BoundingBox");
viewer << DGtal::AddTextureImage3DWithFunctor<Image3D, hueFct , Space, KSpace>(image3d, hueFct(),Viewer3D<>::RGBMode );
viewer.setFillTransparency(255);
// Extract some slice images:
// Get the 2D domain of the slice:
DGtal::Projector<DGtal::Z2i::Space> invFunctor; invFunctor.initRemoveOneDim(2);
DGtal::Z2i::Domain domain2D(invFunctor(image3d.domain().lowerBound()),
invFunctor(image3d.domain().upperBound()));
typedef DGtal::ConstImageAdapter<Image3D, DGtal::Z2i::Domain, DGtal::Projector< Z3i::Space>,
Image3D::Value, DGtal::DefaultFunctor > SliceImageAdapter;
DGtal::DefaultFunctor idV;
DGtal::Projector<DGtal::Z3i::Space> aSliceFunctorZ(5); aSliceFunctorZ.initAddOneDim(2);
SliceImageAdapter sliceImageZ(image3d, domain2D, aSliceFunctorZ, idV);
viewer << sliceImageZ;
viewer << DGtal::UpdateImagePosition<Space, KSpace>(6, Viewer3D<>::zDirection, 0.0, 0.0, -10.0);
viewer << p1 << p2 << p3;
viewer << Viewer3D<>::updateDisplay;
bool res = application.exec();
trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
trace.endBlock();
return res ? 0 : 1;
}
示例12: main
int main( int argc, char** argv )
{
QApplication application(argc,argv);
//! [DigiHelixConstr]
typedef EllipticHelix < Space > MyHelix;
typedef NaiveParametricCurveDigitizer3D < MyHelix > DigitizerHelix;
typedef NaiveParametricCurveDigitizer3D < MyHelix >::DigitalCurve MyDigitalCurve;
typedef NaiveParametricCurveDigitizer3D < MyHelix >::MetaData MyMetaData;
//! [DigiHelixConstr]
trace.info() << "exampleParamCurve3dDigitization" << endl;
Viewer3D<> viewer;
//! [DigiHelixInit]
MyDigitalCurve digitalCurve;
MyMetaData metaData;
MyHelix helix( 15, 10, 1 );
DigitizerHelix digitize;
digitize.init ( M_PI / 2., ( MyHelix::getPeriod() * 10. ) + M_PI / 2., 0.0001 );
digitize.attach ( &helix );
//! [DigiHelixInit]
//! [DigiHelixComp]
digitize.digitize( back_insert_iterator < MyDigitalCurve> ( digitalCurve ), back_insert_iterator < MyMetaData > ( metaData ) );
//! [DigiHelixComp]
trace.info() << "Number of points: " << digitalCurve.size () << " number of metadata: " << metaData.size () << endl;
viewer.show();
//! [DigiHelixMetadata]
for ( unsigned int i = 0; i < digitalCurve.size ( ); i++ )
{
if ( findMainAxis ( helix, metaData.at ( i ).first ) == 0 )
viewer.setFillColor ( Color ( 255, 0, 0, 128 ) );
if ( findMainAxis ( helix, metaData.at ( i ).first ) == 1 )
viewer.setFillColor ( Color ( 0, 255, 0, 128 ) );
if ( findMainAxis ( helix, metaData.at ( i ).first ) == 2 )
viewer.setFillColor ( Color ( 0, 0, 255, 128 ) );
viewer << SetMode3D ( digitalCurve.at ( i ).className ( ), "PavingWired" ) << digitalCurve.at ( i );
}
//! [DigiHelixMetadata]
viewer << Viewer3D<>::updateDisplay;
return application.exec();
}
示例13: main
int main( int argc, char** argv )
{
QApplication application(argc,argv);
typedef DGtal::SpaceND<3, DGtal::int32_t> MySpace;
typedef MySpace::Point MyPoint;
typedef HyperRectDomain<MySpace> MyDomain;
MyPoint p1( 0, 0, 0 );
MyPoint p2( 5, 5 ,5 );
MyPoint p3( 2, 3, 4 );
MyDomain domain( p1, p2 );
Viewer3D viewer; // for 3D visualization
viewer.show();
viewer << domain;
viewer << p1 << p2 << p3;
viewer<< Viewer3D::updateDisplay;
return application.exec();
}
示例14: main
int main( int argc, char** argv )
{
typedef PointVector<3,int> Point;
typedef std::vector<Point>::iterator Iterator;
typedef ArithmeticalDSS3d<Iterator,int,4> SegmentComputer;
typedef SaturatedSegmentation<SegmentComputer> Decomposition;
string inputFilename = examplesPath + "samples/sinus.dat";
vector<Point> sequence = PointListReader<Point>::getPointsFromFile(inputFilename);
SegmentComputer algo;
Decomposition theDecomposition(sequence.begin(), sequence.end(), algo);
///////////////////////////////////
//display
bool flag = true;
#ifdef WITH_VISU3D_QGLVIEWER
QApplication application(argc,argv);
Viewer3D viewer;
viewer.show();
Point p;
viewer << SetMode3D(p.className(), "Grid");
unsigned int c = 0;
Decomposition::SegmentComputerIterator i = theDecomposition.begin();
for ( ; i != theDecomposition.end(); ++i) {
SegmentComputer currentSegmentComputer(*i);
viewer << SetMode3D(currentSegmentComputer.className(), "Points");
viewer << currentSegmentComputer;
viewer << SetMode3D(currentSegmentComputer.className(), "BoundingBox");
viewer << currentSegmentComputer;
//cerr << currentSegmentComputer << endl;
c++;
}
viewer << Viewer3D::updateDisplay;
flag = application.exec();
#endif
return flag;
}
示例15: main
int main( int argc, char** argv )
{
QApplication application(argc,argv);
Viewer3D<> viewer;
viewer.show();
//! [ImportOFFfile]
std::string inputFilename = examplesPath + "samples/tref.off";
// Since the input points are not necessary integers we use the PointD3D from Display3D.
Mesh<Viewer3D<>::RealPoint> anImportedMesh;
anImportedMesh << inputFilename;
//! [ImportOFFfile]
trace.info()<< "importating done..."<< endl;
//! [displayOFFfile]
viewer.setLineColor(DGtal::Color(150,0,0,254));
viewer << anImportedMesh;
viewer << Viewer3D<>::updateDisplay;
//! [displayOFFfile]
return application.exec();
}