Ejemplo n.º 1
0
void displayDSS2d( Viewer3D<space, kspace> & viewer,
		   const KSpace & ks, const StandardDSS6Computer & dss3d,
		   const DGtal::Color & color2d )
{
  typedef typename StandardDSS6Computer::ConstIterator ConstIterator3d;
  typedef typename StandardDSS6Computer::ArithmeticalDSSComputer2d ArithmeticalDSSComputer2d;
  typedef typename ArithmeticalDSSComputer2d::ConstIterator ConstIterator2d;
  typedef typename ArithmeticalDSSComputer2d::Point Point2d;
  typedef typename KSpace::Cell Cell;
  typedef typename KSpace::Point Point3d;
  typedef DGtal::PointVector<2,double> PointD2d;
  typedef typename Display3D<>::BallD3D PointD3D;
  Point3d b = ks.lowerBound();
  for ( DGtal::Dimension i = 0; i < 3; ++i )
    {
      const typename ArithmeticalDSSComputer2d::Primitive & dss2d 
	= dss3d.arithmeticalDSS2d( i ).primitive();
      // draw 2D bounding boxes for each arithmetical dss 2D.
      std::vector<PointD2d> pts2d;
      pts2d.push_back( dss2d.project(dss2d.back(), dss2d.Uf()) );
      pts2d.push_back( dss2d.project(dss2d.back(), dss2d.Lf()) );
      pts2d.push_back( dss2d.project(dss2d.front(), dss2d.Lf()) );
      pts2d.push_back( dss2d.project(dss2d.front(), dss2d.Uf()) );
      std::vector<PointD3D> bb;
      PointD3D p3;
      for ( unsigned int j = 0; j < pts2d.size(); ++j )
	{
	  switch (i) {
	  case 0: p3.center[0] = (double) b[ i ]-0.5; p3.center[1] = pts2d[ j ][ 0 ];  p3.center[2] = pts2d[ j ][ 1 ]; break;
	  case 1: p3.center[0] = pts2d[ j ][ 0 ];  p3.center[1] = (double) b[ i ]-0.5; p3.center[2] = pts2d[ j ][ 1 ];     break;
	  case 2: p3.center[0] = pts2d[ j ][ 0 ];  p3.center[1] = pts2d[ j ][ 1 ];     p3.center[2] = (double) b[ i ]-0.5; break;
	  }
	  bb.push_back( p3 );
	}
      for ( unsigned int j = 0; j < pts2d.size(); ++j ){
	viewer.setLineColor(color2d);
	viewer.addLine( DGtal::Z3i::RealPoint(bb[ j ].center[0], bb[ j ].center[1], bb[ j ].center[2]),
                        DGtal::Z3i::RealPoint(bb[ (j+1)%4 ].center[0], bb[ (j+1)%4 ].center[1], bb[ (j+1)%4 ].center[2]),
			MS3D_LINESIZE );
      }
    } // for ( DGtal::Dimension i = 0; i < 3; ++i )
}
Ejemplo n.º 2
0
void displayDSS3dTangent( Viewer3D<space, kspace> & viewer,
			  const KSpace & ks, const StandardDSS6Computer & dss3d,
			  const DGtal::Color & color3d )
{
  typedef typename StandardDSS6Computer::Point3d Point;
  typedef typename StandardDSS6Computer::PointD3d PointD3d;
  typedef typename Display3D<>::BallD3D PointD3D;
  Point directionZ3;
  PointD3d P1, P2, direction, intercept, thickness;
  dss3d.getParameters( directionZ3, intercept, thickness );
  assign( direction, directionZ3 );
  direction /= direction.norm();
  assign( P1, *dss3d.begin() );
  assign( P2, *(dss3d.end()-1) );
  double t1 = (P1 - intercept).dot( direction );
  double t2 = (P2 - intercept).dot( direction );

  PointD3d Q1 = intercept + t1 * direction;
  PointD3d Q2 = intercept + t2 * direction;
  viewer.setLineColor(color3d);
  viewer.addLine( DGtal::Z3i::RealPoint(Q1[ 0 ]-0.5, Q1[ 1 ]-0.5, Q1[ 2 ]-0.5), 
		  DGtal::Z3i::RealPoint(Q2[ 0 ]-0.5, Q2[ 1 ]-0.5, Q2[ 2 ]-0.5), 
		  MS3D_LINESIZE );
}
Ejemplo n.º 3
0
int main( int argc, char** argv )
{
  QApplication application(argc,argv);

  using namespace DGtal;
  using namespace DGtal::Z3i;
  
  typedef ImageContainerBySTLVector<Domain,unsigned char> GrayLevelImage3D;
  typedef ImageContainerBySTLVector<Domain,float>         FloatImage3D;
  typedef DistanceToMeasure<FloatImage3D>                 Distance;
  if ( argc <= 3 ) return 1;
  GrayLevelImage3D img  = GenericReader<GrayLevelImage3D>::import( argv[ 1 ] );
  float            mass = atof( argv[ 2 ] );
  float            rmax = atof( argv[ 3 ] );
  float            R    = atof( argv[ 4 ] );
  float            r    = atof( argv[ 5 ] );
  float            T1    = atof( argv[ 6 ] );
  float            T2    = atof( argv[ 7 ] );
  unsigned char    seuil = atof( argv[ 8 ] );

  {
    Viewer3D<> viewer;
    viewer.show();
    
    for ( Domain::ConstIterator it = img.domain().begin(), itE = img.domain().end();
          it != itE; ++it )
      {
        // std::cout << *it << " " << (int) img( *it ) << endl;
        if ( img( *it ) > seuil ) viewer << *it;
      }
    viewer << Viewer3D<>::updateDisplay;
    application.exec();
  }

  FloatImage3D     fimg( img.domain() );
  FloatImage3D::Iterator outIt = fimg.begin();
  for ( GrayLevelImage3D::ConstIterator it = img.begin(), itE = img.end();
        it != itE; ++it )
    {
      float v = 2.0 * ((float)*it) / seuil; // 255.0;
      v = std::min( 255.0f, v );
      *outIt++ = v;
    }
  trace.beginBlock( "Computing delta-distance." );
  Distance     delta( mass, fimg, rmax );
  const FloatImage3D& d2 = delta.myDistance2;
  trace.endBlock();

  float m = 0.0f;
  for ( typename Domain::ConstIterator it = d2.domain().begin(),
          itE = d2.domain().end(); it != itE; ++it )
    {
      Point p = *it;
      float v = sqrt( d2( p ) );
      m = std::max( v, m );
    }
  
  // GradientColorMap<float> cmap_grad( 0, m );
  // cmap_grad.addColor( Color( 255, 255, 255 ) );
  // cmap_grad.addColor( Color( 255, 255, 0 ) );
  // cmap_grad.addColor( Color( 255, 0, 0 ) );
  // cmap_grad.addColor( Color( 0, 255, 0 ) );
  // cmap_grad.addColor( Color( 0,   0, 255 ) );
  // cmap_grad.addColor( Color( 0,   0, 0 ) );
  // QApplication application(argc,argv);
  // Viewer3D<> viewer;
  // viewer.show();

  // for ( typename Domain::ConstIterator it = d2.domain().begin(),
  //         itE = d2.domain().end(); it != itE; ++it )
  //   {
  //     Point p = *it;
  //     float v = sqrt( d2( p ) );
  //     v = std::min( (float)m, std::max( v, 0.0f ) ); 
  //     viewer << CustomColors3D(Color(cmap_grad(v).red(), cmap_grad(v).green(), cmap_grad(v).blue(), 120), Color(cmap_grad(v).red(), cmap_grad(v).green(), cmap_grad(v).blue(),120) )
  //           << p;

  //     RealVector grad = delta.projection( p );
  //     viewer.addLine( p, p+grad );
  //   }
  // std::cout << endl;
  // viewer << Viewer3D<>::updateDisplay;
  // application.exec();

  trace.beginBlock( "Computing delta-VCM." );
  typedef DeltaVCM< Distance > DVCM;
  typedef DVCM::Matrix                     Matrix;
  DVCM dvcm( delta, R, r );
  trace.endBlock();


  typedef EigenDecomposition<3,float> LinearAlgebraTool;
  typedef functors::HatPointFunction<Point,float> KernelFunction;
  KernelFunction chi( 1.0, r );

  // Flat zones are metallic blue, slightly curved zones are white,
  // more curved zones are yellow till red.
  double size = 1.0;
  GradientColorMap<double> colormap( 0.0, T2 );
  colormap.addColor( Color( 128, 128, 255 ) );
  colormap.addColor( Color( 255, 255, 255 ) );
  colormap.addColor( Color( 255, 255, 0 ) );
  colormap.addColor( Color( 255, 0, 0 ) );
  Matrix vcm_r, evec, null;
  typedef PointVector<3,float> RealVector3f;
  RealVector3f eval;

  Viewer3D<> viewer;
  viewer.show();

  for ( Domain::ConstIterator it = dvcm.domain().begin(), itE = dvcm.domain().end();
        it != itE; ++it )
    {
      // Compute VCM and diagonalize it.
      Point p = *it;
      vcm_r = dvcm.measure( chi, p );
      if ( vcm_r == null ) continue;
      LinearAlgebraTool::getEigenDecomposition( vcm_r, evec, eval );
      //double feature = eval[ 0 ] / ( eval[ 0 ] +  eval[ 1 ] );
      eval[ 0 ] = std::max( eval[ 0 ], 0.00001f );
      float tubular = ( eval[ 2 ] <= 0.00001f ) // (R*R/4.0) )
        ? 0
        : ( ( eval[ 1 ] + eval[ 2 ] ) / ( eval[ 0 ] + eval[ 1 ] + eval[ 2 ] ) );
      float bound = T1;
      float tubular2 = tubular * (eval[ 0 ] + eval[ 1 ] + eval[ 2 ] ) / (R*R*r*r*3.14f/12.0f);
      float display = tubular2 <= bound ? 0.0f : ( tubular2 - bound ) / (1.0f - bound);
      //: eval[ 1 ] / ( 1.0 + eval[ 0 ] ) / ( 1.0 + delta( p )*delta( p ) );
      //: eval[ 1 ] * eval[ 1 ] / ( 1.0 + eval[ 0 ] ) / ( 1.0 + delta( p ) );
      if (display > 0.01f)
        trace.info() << "l0=" << eval[ 0 ] << " l1=" << eval[ 1 ]
                     << " tub=" << tubular
                     << " tub2=" << tubular2
                     << " disp=" << display << std::endl;
      if (display > 0.5f*T2 )
        {
          viewer << CustomColors3D( Color::Black,
                                    colormap( display > T2 ? T2 : display ) )
                 << p;
          RealVector normal = evec.column( 0 );
          RealPoint rp( p[ 0 ], p[ 1 ] ); 
          viewer.addLine( rp - size*normal, rp + size*normal );
        }
    }      
  viewer << Viewer3D<>::updateDisplay;
  application.exec();
  return 0;
}
Ejemplo n.º 4
0
int main( int argc, char** argv )
{
  using namespace DGtal;
  using namespace DGtal::Z3i;
  
  typedef ImageContainerBySTLVector<Domain,unsigned char> GrayLevelImage3D;
  typedef ImageContainerBySTLVector<Domain,float>         FloatImage3D;
  typedef DistanceToMeasure<FloatImage3D>                 Distance;
  if ( argc <= 3 ) return 1;
  GrayLevelImage3D img  = GenericReader<GrayLevelImage3D>::import( argv[ 1 ] );
  double           mass = atof( argv[ 2 ] );
  double           rmax = atof( argv[ 3 ] );
  FloatImage3D     fimg( img.domain() );
  FloatImage3D::Iterator outIt = fimg.begin();
  for ( GrayLevelImage3D::ConstIterator it = img.begin(), itE = img.end();
        it != itE; ++it )
    {
      float v = ((float)*it) / 255.0;
      *outIt++ = v;
    }
  trace.beginBlock( "Computing delta-distance." );
  Distance     delta( mass, fimg, rmax );
  const FloatImage3D& d2 = delta.myDistance2;
  trace.endBlock();

  float m = 0.0f;
  for ( typename Domain::ConstIterator it = d2.domain().begin(),
          itE = d2.domain().end(); it != itE; ++it )
    {
      Point p = *it;
      float v = sqrt( d2( p ) );
      m = std::max( v, m );
    }

  GradientColorMap<float> cmap_grad( 0, m );
  cmap_grad.addColor( Color( 255, 255, 255 ) );
  cmap_grad.addColor( Color( 255, 255, 0 ) );
  cmap_grad.addColor( Color( 255, 0, 0 ) );
  cmap_grad.addColor( Color( 0, 255, 0 ) );
  cmap_grad.addColor( Color( 0,   0, 255 ) );
  cmap_grad.addColor( Color( 0,   0, 0 ) );
  QApplication application(argc,argv);
  Viewer3D<> viewer;
  viewer.show();
  //board << SetMode( d2.domain().className(), "Paving" );
  

  for ( typename Domain::ConstIterator it = d2.domain().begin(),
          itE = d2.domain().end(); it != itE; ++it )
    {
      Point p = *it;
      float v = sqrt( d2( p ) );
      v = std::min( (float)m, std::max( v, 0.0f ) ); 
      viewer << CustomColors3D(Color(cmap_grad(v).red(), cmap_grad(v).green(), cmap_grad(v).blue(), 120), Color(cmap_grad(v).red(), cmap_grad(v).green(), cmap_grad(v).blue(),120) )
            << p;

      RealVector grad = delta.projection( p );
      // / ( 1.1 - ( (double)img( *it ) ) / 255.0 ) ;
	  viewer.addLine( p, p+grad );
    }
  std::cout << endl;
  viewer << Viewer3D<>::updateDisplay;
  application.exec();
  return 0;
}
Ejemplo n.º 5
0
int main( int argc, char** argv )
{

    // parse command line ----------------------------------------------
    po::options_description general_opt("Allowed options are: ");
    general_opt.add_options()
    ("help,h", "display this message")
    ("input,i", po::value<std::vector<string> >()->multitoken(), "off files (.off), or OFS file (.ofs) " )
    ("scaleX,x",  po::value<float>()->default_value(1.0), "set the scale value in the X direction (default 1.0)" )
    ("scaleY,y",  po::value<float>()->default_value(1.0), "set the scale value in the Y direction (default 1.0)" )
    ("scaleZ,z",  po:: value<float>()->default_value(1.0), "set the scale value in the Z direction (default 1.0)")
    ("minLineWidth,w",  po:: value<float>()->default_value(1.5), "set the min line width of the mesh faces (default 1.5)")
    ("customColorMesh",po::value<std::vector<unsigned int> >()->multitoken(), "set the R, G, B, A components of the colors of the mesh faces and eventually the color R, G, B, A of the mesh edge lines (set by default to black). " )
    ("customColorSDP",po::value<std::vector<unsigned int> >()->multitoken(), "set the R, G, B, A components of the colors of  the sdp view" )
    ("displayVectorField,f",po::value<std::string>(),  "display a vector field from a simple sdp file (two points per line)" )
    ("vectorFieldIndex",po::value<std::vector<unsigned int> >()->multitoken(), "specify special indices for the two point coordinates (instead usinf the default indices: 0 1, 2, 3, 4, 5)" )
    ("customLineColor",po::value<std::vector<unsigned int> >()->multitoken(), "set the R, G, B components of the colors of the lines displayed from the --displayVectorField option (red by default). " )
    ("displaySDP,s", po::value<std::string>(), "Add the display of a set of discrete points as ball of radius 0.5.")
    ("SDPradius", po::value<double>()->default_value(0.5), "change the ball radius to display a set of discrete points (used with displaySDP option)")
    ("invertNormal,n", "threshold min to define binary shape" )
    ("drawVertex,v", "draw the vertex of the mesh" );

    bool parseOK=true;
    po::variables_map vm;
    try {
        po::store(po::parse_command_line(argc, argv, general_opt), vm);
    } catch(const std::exception& ex) {
        parseOK=false;
        trace.info()<< "Error checking program options: "<< ex.what()<< endl;
    }
    po::notify(vm);
    if( !parseOK || vm.count("help")||argc<=1)
    {
        std::cout << "Usage: " << argv[0] << " [input]\n"
                  << "Display OFF mesh file by using QGLviewer"
                  << general_opt << "\n";
        return 0;
    }

    if(! vm.count("input"))
    {
        trace.error() << " The file name was defined" << endl;
        return 0;
    }



    std::vector<std::string> inputFilenameVect = vm["input"].as<std::vector<std::string > >();
    float sx = vm["scaleX"].as<float>();
    float sy = vm["scaleY"].as<float>();
    float sz = vm["scaleZ"].as<float>();

    unsigned int  meshColorR = 240;
    unsigned int  meshColorG = 240;
    unsigned int  meshColorB = 240;
    unsigned int  meshColorA = 255;

    unsigned int  meshColorRLine = 0;
    unsigned int  meshColorGLine = 0;
    unsigned int  meshColorBLine = 0;
    unsigned int  meshColorALine = 255;


    unsigned int  sdpColorR = 240;
    unsigned int  sdpColorG = 240;
    unsigned int  sdpColorB = 240;
    unsigned int  sdpColorA = 255;


    bool displayVectorField = vm.count("displayVectorField");
    std::vector<unsigned int> vectFieldIndices = {0,1,2,3,4,5};

    if (displayVectorField) {
        if(vm.count("vectorFieldIndex")) {
            vectFieldIndices = vm["vectorFieldIndex"].as<std::vector<unsigned int> >();
            if (vectFieldIndices.size() != 6) {
                trace.warning() << "you should specify indices for each of the 6 fields of the two coordinates." << std::endl;
                vectFieldIndices = {0,1,2,3,4,5};
            }
        }
    }

    float lineWidth = vm["minLineWidth"].as<float>();

    DGtal::Color vFieldLineColor = DGtal::Color::Red;
    if(vm.count("customLineColor")) {
        std::vector<unsigned int > vectCol = vm["customLineColor"].as<std::vector<unsigned int> >();
        if(vectCol.size()!=3 ) {
            trace.error() << "colors specification should contain R,G,B values (using default red)."<< std::endl;
        }
        vFieldLineColor.setRGBi(vectCol[0], vectCol[1], vectCol[2], 255);
    }

    if(vm.count("customColorMesh")) {
        std::vector<unsigned int > vectCol = vm["customColorMesh"].as<std::vector<unsigned int> >();
        if(vectCol.size()!=4 && vectCol.size()!=8 ) {
            trace.error() << "colors specification should contain R,G,B and Alpha values"<< std::endl;
        }
        meshColorR = vectCol[0];
        meshColorG = vectCol[1];
        meshColorB = vectCol[2];
        meshColorA = vectCol[3];
        if(vectCol.size() == 8) {
            meshColorRLine = vectCol[4];
            meshColorGLine = vectCol[5];
            meshColorBLine = vectCol[6];
            meshColorALine = vectCol[7];

        }

    }
    if(vm.count("customColorSDP")) {
        std::vector<unsigned int > vectCol = vm["customColorSDP"].as<std::vector<unsigned int> >();
        if(vectCol.size()!=4) {
            trace.error() << "colors specification should contain R,G,B and Alpha values"<< std::endl;
        }
        sdpColorR = vectCol[0];
        sdpColorG = vectCol[1];
        sdpColorB = vectCol[2];
        sdpColorA = vectCol[3];
    }



    QApplication application(argc,argv);
    Viewer3D<> viewer;
    std::stringstream title;
    title  << "Simple Mesh Viewer: " << inputFilenameVect[0];
    viewer.setWindowTitle(title.str().c_str());
    viewer.show();
    viewer.myGLLineMinWidth = lineWidth;
    viewer.setGLScale(sx, sy, sz);
    bool invertNormal= vm.count("invertNormal");


    double ballRadius = vm["SDPradius"].as<double>();

    trace.info() << "Importing mesh... ";

    std::vector<Mesh<DGtal::Z3i::RealPoint> >  vectMesh;
    for(unsigned int i = 0; i< inputFilenameVect.size(); i++) {
        Mesh<DGtal::Z3i::RealPoint> aMesh(!vm.count("customColorMesh"));
        aMesh << inputFilenameVect[i];
        vectMesh.push_back(aMesh);
    }


    bool import = vectMesh.size()==inputFilenameVect.size();
    if(!import) {
        trace.info() << "File import failed. " << std::endl;
        return 0;
    }

    trace.info() << "[done]. "<< std::endl;
    if(vm.count("displaySDP")) {
        std::string filenameSDP = vm["displaySDP"].as<std::string>();
        vector<Z3i::RealPoint> vectPoints;
        vectPoints = PointListReader<Z3i::RealPoint>::getPointsFromFile(filenameSDP);
        viewer << CustomColors3D(Color(sdpColorR, sdpColorG, sdpColorB, sdpColorA),
                                 Color(sdpColorR, sdpColorG, sdpColorB, sdpColorA));
        for(unsigned int i=0; i< vectPoints.size(); i++) {
            viewer.addBall(vectPoints.at(i), ballRadius);
        }
    }
    if(invertNormal) {
        for(unsigned int i=0; i<vectMesh.size(); i++) {
            vectMesh[i].invertVertexFaceOrder();
        }
    }

    viewer << CustomColors3D(Color(meshColorRLine, meshColorGLine, meshColorBLine, meshColorALine),
                             Color(meshColorR, meshColorG, meshColorB, meshColorA));
    for(unsigned int i=0; i<vectMesh.size(); i++) {
        viewer << vectMesh[i];
    }

    if(vm.count("drawVertex")) {
        for(unsigned int i=0; i<vectMesh.size(); i++) {
            for( Mesh<DGtal::Z3i::RealPoint>::VertexStorage::const_iterator it = vectMesh[i].vertexBegin();
                    it!=vectMesh[i].vertexEnd(); ++it) {
                DGtal::Z3i::Point pt;
                pt[0]=(*it)[0];
                pt[1]=(*it)[1];
                pt[2]=(*it)[2];
                viewer << pt;
            }
        }
    }


    if (displayVectorField) {
        std::vector<unsigned int > vectFieldIndices1 = {vectFieldIndices[0],vectFieldIndices[1], vectFieldIndices[2]};
        std::vector<unsigned int > vectFieldIndices2 = {vectFieldIndices[3],vectFieldIndices[4], vectFieldIndices[5]};

        std::vector<DGtal::Z3i::RealPoint> vectPt1 = PointListReader<DGtal::Z3i::RealPoint>::getPointsFromFile(vm["displayVectorField"].as<std::string>(), vectFieldIndices1);
        std::vector<DGtal::Z3i::RealPoint> vectPt2 = PointListReader<DGtal::Z3i::RealPoint>::getPointsFromFile(vm["displayVectorField"].as<std::string>(), vectFieldIndices2);
        viewer.createNewLineList();
        for (unsigned int i = 0; i < vectPt1.size(); i++) {

            viewer.setLineColor(vFieldLineColor);
            viewer.addLine(vectPt1[i], vectPt2[i]);
        }


    }


    viewer << Viewer3D<>::updateDisplay;
    return application.exec();
}
Ejemplo n.º 6
0
void displayAxes( Viewer3D<space, kspace> & viewer,
                  const Point & lowerBound, const Point & upperBound,
		  const std::string & mode )
{
  RealPoint p0( (double)lowerBound[ 0 ]-0.5,
                (double)lowerBound[ 1 ]-0.5,
                (double)lowerBound[ 2 ]-0.5 );
  RealPoint p1( (double)upperBound[ 0 ]-0.5,
                (double)upperBound[ 1 ]-0.5,
                (double)upperBound[ 2 ]-0.5 );
  if ( ( mode == "WIRED" ) || ( mode == "COLORED" ) )
    {
      viewer.setLineColor(AXIS_COLOR);
      viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p0[ 2 ]),
		      DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p0[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p0[ 2 ]),
		      DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p0[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p0[ 2 ]),
		      DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p1[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p0[ 2 ]),
		      DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p0[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p0[ 2 ]),
		      DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p1[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p0[ 2 ]),
		      DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p0[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p0[ 2 ]),
		      DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p1[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p1[ 2 ]),
		      DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p1[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p1[ 2 ]),
		      DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p1[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p0[ 2 ]),
		      DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p1[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p1[ 2 ]),
		      DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p1[ 2 ]),  AXIS_LINESIZE );
      viewer.addLine( DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p1[ 2 ]),
		      DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p1[ 2 ]),  AXIS_LINESIZE );
    }
  if ( mode == "COLORED" )
    {
      viewer.setFillColor(XY_COLOR);
      viewer.addQuad(DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p1[ 2 ]),
		     DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p1[ 2 ]),
		     DGtal::Z3i::RealPoint(p0[ 0 ], p0[ 1 ], p1[ 2 ]),
		     DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p1[ 2 ]) );
      viewer.setFillColor(XZ_COLOR);
      viewer.addQuad(DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p1[ 2 ]),
		     DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p1[ 2 ]),
		     DGtal::Z3i::RealPoint(p0[ 0 ], p1[ 1 ], p0[ 2 ]),
		     DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p0[ 2 ]));
      viewer.setFillColor(YZ_COLOR);
      viewer.addQuad(DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p1[ 2 ]),
		     DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p1[ 2 ]),
		     DGtal::Z3i::RealPoint(p1[ 0 ], p0[ 1 ], p0[ 2 ]),
		     DGtal::Z3i::RealPoint(p1[ 0 ], p1[ 1 ], p0[ 2 ]));
    }
}