Skip to content

Instantly share code, notes, and snippets.

View jhlegarreta's full-sized avatar
:octocat:
📖

Jon Haitz Legarreta Gorroño jhlegarreta

:octocat:
📖
View GitHub Profile
@jhlegarreta
jhlegarreta / fibertractmeasurements_slicerpy_anon.py
Created July 5, 2023 22:15
Compute tractography measures using Slicer FiberTractMeasurements module
# -*- coding: utf-8 -*-
import subprocess
#import slicer
#from slicer.ScriptedLoadableModule import *
def run_command(command, out_path):
@jhlegarreta
jhlegarreta / CMakeLists.txt
Created December 27, 2022 00:32
Including `itkDCMTKFileReader.h` in a test file produces a compiler error
itk_module_test()
set(ITKIODCMTKTests
itkDCMTKGetDicomTagsTest.cxx
itkDCMTKImageIOTest.cxx
itkDCMTKRGBImageIOTest.cxx
itkDCMTKSeriesReadImageWrite.cxx
itkDCMTKSeriesStreamReadImageWrite.cxx
itkDCMTKImageIOOrthoDirTest.cxx
itkDCMTKMultiFrame4DTest.cxx
itkDCMTKLoggerTest.cxx
@jhlegarreta
jhlegarreta / fury_tighten_camera_issue.py
Created July 26, 2021 20:54
fury camera tighten not working as expected
import os
import nibabel as nib
from dipy.data import fetch_bundles_2_subjects, read_bundles_2_subjects
from fury import window, actor
fetch_bundles_2_subjects()
fname_t1 = os.path.join(
os.path.expanduser('~'), '.dipy', 'exp_bundles_and_maps',
'bundles_2_subjects', 'subj_1', 't1_warped.nii.gz')
@jhlegarreta
jhlegarreta / fury_snapshot_anatomical_orientation.py
Created July 20, 2021 20:03
fury amatomical orientation scene vs snapshot issue
import os
import nibabel as nib
from dipy.data import fetch_bundles_2_subjects, read_bundles_2_subjects
from fury import window, actor
fetch_bundles_2_subjects()
fname_t1 = os.path.join(
os.path.expanduser('~'), '.dipy', 'exp_bundles_and_maps',
'bundles_2_subjects', 'subj_1', 't1_warped.nii.gz')
@jhlegarreta
jhlegarreta / fury_streamline_vis.py
Created June 30, 2021 14:50
fury streamline actor partially occluded by volume slice
import os
import nibabel as nib
from dipy.data import fetch_bundles_2_subjects, read_bundles_2_subjects
from fury import window, actor
fetch_bundles_2_subjects()
fname_t1 = os.path.join(
os.path.expanduser('~'), '.dipy', 'exp_bundles_and_maps',
'bundles_2_subjects', 'subj_1', 't1_warped.nii.gz')
@jhlegarreta
jhlegarreta / umap_sparse.py
Created October 13, 2018 19:08 — forked from johnhw/umap_sparse.py
1 million prime UMAP layout
### JHW 2018
import numpy as np
import umap
# This code from the excellent module at:
# https://stackoverflow.com/questions/4643647/fast-prime-factorization-module
import random
@jhlegarreta
jhlegarreta / neural-style.py
Created September 9, 2018 15:55
Pytorch tutorials for Neural Style transfer
"""
Pytorch tutorials for Neural Style transfer
https://github.com/alexis-jacq/Pytorch-Tutorials
"""
# Packages
from PIL import Image
import torch
from torch import nn, optim
from torch.autograd import Variable
@jhlegarreta
jhlegarreta / git-log-to-tikz.rb
Created November 16, 2017 18:23 — forked from lckarssen/git-log-to-tikz.rb
Extract git history to tikz picture
#!/usr/bin/env ruby
# A small ruby script to extract a git history to a tikz picture
# Author: Michael Hauspie <Michael.Hauspie@lifl.fr>
# Author: Lennart C. Karssen <lennart@karssen.org>
#
# Not clean code, not always working well, but does its job in most of
# the cases I needed :)
#
# LCK: Added some ideas from this tex.stackexchange answer: