Skip to content

Instantly share code, notes, and snippets.

@divyanganar
divyanganar / brain_age_prediction.m
Last active May 7, 2020 12:43
brain_age_prediction
% to organise my data and get the same variables from it
% lh_thickness_VarNames = all_data.Properties.VariableNames(82:115);
% rh_thickness_VarNames = all_data.Properties.VariableNames(119:152);
% lh_volume_VarNames = all_data.Properties.VariableNames(156:189);
% rh_volume_VarNames = all_data.Properties.VariableNames(192:225);
% lh_subcortical_VarNames = all_data.Properties.VariableNames([232,233,234,235,239,240,242]);
% rh_subcortical_VarNames = all_data.Properties.VariableNames([250,251,252,253,254,255,256]);
% lh_area_VarNames = all_data.Properties.VariableNames(8:41);
% rh_area_VarNames = all_data.Properties.VariableNames(45:78);
@divyanganar
divyanganar / wm_csf_signal_regression.m
Last active March 20, 2020 06:21
White matter and CSF signal regression using Matlab and FSL
path = '/data/nimble/work/Divyangana_Rakesh/resting_state/t3/fmriprep';
subjectNames = dir(sprintf('%s',path));
subs = startsWith({subjectNames.name},'sub') & ~contains({subjectNames.name},'.html');
subject_names = {subjectNames.name};
subject_names = subject_names(subs);
TR = 1.4;
@divyanganar
divyanganar / bandpass_filter_fsl.m
Last active July 15, 2019 05:54
Bandpass filter with FSL's fslmaths using Matlab
path = '/data/nimble/work/Divyangana_Rakesh/resting_state/t3/fmriprep';
subjectNames = dir(sprintf('%s',path));
subs = startsWith({subjectNames.name},'sub') & ~contains({subjectNames.name},'.html');
subject_names = {subjectNames.name};
subject_names = subject_names(subs);
TR = 1.4;
upper=((1/TR)/2)*100; upper=num2str(upper);
@divyanganar
divyanganar / fwd.m
Last active April 25, 2022 04:21
MATLAB function to calculate framewise displacement from 6 motion parameters
function [mat, fwd_percent] = fwd(subj_numb, filename, exit_file, csv_file, run)
mat = textread(filename);
radius = 50; %mm
ts = mat;
temp = mat(:,4:6)*180/pi; %convert to degrees
temp = (2*radius*pi/360)*temp;
ts(:,4:6) = temp;
dts = diff(ts);
fwd = sum(abs(dts),2);
a = 0.0;
@divyanganar
divyanganar / instructions_for_pnda.md
Last active April 8, 2019 00:23
PNDA Docker Instructions

Things that need to be done before the workshop:

  1. Please ensure that you have a laptop with a 64 bit OS for the workshop
  2. If you haven't had your imaging lab induction: please ask Chester to create an account for you on at least one of the imaging computers (for remote access). You don't need to do the induction with him yet, this is just to ensure that you can remotely access and copy some files.
  3. Please open an account with spartan (https://dashboard.hpc.unimelb.edu.au/getting_started/). Best to do this today because it can take a couple of days for the request to get approved.
  4. Install docker and run the command per the instructions below

Instructions for Docker

%% make a cell array of all subject names
% defines the path for the data, extracts the directory names
path = '/Users/Divyangana/Desktop/orwa/orwa_rest/';
subs = dir(path);
% creates a boolean array for all directories that start with 1 (which is our subject ids)
index_for_directories = startsWith({subs.name},'1');
% creates a cell array of all directories in the path (subject ids + other folders)
#!/bin/bash
echo "starting to convert files from old to bids format..."
i=0
for sub_path in ./old/*; do
let "i+=1"
printf -v index "%02d" $i