This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Mutual Information | |
% This shows why mutual information is important for registration, more-so | |
% than another metric like the least sum of squares. | |
% VSoch July 2013 | |
% First, let's read in two pickle images that we want to register | |
% Note - this is a picture I found on google search, and I transformed it in | |
% photoshop by moving it down and right, and then CONTROL+I to get the inverse | |
pickle1 = imread('pickle1.png'); | |
pickle2 = imread('pickle2.png'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Multidimensional scaling (MDS) Example | |
% Load matlab cities data | |
load cities | |
% This data has cities in rows, and different categories for ratings in | |
% columns. We will implement MDS to assess city similarity based on | |
% ratings. | |
% Step 1: Set up our proximity matrix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function print_dr_report(imgfolder) | |
% This function takes a folder of images produced by visual_dr | |
% and prints and html report page | |
filey = fopen([imgfolder 'index.html' ],'w'); | |
% Print top of html file | |
fprintf(filey,'%s\n','<html><body><h2>Dual Regression Report</h2>'); | |
% Get all images in folder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cytoscapeExport(links,weights,threshold,exptype) | |
% This function will take a list of links and weights, and create a file to | |
% import into Cytoscape for further graph analysis | |
% exptype is the export type - 'all' means voxelwise above a threshold, | |
% 'region' means creating graph of average regional values | |
% links is an n by 2 list of connections, each a voxel id | |
% weights is a correlation value corresponding to each link set |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function flat = flattenSphere(mr) | |
% First read in sphere files and vox mapping | |
%vox = spm_read_vols(spm_vol('NDARAK333GZA.lh.vtxvol.nii')); | |
mr = spm_read_vols(spm_vol(mr)); | |
% First create a random maximum length - we will crop at the end | |
maxlength = floor(pi*size(mr,1)); | |
% Now go through vox image and save vector of x,y,z coordinates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function feature = nc_kurtosis_spatial(spatialMap) | |
% FEATURE NAME: Kurtosis | |
% FEATURE TYPE: spatial.gist | |
% We take a component image, sum the voxel values quadrupled, and divide by the | |
% number of voxels, subtract 3. We then normalize the value by linear scaling transform of abs(ln(kurtosis)) | |
% This does the same thing as doing kurtosis(curr_network(:)) | |
ICkurt = sum(power(spatialMap,4)) / length(spatialMap(:)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This function will use plotly to create an online boxplot! | |
plotlyBox = function(username,key,datastore) { | |
# Username is your plotly username | |
# API key is found via plot.ly, login --> Access plotly --> settings | |
# datalist is a list of data | |
# The number of plots, N, is determined by length(N) | |
# Eg, put your data into a list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
""" | |
searchNdar: reads in a set of strings from file, and search behavioral metrics | |
to find questions / subscales that might be of interest | |
python searchNdarLocal.py --o outfile --i /home | |
/vanessa/Documents/Work/NDAR/behavioral -w input.txt | |
--o is the outfile name, without extension |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exportRWeka = function(data,relation_name,outname) { | |
# Data is a data matrix, with features in columns, data in rows | |
# Edit the script to match whatever is the missing value for your data | |
# Rownames will be exported as well, and should be data labels | |
# relation_name is the name of the relation in Weka | |
# outname is the output file | |
# If you have a nominal outcome variable (eg, you want to color | |
# your data by a label in Weka) change the variable type as follows: | |
# @attribute groupVar {1,2} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
""" | |
clinPheno: Methods for querying a SQL database of clinical | |
variables to establish a clinical phenotype. The script will | |
search a data dictionary (database) for a set of user specified | |
terms (in some input.txt file), and then extract the matches | |
from the clinical database, for import into R (see clinPhenoR.R) | |
# SAMPLE INPUT.TXT file: |
OlderNewer