Skip to content

Instantly share code, notes, and snippets.

View schluppeck's full-sized avatar

Denis Schluppeck schluppeck

View GitHub Profile
function b = most_change(a)
% most_change - calculate who is richest
%
% ds 2019-11-12, cody problem #9
money = a .* [0.25 0.1 0.05 0.01];
total_money = sum(money, 2);
function y = pizza(z,a)
% pizza - calculate the volume of a pizza
%
% ds, 2019-11, cody problem 167
% area of pizza
% A = pi .* z .^ 2;
% volume
% y = A .* a;
@schluppeck
schluppeck / Readme.md
Last active October 31, 2019 13:12
graphs in matlab

Graphs in Matlab

example of using graph (in mathematical sense) functions. H/t to question from lpycmm during last matlab lab class

ds 2019-10-31, halloween. denis schluppeck

tl;dr

Matlab is awesome and of course there is a way to do it - even though I didn't know too much about all the available functions until I started looking a bit more 😉

@schluppeck
schluppeck / Readme.md
Last active October 27, 2019 21:53
Reality check on design matrices

Reality check on design matrices

Denis Schluppeck, 2019-10-27

A quick note to answer some questions that came up during a Functional Imaging Methods class (related to GLM/design matrices).

Including a quick example of

  1. how to load in txt files (matlab code)
  2. look at design matrix
@schluppeck
schluppeck / Readme.md
Last active September 16, 2019 12:29
creating anaglyph renderings of surface files

Assuming you have some vtk or similar files, you use paraview with appropriate flags to start up in 3d render mode"

/Applications/ParaView-5.5.0.app/Contents/MacOS/paraview --stereo --stereo-type=Anaglyph

For freesurfer files and related, you will first have to convert to appropriate format, using mris_convert.

eye candy

@schluppeck
schluppeck / getManyStimImages.m
Created July 9, 2019 11:58
get pRF stim images from mat file
% getting pRFStimImage from multiple files
%
% ds 2019-07-09
% task: get stimimage info out of mat file
% go to Etc folder of mrLoadRet directory
cd('Etc')
% find mat files that fit the bill (only retinotopy type)
# brew install ffmpeg if required
# then assuming you want to save out a canon Quicktime-trimmed MOV file to MP4 (for eg. twitter)
ffmpeg -i resized.mov -vcodec h264 -acodec mp2 resized-twitter.mp4

example of using montage()

... with rendered zstat images from fsl (cf https://schluppeck.github.io/dafni/matlab_images/)

The matlab montage command can handle different colormaps, indices, etc. Check out the documentation and also have a look at the snipptes of code in montageWithRender.m, which produces acceptable results:

render zstat in montage

doc montage()
if (!require("pacman")) install.packages("pacman")
pacman::p_load(dplyr, venneuler)
pacman::p_load_current_gh('trinker/textshape', 'thomasp85/ggforce')
x <- matrix(sample(0:4, 80, TRUE, c(.6, .1, .1, .1, .1)), ncol=4)
colnames(x) <- LETTERS[1:4]
license: gpl-3.0
height: 700
scrolling: no
border: yes