-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
225a307
commit 2298d1a
Showing
9 changed files
with
99 additions
and
72 deletions.
There are no files selected for viewing
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 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
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 |
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 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
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 |
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 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
Binary file not shown.
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 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