Skip to content

Instantly share code, notes, and snippets.

👨‍💻

Alexis Girault agirault

👨‍💻
  • Kitware, Inc.
  • Carrboro, NC
Block or report user

Report or block agirault

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@agirault
agirault / CMakeLists.txt
Last active Sep 17, 2019
CMake configuration for a shared ios framework linking against static Qt5 libs to be embedded in an iOS app
View CMakeLists.txt
# 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 Jun 7, 2019
Utility class to convert between anatomical coordinate systems
View vtkAnatomicalOrientation.cpp
#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 Oct 3, 2018
Some git aliases
View .gitconfig
[alias]
head = rev-parse HEAD
delete-merged = "!git branch --merged | grep -v '\\*\\|master\\|develop' | xargs -n 1 git branch -d"
fetch-pr = "!git fetch \"$1\" pull/\"$2\"/head:\"$1\"-pr-\"$2\" #"
fixup = "!REV=$(git rev-parse $1) && git commit --fixup $REV && (GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash --autostash $REV^ || (git diff && git rebase --abort && git reset --soft HEAD^ && echo "Rebase aborted")) #"
@agirault
agirault / nslookupAlert.sh
Last active May 3, 2018
run as `./nslookupAlert.sh ${domain}` on macos to receive an alert when a domain DNS is resolved
View nslookupAlert.sh
#!/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 } ')
View vegToVtu.cxx
// 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;
View qMRMLSubjectHierarchyTreeView_updateItemsSelectableFlag.cxx
//--------------------------------------------------------------------------
void qMRMLSubjectHierarchyTreeView::updateItemsSelectableFlag()
{
Q_D(qMRMLSubjectHierarchyTreeView);
if (!d->SubjectHierarchyNode)
{
return;
}
qMRMLSubjectHierarchyModel* sceneModel = qobject_cast<qMRMLSubjectHierarchyModel*>(this->model());
View vtk_pick_voxel.cpp
auto picker = vtkSmartPointer<vtkPropPicker>::New();
picker->Pick(screen_x, screen_y, 0, renderer);
// Check if pick is in bounds
vtkAssemblyPath* path = picker->GetPath();
bool validPick = false;
if (path) {
vtkCollectionSimpleIterator sit;
path->InitTraversal(sit);
vtkAssemblyNode *node;
@agirault
agirault / __git_status_flag.bash
Last active Aug 2, 2019
To put in your bash_rc
View __git_status_flag.bash
# git status with a dirty flag
function __git_status_flag {
git_status="$(git status 2> /dev/null)"
clean_pattern="working tree clean" # For macOS. For Linux: "working directory clean"
remote_pattern="Your branch is (.*)"
diverge_pattern="Your branch and (.*) have diverged"
if [[ ! ${git_status} =~ ${clean_pattern} ]]; then
state=""
fi
View TexturedOrientationWidget_GPUError_iOS.cpp
const char* objPath = ""; //orientation cube
const char* jpgPath = ""; //orientation texture
vtkRenderWindow* renderWindow = self.vtkView.renderWindow;
// Create & add the renderer
renderer = vtkSmartPointer<vtkRenderer>::New();
renderer->SetBackground(0., 0., 0.);
renderer->SetViewport(0., 0., 1., 1.);
renderer->InteractiveOn();
renderWindow->AddRenderer(renderer);
@agirault
agirault / reslice_vtkDICOM.cpp
Last active Aug 31, 2017
Reslice vtkImageData from vtkDICOMReader using patient matrix
View reslice_vtkDICOM.cpp
// Directory
const char *folderASCII = [folder cStringUsingEncoding:NSASCIIStringEncoding];
auto dicomDir = vtkSmartPointer<vtkDICOMDirectory>::New();
dicomDir->SetDirectoryName(folderASCII);
dicomDir->Update();
// Reader
auto reader = vtkSmartPointer<vtkDICOMReader>::New();
reader->SetFileNames(dicomDir->GetFileNamesForSeries(0));
//reader->SetMemoryRowOrderToFileNative();
You can’t perform that action at this time.