Example #1
0
/**
 * @function main
 * @brief Main function what else?
 */
int main( int argc, char* argv[] ) {

  int c;
  while( (c=getopt(argc, argv,"h")) != -1 ) {
    switch(c) {
    case 'h': { printUsage(argv[0]); } break;	
    }
  }
  
  // Create OpenNI grabber, register key events
  gKinectGrabber = new pcl::OpenNIGrabber();
  if( gKinectGrabber == 0 ) { return 1; }
  boost::function< void (const pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr&) > f = boost::bind( &grabberCallback, _1 );
  gKinectGrabber->registerCallback(f);
  
  // Create viewer and initialize
  gViewer = createViewer();
  gKinectGrabber->start();

  // Loop expecting capture signal (press ESC)
  while( !gViewer->wasStopped() ) {
    boost::this_thread::sleep( boost::posix_time::seconds(1) );
  }
  
  // If capturing Kinect data, stop the stream before exiting
  gKinectGrabber->stop();
  
} // end main
// ------------------------------------------------------------------------
void DicomParser::setUpDisplay()
{

	parseDicom();
	loadImages();


	QWidget * w1 = new QWidget(this);
	QHBoxLayout * l1 = new QHBoxLayout;
	l1->addWidget(createTable());
	l1->addWidget(createViewer());
	w1->setLayout(l1);
	

	
	okButton = new QPushButton("OK", this);
	connect(okButton, SIGNAL(clicked()), this, SLOT(okPressed()));
	
	cancelButton = new QPushButton("Cancel", this);
	connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelPressed()));

	QHBoxLayout * l2 = new QHBoxLayout;
	l2->addWidget(cancelButton);
	l2->addWidget(okButton);

	QWidget * w2 = new QWidget(this);
	w2->setLayout(l2);

	QVBoxLayout * l3 = new QVBoxLayout;
	l3->addWidget(w1);
	l3->addWidget(w2);

	this->setLayout(l3);

}
Example #3
0
/**
 * @function main
 * @brief Main function what else?
 */
int main( int argc, char* argv[] ) {

  std::string filename;
  
  if( argc != 3 ) {
    printf( "Enter text file with PCD names on it and number to show \n" );
    return 0;
  }
  filename = argv[1];
  
  // Read  
  if( !readPCDData( argv[1], gPointclouds ) ) {
    printf( " [X] Error reading PCD text file exiting \n" );
  }

  gNumPointclouds = gPointclouds.size();
  gCurrentShown = atoi( argv[2] ) % gNumPointclouds;

  // Create viewer
  gViewer = createViewer();
  
  // Visualize 
  printf("Showing pointcloud %d  out of %d \n", gCurrentShown, gNumPointclouds );
  gViewer->showCloud( gPointclouds[gCurrentShown] );

  while( !gViewer->wasStopped() ) {
    boost::this_thread::sleep( boost::posix_time::seconds(1) );
  }

  
}
Example #4
0
void MainWindow::goToVerse(QString verse)
{
	Key key = Key::fromString(verse);

	QString translation = mTextSource->getSourceName();
	replaceViewer(createViewer(translation, key.mBook,
							key.mChapter, key.mVerse));
}
Example #5
0
void MainWindow::selectTranslation()
{
	QString translation;
	if (::selectTranslation(this, translation))
	{
		QString bookName = mTextSource->getSuperSectionName();
		int chapter = mpViewer->getCurrentSection();
		int verse = mpViewer->getCurrentParagraph();

		mSearchResults->hideResults();
		replaceViewer(createViewer(translation, bookName, chapter, verse));
	}
}
Example #6
0
ObjectViewer::ObjectViewer(QWidget* parent, Qt::WindowFlags f)
    : ViewerInterface(parent, f) {
    mainLayout = new QHBoxLayout(this);

    auto leftLayout = new QVBoxLayout;

    objectList = new QTableView;
    objectMenu = new QMenu(objectList);
    objectList->setContextMenuPolicy(Qt::CustomContextMenu);
    auto viewModelAction = new QAction("View Model", objectMenu);
    objectMenu->addAction(viewModelAction);
    connect(viewModelAction, SIGNAL(triggered()), this, SLOT(menuViewModel()));
    connect(objectList, SIGNAL(customContextMenuRequested(QPoint)), this,
            SLOT(onCustomContextMenu(QPoint)));
    filterModel = new ObjectSearchModel(this);
    objectList->setModel(filterModel);
    objectList->setColumnWidth(0, 50);
    objectList->setColumnWidth(1, 150);
    objectList->setColumnWidth(2, 200);
    objectList->setSortingEnabled(true);
    objectList->setSelectionBehavior(QAbstractItemView::SelectionBehavior::SelectRows);
    connect(objectList->selectionModel(),
            SIGNAL(currentChanged(QModelIndex, QModelIndex)), this,
            SLOT(showItem(QModelIndex)));

    leftLayout->addLayout(searchControls(filterModel));
    leftLayout->addWidget(objectList);
    mainLayout->addLayout(leftLayout, 6);

    previewWidget = createViewer();
    previewWidget->setMode(ViewerWidget::Mode::Object);

    infoLayout = new QGridLayout;

    previewID = new QLabel;
    previewModel = new QLabel;
    previewClass = new QLabel;
    infoLayout->addWidget(new QLabel("ID"), 1, 0);
    infoLayout->addWidget(previewID, 1, 1);
    infoLayout->addWidget(new QLabel("Type"), 2, 0);
    infoLayout->addWidget(previewClass, 2, 1);
    infoLayout->addWidget(new QLabel("Model"), 3, 0);
    infoLayout->addWidget(previewModel, 3, 1);
    infoLayout->addWidget(QWidget::createWindowContainer(previewWidget), 0, 0, 1, 2);
    infoLayout->setRowStretch(0, 1);

    mainLayout->addLayout(infoLayout, 4);
    setLayout(mainLayout);
}
Example #7
0
MainWindow::MainWindow() : QMainWindow(NULL)
{
	mShowShortTitle = false;

	setAttribute(Qt::WA_Maemo5StackedWindow);
	createMenu();

	QSettings settings;
	QString translation = settings.value("initial/translation",
										"KJV").toString();
	QString book = settings.value("initial/book", "Genesis").toString();
	int chapter = settings.value("initial/chapter", 0).toInt();
	int verse = settings.value("initial/verse", 0).toInt();
    mpViewer = createViewer(translation, book, chapter, verse);

	QFrame* frame = new QFrame;
	mLayout = new QHBoxLayout;
	mLayout->addWidget(mpViewer);
	mSearchResults = new SearchResultsFrame();
	mLayout->addWidget(mSearchResults);
	mLayout->setContentsMargins(0, 0, 0, 0);
	mLayout->setSpacing(0);
	frame->setLayout(mLayout);
	setCentralWidget(frame);

	connect(mSearchResults, SIGNAL(resultSelected(const QString&)), this,
			SLOT(goToVerse(const QString&)));

	QDBusConnection::systemBus().connect(QString(),
										MCE_SIGNAL_PATH,
										MCE_SIGNAL_IF,
										MCE_DEVICE_ORIENTATION_SIG,
										this,
										SLOT(orientationChanged(QString)));

	// Tell maemo-status-volume to grab/ungrab increase/decrease keys
	unsigned long val = 1;
	Atom atom = XInternAtom( QX11Info::display(), "_HILDON_ZOOM_KEY_ATOM", 0);
	XChangeProperty(QX11Info::display(),
					winId(),
					atom,
					XA_INTEGER,
					32,
					PropModeReplace,
					(unsigned char *)&val,
					1);
	setWindowTitle("Katana");
}
Example #8
0
void MainWindow::onSettings()
{
	SettingsDialog dlg(this);
	if (dlg.exec() == QDialog::Accepted)
	{
		QString newTranslation;
		if (!dlg.getNewTranslation(newTranslation))
			newTranslation = mTextSource->getSourceName();

		QString bookName = mTextSource->getSuperSectionName();
		int chapter = mpViewer->getCurrentSection();
		int verse = mpViewer->getCurrentParagraph();

		mSearchResults->hideResults();
		// We deliberately reload the bible info here, because the translation
		// might have been deleted out from under us, in which case
		// getBibleInfo will simply return the last available Bible.
		replaceViewer(createViewer(newTranslation, bookName, chapter, verse));
	}
}
Example #9
0
QoccViewerContext::QoccViewerContext()
{
	// Create the OCC Viewers
	TCollection_ExtendedString a3DName("Visual3D");
	myViewer = createViewer( "DISPLAY", a3DName.ToExtString(), "", 1000.0 );
	myViewer->Init();
	myViewer->SetZBufferManagment(Standard_False);
	myViewer->SetDefaultViewProj( V3d_Zpos );	// Top view
 	myContext = new AIS_InteractiveContext( myViewer );

	myGridType       = Aspect_GT_Rectangular;
	myGridMode       = Aspect_GDM_Lines;
	myGridColor      = Quantity_NOC_RED4;
	myGridTenthColor = Quantity_NOC_GRAY90;

	myContext->SetHilightColor(Quantity_NOC_WHITE) ;

	setGridOffset (0.0);
	gridXY();
	//gridToggle();
}
Example #10
0
void MainWindow::selectVerse(QString startingFilter)
{
	SelectResult result;
	if (::selectVerse(this, mTextSource, startingFilter, result))
	{
		switch (result.getType())
		{
		case SelectResult::Type_SearchText:
			search(result.search_GetText(), "");
			break;
		case SelectResult::Type_SearchDialog:
			startSearch(result.search_GetText());
			break;
		case SelectResult::Type_SelectedVerse:
			{
				QString translation = mTextSource->getSourceName();
				mSearchResults->hideResults();
				replaceViewer(createViewer(translation, result.verse_GetBook(),
										result.verse_GetChapter(), 0));
			}
			break;
		}
	}
}
Example #11
0
/**
 * @function main
 */
int main( int argc, char* argv[] ) {
  
  double sx; double sy; double sz;
  double ox; double oy; double oz;
  double resolution;

  sx = 1.0; sy = 1.0; sz = 1.0;
  ox = 0.0; oy = 0.0; oz = 0.0;
  resolution = 0.0125;
  
  // Distance Field
  printf("Create PF Distance Field \n");
  PFDistanceField pf( sx, sy, sz, resolution, ox, oy, oz );
  pf.reset();

  // Geometry
  double bx; double by; double bz;
  bx = 0.2; by = 0.25; bz = 0.2;

  pf.addBox( 0.6, 0.5, 0.1, bx, by, bz );
  pf.addBox( 0.6, 0.5, 0.1, bx + 0.0, by + 0.0, bz + 0.5 );

  // Settings parameters
  int cost = 10; int radius = 3; int numPaths = 6;

  DiversePaths dp( &pf, radius, cost );

  // Set goal and start
  std::vector<double> goal(3);
  goal[0] = 0.5; goal[1] = 0.9; goal[2] = 0.7;
  std::vector<double> start(3);
  start[0] = 0.3; start[1] = 0.1; start[2] = 0.5;

  // Paths
  std::vector<std::vector<double> > midPoints;
  std::vector<std::vector<std::vector<double> > > paths;

  // Get paths
  float boundFactor = 2.0;
  int numCheckPoints = 10;
  time_t ts = clock();
  paths = dp.getDiversePaths2( start, goal, numPaths, midPoints, boundFactor, numCheckPoints );
  time_t tf = clock();
  double dt = (double) ( tf - ts ) / CLOCKS_PER_SEC;
  printf( "** getDiversePaths2 time: %f \n", dt );

  printf( "Num points: %d \n", midPoints.size() );

  // Create viewer
  boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer = createViewer();

  // View the path
  reset_PCL_Tools_counters();

  // MidPoints: View pointcloud (NOT BOTH Balls and pointcloud)
   viewPoints( midPoints, viewer, 255,0,255 );

   // Get checkPoint Lines
   std::vector<std::vector<std::vector<double> > > checkLines;
   if( paths.size() >= 2 ) {
     checkLines = dp.getCheckPointLines( paths[0], paths[2], numCheckPoints );
   } else {
     printf( " !! Only one path, no drawing checkPoint lines! \n" );
   }

   for( int i = 0; i < checkLines.size(); ++i ) {
     viewPath( checkLines[i], viewer, 0, 0, 255 );
   }

  dp.visualizePaths( viewer, paths, true );

  // Loop
  while( !viewer->wasStopped() ) {
    viewer->spinOnce(100);
    boost::this_thread::sleep( boost::posix_time::microseconds(100000));
    } 

  printf("End of program \n");
  return(0);
}
/**
 * @function main
 * @brief Main function what else?
 */
int main( int argc, char* argv[] ) {

  // If user requires help
  if( pcl::console::find_argument( argc, argv, "-h" ) >= 0 ) {
    printUsage();
    return 0;
  }

  // If user wants to visualize a PCD
  bool justVisualize = false;
  std::string filename;

  if( pcl::console::find_argument( argc, argv, "-v" ) >= 0 ) {
    if( argc != 3 ) {
      printUsage( );
      return 0;
    }
    filename = argv[2];
    justVisualize = true;
  }

  // Otherwise, user is crazy 
  else if( argc != 1 ) {
    printUsage();
    return 0;
  }

  // If user indicated visualization of a video file
  if( justVisualize ) {
    try {
      pcl::io::loadPCDFile<pcl::PointXYZRGBA>( filename.c_str(), *gCloudPtr );
    }
    catch( pcl::PCLException e1 ) {
      try {
	pcl::io::loadPCDFile<pcl::PointXYZ>( filename.c_str(), *gFallbackCloudPtr );
      }
      catch( pcl::PCLException e2 ) {
	return -1;
      }
      gNoColour = true;
    }

    std::cout << "Loaded " << filename << "." << std::endl;
    if( gNoColour ) {
      std::cout << "This file has no RGBA colour information present" << std::endl;
    }

  } // end if

  // If user wants to use Kinect data
  else {
    gKinectGrabber = new pcl::OpenNIGrabber();
    if( gKinectGrabber == 0 ) {
      return false;
    }
    boost::function< void (const pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr&) > f = boost::bind( &grabberCallback, _1 );
    gKinectGrabber->registerCallback(f);

  }

  // Create viewer
  gViewer = createViewer();
  
  // Visualize either file data
  if( justVisualize ) {
    if( gNoColour ) {
      gViewer->showCloud( gFallbackCloudPtr );
    } else {
      gViewer->showCloud( gCloudPtr );
    }    
  }

  // Or visualize Kinect data
  else {
    gKinectGrabber->start();
  }

  while( !gViewer->wasStopped() ) {
    boost::this_thread::sleep( boost::posix_time::seconds(1) );
  }

  // If capturing Kinect data, stop the stream before exiting
  if( !justVisualize ) {
    gKinectGrabber->stop();
  }
  
}