Skip to content

Instantly share code, notes, and snippets.

View schluppeck's full-sized avatar

Denis Schluppeck schluppeck

View GitHub Profile
@schluppeck
schluppeck / Readme.md
Created March 20, 2025 21:38
getting SPM coordinates from MM to VOXELS

Here are some hints

Denis Schluppeck, 2025-03-20, help for DAFNI students

... on how to get from coordinates reported in MM (often with negative numbers, because images are centered on 0,0,0) to VOXEL coordinates in SPM.

The matlab script test_coords.m included below shows you how you can go about this. It should work with minor modifications. See also comment on this gist for where in SPM you can find info about locations of voxels.

@schluppeck
schluppeck / Readme_datamunging.md
Created September 26, 2024 09:37
assorted data munging tricks

Some assorted one-liners in #rstats, #zsh, etc

work in progress.

  1. Copy / paste data from #rstats
# assuming a table of eg student data in a dataframe D

library(clipr)
@schluppeck
schluppeck / roses.jl
Created May 28, 2024 21:21
Mathematical roses in a Pluto.jl notebook
### A Pluto.jl notebook ###
# v0.19.40
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
@schluppeck
schluppeck / Readme.md
Created February 6, 2024 11:18
convert DOC to DOCX in the command line

Leverage libreoffice to do this job.

Might have to install libreoffice - on macos using brew one way to do this is:

brew install  libreoffice-language-pack --cask libreoffice`

Key idea: use soffice --headless

@schluppeck
schluppeck / index.md
Created December 6, 2023 10:00
Data and Materials for PCN lab (UoN, 2022-23)

Data and spreadsheet

The 2nd year lab for the Psychology and Cognitive Neuroscience course (University of Nottingham) walks students through the main ideas behind the use of linear regression in the analysis of functional magnetic resonance imagingn (fMRI) data.

The instructor provides three selected, indicative timeseries samples from a 4d data set.

The data were acquired in a standard faces versus objects, category localiser experiment. For details, [see this FAQ document](https://schluppeck.github.io/PCN-Y2-questions/#what-were-the-stimuli

Data files:

@schluppeck
schluppeck / notes.md
Last active July 24, 2023 17:43
converting DCM to nifti

Conversion notes

Denis Schluppeck, 2023-07-21

Converting GE data via XNAT at SPMIC/Psychology. Trying to find a consistent workflow for Psychology users, especially for fMRI and related.

things to consider

  • voxel sizes 2mm isotropic to 2.5mm or even 3mm? SNR gains, data size
  • dummies. GE protocol includes data even before steady-state is reached. Therefore need to cut this by hand? Principled way of doing this in pre-processing in mrTools?
@schluppeck
schluppeck / Readme.md
Last active November 7, 2022 19:47
Matlab code for regression example from PSGY4009 class

script example from PSGY4009 / lecture 6

denis schluppeck, 2022-11-07

Make sure you have access to data. I used the following dataset / files for the demos here:

https://github.com/schluppeck/hands-on-brain-data

Download the data (click the green button, download ZIP, unzip). Or if you know how to use git/github, you can also clone the repo

@schluppeck
schluppeck / tiledStuff.m
Last active July 22, 2022 17:09
tiled layout with new matlab functions
%% example of tiled plots with shared axes and labels
%
% ds 2022-07-22
figure()
nRows = 4;
nCols = 4;
t = tiledlayout(nRows,nCols,'TileSpacing','Compact');
@schluppeck
schluppeck / find_julia_packages.md
Created March 22, 2022 22:34
find julia packages in a list of Pluto notebooks or jl files

situation

need to quickly find out which packages a set of julia files are using. in my case, this was to create an environment after the fact... so I can ship it to people who have a clean install.

quick hack: grep through .jl files and find bits of text that start with "using"

not perfect, but got me 90% of the way there

grep "^\W*using" *.jl | cut -d: -f2 | sed s/using// | tr -d "[:blank:]" | sort | uniq
@schluppeck
schluppeck / Readme.md
Last active March 24, 2021 12:31
bash looping with regexp

some ideas for looping over dirs, files w/ bash

setup some folders and files

need to have files and folders to play with. here all size 0 files, adapt to your own needs...

# create a directory and go there
cd ~