Skip to content

Instantly share code, notes, and snippets.

View agirault's full-sized avatar
👨‍💻

Alexis Girault agirault

👨‍💻
View GitHub Profile
#!/bin/bash
set -ex
set -o pipefail
# Check for sudo
if [[ $EUID -eq 0 ]]; then
echo "This script must not be run as root"
exit 1
fi
import vtkImageMapper from 'vtk.js/Sources/Rendering/Core/ImageMapper';
import * as vtkMath from 'vtk.js/Sources/Common/Core/Math';
const { SlicingMode } = vtkImageMapper;
const ScreenSide = {
top: Symbol('top'),
bottom: Symbol('bottom'),
left: Symbol('left'),
right: Symbol('right'),
@agirault
agirault / orientationLabel.swift
Last active February 1, 2021 21:40
Generate the anatomical labels for each side of the screen given a dataset (orientation) and its display mode (data vs world mapping)
import simd
enum Axis {
enum Data {
case I
case J
case K
}
enum World {
@agirault
agirault / image_orientation_dicom.md
Created October 8, 2020 22:31
Image Orientation in Dicom
@agirault
agirault / build_gdcm_ios.sh
Last active January 2, 2023 16:57
Build GDCM for iOS - fat library arm64 x86_64
#!/bin/bash
# Parameters
os_target_version=11
gdcm_tag=v2.8.9
install_dir=/usr/local/Frameworks/gdcm
# Directories
script_dir=$(cd $(dirname $0) || exit 1; pwd)
src_dir=${script_dir}/gdcm-src
@agirault
agirault / CMakeLists.txt
Last active May 29, 2020 13:18
CMake configuration for a shared ios framework linking against static Qt5 libs to be embedded in an iOS app
# cmake /path/to/src \
# -GXcode \ # or Ninja
# -DQt5_DIR=/path/to/Qt/5.13.0/ios/lib/cmake/Qt5 \
# -DCMAKE_SYSTEM_NAME=iOS \
# -DCMAKE_OSX_DEPLOYMENT_TARGET=11 \
# -DCMAKE_INSTALL_PREFIX=/usr/local/frameworks \
# -DCMAKE_OSX_ARCHITECTURES="arm64" \ # arm64 for device, x86_64 for simulator (but x86_64 not in installed Qt5 ios static libs?)
cmake_minimum_required (VERSION 3.14 FATAL_ERROR)
project (Foo VERSION 1.0 LANGUAGES C CXX)
@agirault
agirault / vtkAnatomicalOrientation.cpp
Last active June 7, 2019 13:53
Utility class to convert between anatomical coordinate systems
#include <sstream>
#include <algorithm>
// Utility methods to be able to convert between various anatomical coordinate systems
namespace vtkAnatomicalOrientation {
enum class Axis { L, R, P, A, S, I, None };
static const Axis ValidAxes[6] = { Axis::L, Axis::R, Axis::P, Axis::A, Axis::S, Axis::I };
static std::string AxisToString(Axis axis) {
switch (axis) {
@agirault
agirault / .gitconfig
Last active March 26, 2024 16:49
Some git aliases
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[user]
name = Alexis Girault
[alias]
graph = log --graph --decorate --color --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
lg = graph --first-parent
@agirault
agirault / nslookupAlert.sh
Last active May 3, 2018 19:23
run as `./nslookupAlert.sh ${domain}` on macos to receive an alert when a domain DNS is resolved
#!/bin/bash
domain=$1
echo -ne "Looking up $domain DNS: "
while true; do
nslookup $domain | grep -q "find"
retVal=$?
if [ $retVal -ne 0 ]; then
ip=$( nslookup $domain | awk -F': ' 'NR==6 { print $2 } ')
@agirault
agirault / vegToVtu.cxx
Created January 19, 2018 20:48
vegToVtu
// in iMSTK
auto vegaMesh = MeshIO::read("/Users/agirault/Downloads/mandible.veg");
auto writeStatus = MeshIO::write(vegaMesh, "/Users/agirault/Downloads/mandible.vtu");
std::cout << writeStatus << std::endl;