Skip to content

Commit

Permalink
Moved installable items to menu.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreashorn committed Sep 5, 2016
1 parent 225a307 commit 2298d1a
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 72 deletions.
16 changes: 8 additions & 8 deletions connectomics/mapper/connectome.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,33 +115,33 @@ if [ -z $filename ]
then # split jobs for fMRI and dMRI
cmd="/autofs/cluster/nimlab/connectomes/software/lead_dbs/connectomics/mapper/run_cs_conseed.sh /usr/pubsw/common/matlab/8.6 1 0 /autofs/cluster/nimlab/connectomes/ $line $command $writesingle $outputfolder $maskname"
echo $cmd
pbsubmit -q highio -l vmem=20gb -c "$cmd"
pbsubmit -q highio -l vmem=30gb -c "$cmd"
cmd="/autofs/cluster/nimlab/connectomes/software/lead_dbs/connectomics/mapper/run_cs_conseed.sh /usr/pubsw/common/matlab/8.6 0 1 /autofs/cluster/nimlab/connectomes/ $line $command $writesingle $outputfolder $maskname"
echo $cmd
pbsubmit -q highio -l vmem=20gb -c "$cmd"
pbsubmit -q highio -l vmem=30gb -c "$cmd"
else
cmd="/autofs/cluster/nimlab/connectomes/software/lead_dbs/connectomics/mapper/run_cs_conseed.sh /usr/pubsw/common/matlab/8.6 $dofMRI $dodMRI /autofs/cluster/nimlab/connectomes/ $line $command $writesingle $outputfolder $maskname"
echo $cmd
pbsubmit -q highio -c "$cmd"
fi
pbsubmit -q highio -l vmem=30gb highio -c "$cmd"
fi
done < "$filename"
else
if [ $doboth == 1 ]
then # split jobs for fMRI and dMRI
cmd="/autofs/cluster/nimlab/connectomes/software/lead_dbs/connectomics/mapper/run_cs_conseed.sh /usr/pubsw/common/matlab/8.6 1 0 /autofs/cluster/nimlab/connectomes/ $filename $command $writesingle $outputfolder $maskname"
echo $cmd
pbsubmit -q highio -l vmem=20gb -c "$cmd"
pbsubmit -q highio -l vmem=30gb -c "$cmd"
cmd="/autofs/cluster/nimlab/connectomes/software/lead_dbs/connectomics/mapper/run_cs_conseed.sh /usr/pubsw/common/matlab/8.6 0 1 /autofs/cluster/nimlab/connectomes/ $filename $command $writesingle $outputfolder $maskname"
echo $cmd
pbsubmit -q highio -l vmem=20gb -c "$cmd"
pbsubmit -q highio -l vmem=30gb -c "$cmd"
else
echo $cmd
pbsubmit -q highio -l vmem=20gb -c "$cmd"
pbsubmit -q highio -l vmem=30gb -c "$cmd"
fi
fi

else
# submit to actual script:
# run actual script:
echo $cmd
$cmd
fi
Expand Down
80 changes: 50 additions & 30 deletions ea_checkinstall.m
Original file line number Diff line number Diff line change
@@ -1,51 +1,71 @@
function success=ea_checkinstall(cmd,force)
function [success,commands]=ea_checkinstall(cmd,force)
success=1;
earoot=ea_getearoot;
if ~exist('force','var')
force=0;
end
switch cmd
case 'list' % simply return list of installable datasets
success={'Big Brain 100um subcortical (Amunts 2013)','Lead-DBS Macaque Toolbox','Structural group connectome (Horn 2013)'};
commands={'bigbrain','macaque','groupconnectome2013'};
case 'bigbrain'
if ~exist([earoot,'templates',filesep,'bigbrain_2015_100um_bb.nii'],'file') || force
disp('BigBrain not installed. Downloading...')
try
websave([earoot,'templates',filesep,'bigbrain_2015_100um_bb.nii.gz'],'http://www.lead-dbs.org/release/data/bigbrain_2015_100um_bb.nii.gz');
gunzip([earoot,'templates',filesep,'bigbrain_2015_100um_bb.nii.gz']);
catch
success=0;
end
try delete([earoot,'templates',filesep,'bigbrain_2015_100um_bb.nii.gz']); end
try delete([earoot,'templates',filesep,'bigbrain_2015_100um_bb.nii.gz.html']); end
checkf=[earoot,'templates',filesep,'bigbrain_2015_100um_bb.nii'];
force=ea_alreadyinstalled(checkf);
if ~exist(checkf,'file') || force
success=ea_downloadasset('Bigbrain 100um subcortical',...
[earoot,'templates',filesep,'bigbrain_2015_100um_bb.nii.gz'],...
'http://www.lead-dbs.org/release/data/bigbrain_2015_100um_bb.nii.gz');
else
disp('BigBrain is installed.')
end
case 'macaque'
if ~exist([earoot,'toolbox',filesep,'macaque'],'file') || force
disp('Macaque toolbox not installed. Downloading...')
try
websave([earoot,'toolbox',filesep,'macaque.zip'],'http://www.lead-dbs.org/release/download.php?id=macaque');
unzip([earoot,'toolbox',filesep,'macaque.zip']);
catch
success=0;
end
try delete([earoot,'toolbox',filesep,'macaque.zip']); end
try delete([earoot,'toolbox',filesep,'macaque.zip.html']); end
checkf=[earoot,'toolbox',filesep,'macaque'];
force=ea_alreadyinstalled(checkf);
if ~exist(checkf,'file') || force
success=ea_downloadasset('Lead-DBS Macaque toolbox',...
[earoot,'toolbox',filesep,'macaque.zip'],...
'http://www.lead-dbs.org/release/download.php?id=macaque');
else
disp('Macaque toolbox is installed.')
end
case 'groupconnectome2013'
if ~exist([ea_getconnectomebase('dmri'),'Groupconnectome (Horn 2013) full.mat'],'file') || force
try
websave([ea_getconnectomebase('dmri'),'groupconnectome2013.zip'],'http://www.lead-dbs.org/release/download.php?id=group');
unzip([ea_getconnectomebase('dmri'),'groupconnectome2013.zip']);
catch
success=0;
end
try delete([ea_getconnectomebase('dmri'),'groupconnectome2013.zip']); end
try delete([ea_getconnectomebase('dmri'),'groupconnectome2013.zip.html']); end
checkf=[ea_getconnectomebase('dmri'),'Groupconnectome (Horn 2013) full.mat'];
force=ea_alreadyinstalled(checkf);
if ~exist(checkf,'file') || force
success=ea_downloadasset('structural group connectome (Horn 2013)',...
[ea_getconnectomebase('dmri'),'groupconnectome2013.zip'],...
'http://www.lead-dbs.org/release/download.php?id=group');
else
disp('Group Connectome (Horn 2013) is installed.')
end
otherwise
success=0;
end


function success=ea_downloadasset(assetname,destination,URL)
success=1;
disp(['Downloading ',assetname,'...'])
try
websave(destination,URL);
unzip(destination);
catch
success=0;
end
try delete(destination); end
try delete([destination,'.html']); end


function force=ea_alreadyinstalled(checkf)
if ~exist(checkf,'file') % then file not there, should install anyways.
force=1;
return
end
choice = questdlg('This dataset seems already to be installed. Do you wish to re-download it?', ...
'Redownload Dataset?', ...
'Yes','No','No');
if strcmp(choice,'Yes')
force=1;
else
force=0;
end
8 changes: 8 additions & 0 deletions ea_corrplot.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@


X=varargin{1};
try
description=varargin{2};
catch
description='';
end
try
labels=varargin{3};
catch
labels='';
end
if nargin==4
handles=varargin{4};
end
Expand Down
14 changes: 14 additions & 0 deletions helpers/ea_menuinstall.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function ea_menuinstall(~,~,cmd,force)

choice=questdlg(['Please confirm to start downloading dataset: ',cmd],'Download additional data','Proceed','Cancel','Proceed');

if ~strcmp(choice,'Proceed')
return
end

success=ea_checkinstall(cmd,force);
if ~success
errordlg([cmd,' dataset could not be installed.']);
else
msgbox([cmd,' successfully installed.']);
end
8 changes: 8 additions & 0 deletions helpers/gui/ea_menu_initmenu.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@ function ea_menu_initmenu(handles,cmd)
ea_menu_addsubmit(handles);
setappdata(handles.leadfigure,'menuprobe',1);
end

% always add install addons
g = uimenu('Label','Install');
[list,commands]=ea_checkinstall('list');
for l=1:length(list)
uimenu(g,'Label',list{l},'Callback',{@ea_menuinstall,commands{l},0});
end

end
12 changes: 6 additions & 6 deletions lead.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,7 @@ function lead_OpeningFcn(hObject, eventdata, handles, varargin)
guidata(hObject, handles);

earoot=ea_getearoot;
if ~isdeployed
addpath(genpath(earoot));
rmpath(genpath([earoot,'.git']));
rmpath(genpath([earoot,'release']));
end


% check for commands first
if nargin>3
Expand Down Expand Up @@ -103,7 +99,11 @@ function lead_OpeningFcn(hObject, eventdata, handles, varargin)
end

end

if ~isdeployed
addpath(genpath(earoot));
rmpath(genpath([earoot,'.git']));
rmpath(genpath([earoot,'release']));
end

set(handles.leadfigure,'name','Welcome to the Lead Neuroimaging Suite');

Expand Down
Binary file modified lead_dbs.fig
Binary file not shown.
30 changes: 2 additions & 28 deletions lead_dbs.m
Original file line number Diff line number Diff line change
Expand Up @@ -130,21 +130,7 @@ function lead_dbs_OpeningFcn(hObject, eventdata, handles, varargin)



% check if group connectome files are present
if ~exist([ea_getconnectomebase('dmri')],'file') || ...
~exist([ea_getconnectomebase('dmri'),'Groupconnectome (Horn 2013) full.mat'],'file') || ...
~exist([ea_getconnectomebase('dmri'),'Groupconnectome (Horn 2013) thinned out x 2.mat'],'file') || ...
~exist([ea_getconnectomebase('dmri'),'Groupconnectome (Horn 2013) thinned out x 5.mat'],'file') || ...
~exist([ea_getconnectomebase('dmri'),'Groupconnectome (Horn 2013) thinned out x 5.mat'],'file') || ...
~exist([ea_getconnectomebase('dmri'),'Groupconnectome (Horn 2013) thinned out x 10.mat'],'file') || ...
~exist([ea_getconnectomebase('dmri'),'Groupconnectome (Horn 2013) thinned out x 50.mat'],'file') || ...
~exist([ea_getconnectomebase('dmri'),'Groupconnectome (Horn 2013) thinned out x 100.mat'],'file') || ...
~exist([ea_getconnectomebase('dmri'),'Groupconnectome (Horn 2013) thinned out x 500.mat'],'file')
set(handles.dlgroupc,'Visible','on');
set(handles.dlgroupc,'BackgroundColor',[0.2,0.8,0.2]);
else
set(handles.dlgroupc,'Visible','off');
end



%im = imread('bg_gui.png');
Expand Down Expand Up @@ -1122,19 +1108,7 @@ function viewmanual_Callback(hObject, eventdata, handles)
web('http://www.lead-dbs.org/?page_id=71', '-browser')


% --- Executes on button press in dlgroupc.
function dlgroupc_Callback(hObject, eventdata, handles)
% hObject handle to dlgroupc (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
choice = questdlg('Lead will download and install the Horn 2013 Group connectome files. This may take a while...', ...
'Start GC Download', ...
'OK','Cancel','OK');
earoot=[ea_getearoot];
if strcmp(choice,'OK')
disp('Downloading Horn 2013 Group Connectome');
success=ea_checkinstall('groupconnectome2013',force);
end



% --- Executes on selection change in vizspacepopup.
Expand Down
3 changes: 3 additions & 0 deletions lead_group.m
Original file line number Diff line number Diff line change
Expand Up @@ -2388,15 +2388,18 @@ function calcgroupconnectome_Callback(hObject, eventdata, handles)
normalized_fibers_mm=[]; % combined connectome
allidx=[];
ea_dispercent(0,'Concatenating connectome');
maxfibno=0;
for sub=1:length(M.patient.list)
ea_dispercent(sub/length(M.patient.list));

[nfibs,idx]=ea_loadfibertracts([M.patient.list{sub},filesep,options.prefs.FTR_normalized]);
idx=idx(1:20000); % only use first 20k fibers of each subject.
sumidx=sum(idx);
nfibs=nfibs(1:sumidx,:);
nfibs(:,4)=nfibs(:,4)+maxfibno; % add offset
normalized_fibers_mm=[normalized_fibers_mm;nfibs];
allidx=[allidx;idx];
maxfibno=max(normalized_fibers_mm(:,4));
end
ea_dispercent(1,'end');
ea_savefibertracts([M.ui.groupdir,options.prefs.FTR_normalized],normalized_fibers_mm,allidx,'mm');
Expand Down

0 comments on commit 2298d1a

Please sign in to comment.