Skip to content

Instantly share code, notes, and snippets.

View jcfr's full-sized avatar
🎯
Focusing

Jean-Christophe Fillion-Robin jcfr

🎯
Focusing
View GitHub Profile
import Tkinter
_tcl = Tkinter.Tcl();
def printTclEnvVar(key):
global _tcl
_tcl.eval("global env; puts %s=$env(%s)"%(key,key))
def printTclEnvVars():
global _tcl
_tcl.eval("""
@jcfr
jcfr / plastimatch.s4ext
Created June 1, 2012 18:00
Plastimatch extension description file compatible with Slicer4
#
# First token of each non-comment line is the keyword and the rest of the line
# (including spaces) is the value.
# - the value can be blank
#
# This is source code manager (i.e. svn)
scm svn
scmurl http://forge.abcd.harvard.edu/svn/plastimatch/plastimatch/trunk
scmrevision 3608
from __main__ import vtk, qt, ctk, slicer
#
# ScriptedLoadableExtensionTemplate
#
class ScriptedLoadableExtensionTemplate:
def __init__(self, parent):
parent.title = "Scripted Loadable Extension Template"
parent.categories = ["Examples"]
@jcfr
jcfr / nonInitializedPointerToStaticFunc.cpp
Created July 3, 2012 20:41
Small example illustrating that a static function can be called on a non-initialized pointer
// Qt includes
#include <QCoreApplication>
#include <QDebug>
#include <QVariant>
int main(int argc, char* argv[])
{
QCoreApplication app(argc, argv);
QCoreApplication * foo;
@jcfr
jcfr / qVariantMapToSettings.cpp
Created July 9, 2012 18:36
Qt example illustrating how to write list of QVariantMap into a settings file.
// Qt includes
#include <QSettings>
#include <QVariantMap>
// STL includes
#include <cstdlib>
int main(int, char*[])
{
@jcfr
jcfr / _ssl.py
Created July 19, 2012 23:16
Dummy ssl module to allow successfull import of pg8000
"""
Dummy ssl module to allow successfull import of pg8000
"""
SSLError = None
CERT_NONE = None
CERT_OPTIONAL = None
CERT_REQUIRED = None
PROTOCOL_SSLv2 = None
@jcfr
jcfr / ExtensionsIndexIntegratorGuide.md
Created July 24, 2012 18:21
This document aims at describing the steps required to integrate a topic into the Slicer ExtensionsIndex

Integrate a topic into the ExtensionsIndex

This document described what are the steps to follow when a Slicer developer requests the integration of a new extension in the Slicer ExtensionsIndex repository.

It is assumed that the extension is compliant with the slicer requirements.

Additonally, since extensions published in the index will be taken as example

@jcfr
jcfr / symbol-lapack_lite.so.txt
Last active December 11, 2015 14:58
List of symbol associated with library "lib/python2.6/site-packages/numpy/linalg/lapack_lite.so" when compiling Slicer on "factory-south.kitware.com".
$ uname -a
Darwin factory-south 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64
$ xcodebuild -version
Xcode 4.5.2
Build version 4G2008a
$ /usr/bin/c++ --version
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
License
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
1. Definitions
"Collective Work" means a work, such as a periodical issue, anthology or encyclopedia, in which the Work in its entirety in unmodified form, along with a number of other contributions, constituting separate and independent works in themselves, are assembled into a collective whole. A work that constitutes a Collective Work will not be considered a Derivative Work (as defined below) for the purposes of this License.
"Derivative Work" means a work based upon the Work or upon the Work
@jcfr
jcfr / slicer_raw_execute_cli.py
Created February 6, 2013 22:21
Example illustrating how a cli could be executed directly using subprocess.Popen. This could be particularly useful when investigating issue associated with CLI. Source: http://stackoverflow.com/questions/706989/how-to-call-an-external-program-in-python-and-retrieve-the-output-and-return-cod
import os
from subprocess import Popen, PIPE
#cli_path = "/home/jchris/Projects/Slicer-AHM-Superbuild-Debug/Slicer-build/lib/Slicer-4.2/cli-modules"
#cli_name = "AddScalarVolumes"
#cli_filepath = os.path.join(cli_path, cli_name)
cli_filepath = slicer.modules.addscalarvolumes.path
process = Popen([cli_filepath, "--xml"], stdout=PIPE)
output = process.communicate()[0]