Skip to content

Instantly share code, notes, and snippets.

@wrgr
wrgr / timing_tests.py
Last active July 6, 2016 19:16
Timing Tests
# cube aligned
import ndio.remote.neurodata as neurodata
from time import time
import numpy as np
import ndparse as ndp
# slice
start = time()
nd = neurodata(chunk_size=1e5)
xy = nd.get_xy_slice('kasthuri11cc','image',4096,4096+1024,4096,4096+1024,1,resolution=1)
@wrgr
wrgr / neuromorpho_stats_v1.m
Created January 9, 2016 19:20
intro to trees toolbox with swc files
addpath(genpath('TREES1.15'))
start_trees
files = dir('*.swc');
for i = 1:length(files)
trees{i} = load_tree(files(i).name);
end
for i = 1:length(trees)
try
@wrgr
wrgr / hpc_approach.md
Last active November 15, 2015 22:46
HPC_approach

NeuroData HPC (v0.1)

W. Gray Roncal &c

Current Strategy

Our current approach is to divide workflows into labeling, train, evaluate, and deploy.

The tools for processing exist in a variety of languages and frameworks, but these are the predominant use-cases.

@wrgr
wrgr / basic_python_upload.py
Created October 24, 2015 18:34
basic_python_upload.py
import glob
import os
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import ndio.remote.OCP as OCP
dir = '/Users/graywr1/Downloads/temp'
os.chdir(dir)
@wrgr
wrgr / astroseg1.m
Created May 26, 2015 15:33
astrocytes for sandra
%% for Sandra
im = imread('~/Downloads/mGCaMP3 IEM SomatosensoryCx-bottom.jpg');
%experiment until you're happy
figure, imagesc(im<40)
it = im < 40;
itd = imdilate(it, strel('disk', 15));
figure, imagesc(itd)
rp = regionprops(itd,'PixelIdxList','Area');
@wrgr
wrgr / ocp_upload_voxel_list.m
Created April 24, 2015 00:37
ocp_upload_voxel_list
function ocp_upload_voxelList(server, token, RAMONVolume, protoRAMON, useSemaphore)
% W. Gray Roncal
% Function to upload objects in a RAMON volume as a voxelList
% Requires that all objects begin from a common prototype, and that
% RAMONVolume has appropriate fields (in particular resolution and XYZ
% offset)
% This only supports anno32 data for now and the preserve anno option
function metrics = pr_eval(detectVol, truthVol)
% W. Gray Roncal - 02.12.2015
% Feedback welcome and encouraged. Let's make this better!
% Other options (size filters, morphological priors, etc. can be added.
% z = rand(100,100);
% t = z > 0.8;
%
tic
%% params
@wrgr
wrgr / UpDown_RAMON_Sample.m
Last active January 25, 2016 00:53
Upload/Download RAMON Objects
% Updated to channel conventions and data migrations as of 01.24.2016
% Demonstrates downloading from the server and uploading from the server (best practices)
% W. Gray Roncal
% Assumes CAJAL is on your path
oo = OCP();
oo.setServerLocation('http://openconnecto.me');
oo.setImageToken('kasthuri11cc');
oo.setAnnoToken('ac3ac4');
oo.setAnnoChannel('ac4_neuron_truth');
@wrgr
wrgr / Server Upload Test
Last active August 29, 2015 14:14
Test to upload data to OCP
% W Gray Roncal - 01.29.2015
% Server upload test - demonstrates server write timing test and dense uploading best practices
%% Get Data
% View data cuboid here (100 megavoxels)
% http://braingraph1dev.cs.jhu.edu/ocp/overlay/0.7/ac4/xy/1/4400,5424/5440,6464/1100/
% Careful to use an API version compatible with the server
ocp = OCP();
ocp.setServerLocation('http://braingraph1.cs.jhu.edu');
ocp.setImageToken('kasthuri11cc');
@wrgr
wrgr / matlab_crash_course_pt1.m
Created January 14, 2015 01:22
MATLAB Intro - Crash Course Part 1
% Connectomics Class Matlab Crash Course - Part 1
% WRGR, 01.15.2015
x = 4 %init a variable
x = 4; %with no output
x %view variable
x = 5 %now x is 5
clear x %delete x
x = [5 4 3 2] %make a vector
whos x %examine variable