Skip to content

Instantly share code, notes, and snippets.

View fbudin69500's full-sized avatar

Francois Budin fbudin69500

  • Kitware Inc.
  • Carrboro, NC
View GitHub Profile
import os
from subprocess import Popen, PIPE
cli_path = "/home/fbudin/DTIPrep-build"
cli_name = "DTIPrep"
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]
@fbudin69500
fbudin69500 / ctkUtils.cpp
Last active December 14, 2015 15:59
ctkUtils.cpp does not normally copy broken symlinks when recursively copying a directory. These couple lines modify its behavior so that it actually copies those links. Those links can be useful for example when one needs to "insall" symlinks on a target computer, but does not have control over that computer to select the path at install time. I…
foreach(const QFileInfo &info, srcDir.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot|QDir::System))
{
QString srcItemPath = srcPath + "/" + info.fileName();
QString dstItemPath = dstPath + "/" + info.fileName();
if (info.isDir())
{
std::cout<< "Directory" << std::endl;
}
else if (info.isFile())
{
@fbudin69500
fbudin69500 / X11Config.sh
Created November 8, 2015 20:08
MacOS - xlib.h not found
#!/bin/bash
#http://stackoverflow.com/questions/11465258/xlib-h-not-found-when-building-graphviz-on-mac-os-x-10-8-mountain-lion
export CPPFLAGS=-I/opt/X11/include
@fbudin69500
fbudin69500 / coverage.sh
Created November 9, 2015 14:22
Code coverage
#!/bin/csh
make
lcov --directory . --zerocounters
ctest
lcov --directory . --capture --output-file app.info
genhtml app.info
firefox ./index.html
@fbudin69500
fbudin69500 / VBInstallUbuntu15.10.sh
Created November 12, 2015 18:00
Automatically download Ubuntu 15.10 iso and creates a virtual machine with VirtualBox to install it.
# !/bin/env bash
name="Ubuntu15.10-auto"
image="http://releases.ubuntu.com/15.10/ubuntu-15.10-desktop-amd64.iso"
# To show list of os types available, type "VBoxManage list ostypes"
ostype="Ubuntu_64"
cpu="2"
memory="2048"
cpuexecutioncap="80"
image_basename=`basename $image`
#image_basename_no_ext="${image_basename%.*}"
@fbudin69500
fbudin69500 / Ubuntu 14.03
Last active January 8, 2016 20:07
Slicer Installtion steps
From http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/Build_Instructions#Ubuntu
sudo apt-get install subversion git-core git-svn
sudo apt-get install make gcc g++ libX11-dev libXt-dev libgl1-mesa-dev libglu1-mesa-dev libfontconfig-dev libxrender-dev libncurses5-dev
sudo apt-get install qt4-qmake
sudo apt-get install libqt4-dev libqt4-dev-bin libqt4-opengl-dev libqt4-qt3support libqt4-webkit-dev qt4-linguist-tools qt4-designer qtcreator
sudo apt-get install libssl-dev
mkdir ~/Support && cd Support
wget http://www.cmake.org/files/v3.4/cmake-3.4.1.tar.gz
@fbudin69500
fbudin69500 / CreateSaveLoadImagesITKPython.py
Created March 2, 2016 13:48
Create, Save, Load Images with ITK in python
#!/usr/bin/env python
import itk
import tempfile
import os
def pixel_type_from_IO(pixel, component,dimension):
import itk
if pixel == 'scalar':
PixelType = component
@fbudin69500
fbudin69500 / DownloadTutorials.py
Created July 24, 2017 18:50
Download Scipy 2017 tutorial material
#!/usr/bin/env python
# Written by someone who posted it on Slack
import requests
links = [
'https://github.com/kwmsmith/scipy-2017-cython-tutorial',
'https://github.com/gforsyth/numba_tutorial_scipy2017',
'https://github.com/sympy/scipy-2017-codegen-tutorial',
@fbudin69500
fbudin69500 / CMakeLists.txt
Last active April 27, 2018 09:27 — forked from jcfr/CMakeLists.txt
CMake project allowing to build ICU 32 and 64-bit for Windows and upload the associated "tar.gz" archives on http://packages.kitware.com
cmake_minimum_required(VERSION 2.8.10.2)
#
# This project allows to configure, build, archive and upload an OpenSSL install tree.
#
if(DEFINED UPLOAD_PACKAGE_SCRIPT)
set(MIDAS_URL "http://packages.kitware.com")
set(FOLDER_ID 203)
trap { Write-Error $_; Exit 1 }
if (![System.IO.File]::Exists(".\install-utils.ps1")) {
Write-Host "Download install-utils.ps1"
$url = "https://raw.githubusercontent.com/scikit-build/scikit-ci-addons/master/windows/install-utils.ps1"
$cwd = (Get-Item -Path ".\" -Verbose).FullName
(new-object net.webclient).DownloadFile($url, "$cwd\install-utils.ps1")
}
Import-Module .\install-utils.ps1 -Force