Skip to content

Instantly share code, notes, and snippets.

View MSchnei's full-sized avatar

Marian Schneider MSchnei

  • Onfido
  • London
View GitHub Profile
@MSchnei
MSchnei / psychopy_measure_luminance.py
Created June 18, 2018 11:59
Measure luminance levels of psychopy presentation
# -*- coding: utf-8 -*-
"""
Psychopy script to present and measure luminance levels (with a light meter).
Press buttons 1 and 2 to move from darker to brighter, or vice verser.
"""
from psychopy import visual, monitors, core, event
import numpy as np
# %%
@MSchnei
MSchnei / itk2fsl_trf.md
Last active December 13, 2023 15:45
Convert itk transformation matrix to fsl compatible one

Convert itk transformation matrix to fsl compatible one

Sometimes FSL tools do not immediately find a satisfactory transformation to bring two images in register. In that case, you can give the flirt algorithm a little nudge by (1.) bringing the two images roughly in the same space using itk snap's automatic and manual registration tools and only then (2.) running FSL flirt or epi_reg.

Since itksnap and FSL use different origins for their coordinate systems the transformation matrices that are produced by the two programs are not

@MSchnei
MSchnei / shiftVolByVoxel.py
Created March 30, 2017 13:35
Code snippet to shift nii data by specified number of voxels along specified axis
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 30 11:55:27 2017
@author: marian
"""
import os
import numpy as np
from nibabel import load, save, Nifti1Image