Skip to content

Instantly share code, notes, and snippets.

@ncweiler
Created December 21, 2013 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ncweiler/8075665 to your computer and use it in GitHub Desktop.
Save ncweiler/8075665 to your computer and use it in GitHub Desktop.
% downlad multichannel false-color file
get_mcfc = 1;
% token for desired project
project_token = 'Ex10R55';
% for project-specific channel list and dimensions
% view http://openconnecto.me/ocp/ca/[project_token]/info/
% channels: accessed in CYMRGB order – use zeros to skip colors.
chan_list = {'Synapsin1-2','0','PSD95-1','0','GFP-4','DAPI-1'};
% axis of view: (xy, xz, yz)
ortho = 'xy';
% resolution: (0 - full-scale, 1 - half-scale, 2 - quarter scale)
res = '0';
% data ranges to display: (must be within dataset dimensions @ res)
% enter axis ranges (ie. 'x-min,x-max') for viewed axes
% enter single value for un-viewed axis
% eg: for ortho=='xy', pick a range for x & y, but a single value for z
xbounds = '400,900';
ybounds = '400,900';
zbounds = '15';
% save mcfc to file? (otherwise just load into workspace)
mcfc_savefile = 1;
mcfc_file = 'Ex10R55_C-Syn1_M-PSD_G-GFP_B-DAPI_x-400-900_y-400-900_z-15.png';
% display result in figure
mcfc_show = 1;
%% single-section mcfc
if get_mcfc
% channels accessed in CYMRGB order.
% Use zeros to skip colors.
chan_str = strjoin(chan_list,',');
% output filename
% url arguments
server_base = 'openconnecto.me';
webservice_name = 'ocp/ca';
restful_str = strjoin({res,xbounds,ybounds,zbounds},'/');
% compose url from arguments above:
mcfc_url = sprintf('http://%s/%s/%s/mcfc/%s/%s/%s/',...
server_base, webservice_name, project_token, ortho, chan_str,restful_str)
% download url to file and load to workspace
% or just download url to workspace
if mcfc_savefile
urlwrite(mcfc_url,mcfc_file);
mcfc_data = imread(mcfc_file,'png');
else
mcfc_data = imread(mcfc_url,'png');
end
end
% show data in figure
if mcfc_show && exist('mcfc_data','var')
figure; imshow(mcfc_data)
title(regexprep(mcfc_file(1:end-4),'_',' '))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment