Skip to content

Instantly share code, notes, and snippets.

View vovythevov's full-sized avatar

Johan Andruejol vovythevov

  • Align Technology
  • Chape Hill NC, USA
View GitHub Profile
@vovythevov
vovythevov / CLI_WithProgress_Example.py
Last active January 12, 2017 18:48
Example of a running a CLI in python with a progress bar
# For reference:
# CLIProgressBar is a qSlicerCLIProgressBar (https://www.slicer.org/doc/html/classqSlicerCLIProgressBar.html)
# self.CLIProgressBar = slicer.qSlicerProgressBar.
def getCLINode(self, module, name):
cliNode = slicer.mrmlScene.GetFirstNodeByName(name)
if cliNode == None:
cliNode = slicer.cli.createNode(module)
cliNode.SetName(name)
return cliNode
@vovythevov
vovythevov / Roulette_casino.py
Last active November 2, 2016 08:11
Vov's implementation of the casino roulette game. Untested.
#Jeu de la roulette du casino.
from random import randrange
from math import floor
from time import sleep
#Variables de configurations:
fourchette_mise = [1, 49]
fourchette_pari = [0, 49]
@vovythevov
vovythevov / gist:6589092
Last active December 23, 2015 05:48
StyleExample: Final main
//----------------------------------------------------------------------------
int main(int argc, char *argv[])
{
QApplication::setStyle( new QCDEStyle );
QApplication app(argc, argv);
QCoreApplication::addLibraryPath("W:/TechTip/QtStyles/SecondPlugin_build/Debug");
QApplication::setStyle(QStyleFactory::create("secondsimplestyle"));
QSpinBox spinBox;
//-----------------------------------------------------------------------------
QStyle* StyleExamplePlugin::create( const QString & key )
{
if (key.toLower() == "simplestyle")
{
return new QPlastiqueStyle();
}
return 0;
}
// Qt includes
#include <QApplication>
#include <QCDEStyle>
#include <QSpinBox>
#include <QStyleFactory>
//----------------------------------------------------------------------------
int main(int argc, char *argv[])
{
QApplication::setStyle( new QCDEStyle ); // set default style
@vovythevov
vovythevov / StyleExamples_Simple.cxx
Last active December 21, 2015 20:18
Tech Tip Qt Styles: Very very simple style example
//----------------------------------------------------------------------------
int main(int argc, char *argv[])
{
QApplication::setStyle("plastique");
QApplication app(argc, argv);
QSpinBox spinBox;
spinBox.show();
return app.exec();
}
@vovythevov
vovythevov / gist:5360315
Last active December 16, 2015 02:09
Read Color frame from Kinect
//-----------------------------------------------------------------------------
vtkImageData* GrabNextColorFrame()
{
NUI_IMAGE_FRAME kinectFrame;
if (sensor->NuiImageStreamGetNextFrame(rgbStream, 0, &kinectFrame) != EXIT_SUCCESS)
{
return 0;
}
INuiFrameTexture* texture = kinectFrame.pFrameTexture;
//-----------------------------------------------------------------------------
int main (int argc, char* argv)
{
// 1- init
if (!InitKinect())
{
std::cout<<"Could not Init Kinect"<<std::endl;
return EXIT_FAILURE;
}
@vovythevov
vovythevov / gist:5360161
Last active December 16, 2015 02:09
Kinect C++ Project minimum main
#include <windows.h> // WINDOWS MUST BE BEFORE !
// -- Kinect --
#include <NuiApi.h>
// -- STD --
#include <iostream>
// Kinect variables
INuiSensor* sensor; // The kinect sensor
@vovythevov
vovythevov / gist:5360118
Created April 11, 2013 02:13
CMake Kinect Setup
cmake_minimum_required (VERSION 2.6)
project (K) # Not a very inventive name
set (K_VERSION_MAJOR 1)
set (K_VERSION_MINOR 0)
include_directories("${PROJECT_BINARY_DIR}")
# Kinect dir