Skip to content

Commit

Permalink
Merge pull request #152 from CCC-members/develop
Browse files Browse the repository at this point in the history
Updating application
  • Loading branch information
arioskyag authored Oct 16, 2024
2 parents a54fc67 + afec9ed commit b435f9c
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 94 deletions.
89 changes: 0 additions & 89 deletions app/functions/check_version.m

This file was deleted.

44 changes: 40 additions & 4 deletions app/functions/init_processing.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,48 @@
%% ------------ Checking updates --------------------------
if(app_properties.generals.check_app_update)
disp('-->> Checking last project version');
if(isequal(check_version,'updated'))
return;
end
[updated, errors] = update_version();
iconnection = isnetav();
if(iconnection)
% loading local data
local = jsondecode(fileread(strcat('app/properties.json')));
% finding online data
url = local.generals.url_check;
matlab.net.http.HTTPOptions.VerifyServerName = false;
options = weboptions('ContentType','json','Timeout',Inf,'RequestMethod','auto');
online = webread(url,options);
disp('-->> Comparing local and master version');

if(local.generals.version_number < online.generals.version_number)
answer = questdlg({'There a new version available of CiftiStorm pipeline.',' Do you want to update the latest version?'}, ...
'Update CiftiStorm', ...
'Yes','No','Close');
% Handle response
switch answer
case 'Yes'
[updated, errors] = update_version();
if(updated)
msg = msgbox({'CiftiStorm was updated with the latest version.',...
'The application will be closed.'},'Info',"help","modal");
waitfor(msg);
end
end
else
disp('-->> Nothing to update');
end
else
disp('-->> Internet connection problems.');
if(getGlobalGuimode())
msg = msgbox({'There are some problems with your internet connection.',...
'Please check your internet conection.'},'Info',"help","modal");
waitfor(msg);
figure(app.CiftiStormUIFigure);
end
end
end

%%
%% ----------- Create CiftiStrom Database ---------------------
%%
cfs_create_db()

end
Expand Down
63 changes: 63 additions & 0 deletions app/functions/update_version.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
function [updated, errors] = update_version()
result = true;
errors = [];
% App check version
%
%
% Authors:
% - Ariosky Areces Gonzalez
% - Deirel Paz Linares
% - Pedro Valdes Sosa

% - Date: November 15, 2019
try
%% Download latest version
if(getGlobalGuimode())
d = uiprogressdlg(app.CiftiStormUIFigure,'Title','Downloading CiftiStorm latest version');
end
filename = strcat('CiftiStorm_latest.zip');
disp(strcat("-->> Downloading laster version......."));
url = local.generals.base_url;
matlab.net.http.HTTPOptions.VerifyServerName = false;
options = weboptions('Timeout',Inf,'RequestMethod','auto');
downladed_file = websave(filename,url,options);
pause(1);
if(getGlobalGuimode())
delete(d);
end

%% Unzip lasted version
if(getGlobalGuimode())
d = uiprogressdlg(app.CiftiStormUIFigure,'Title','Unziping files');
end
disp(strcat("-->> Unziping files......."));
exampleFiles = unzip(filename,pwd);
pause(1);
delete(filename);
if(getGlobalGuimode())
delete(d);
end

%% Moving files
if(getGlobalGuimode())
d = uiprogressdlg(app.CiftiStormUIFigure,'Title','Deploging the new vew version');
end
disp(strcat("-->> Deploging the new vew version......."));
movefile( strcat('CiftiStorm-ESI-master',filesep,'*'), pwd, 'f');
rmdir CiftiStorm-ESI-master ;

disp('-->> The project is already update with the laster version.');
disp('-->> The process was stoped to refresh all file');
disp('-->> Please configure the app properties file, before restart the process.');
result = 'updated';
if(getGlobalGuimode())
delete(d);
end

catch
updated = false;
return;
end
end


2 changes: 1 addition & 1 deletion app/properties.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "generals":{ "name":"Automatic Head Model Processing", "version":"v.82", "version_date":"10-15-2024", "version_number":82, "test_data_url":"", "url_check":"https://raw.githubusercontent.com/CCC-members/CiftiStorm-ESI/refs/heads/master/app/properties.json", "base_url":"https://codeload.github.com/CCC-members/CiftiStorm-ESI/zip/master", "check_matlab_version":true, "check_app_update":true }, "matlab_runtime":{ "mac":"http://ssd.mathworks.com/supportfiles/downloads/R2018b/deployment_files/R2018b/installers/maci64/MCR_R2018b_maci64_installer.dmg.zip", "win":"http://ssd.mathworks.com/supportfiles/downloads/R2018b/deployment_files/R2018b/installers/win64/MCR_R2018b_win64_installer.exe", "linux":"http://ssd.mathworks.com/supportfiles/downloads/R2018b/deployment_files/R2018b/installers/glnxa64/MCR_R2018b_glnxa64_installer.zip" }, "process_files":[ { "description":"Define StP_general_params. you can change the file and save different conbinations.", "module_id":"general_params", "file_path":"cfs_properties/general_params.json" }, { "description":"Define StP_general_params. you can change the file and save different conbinations.", "module_id":"anatomy_params", "file_path":"cfs_properties/process_import_anat.json" }, { "description":"Define StP_import_channel. you can change the file and save different conbinations.", "module_id":"channel_params", "file_path":"cfs_properties/process_import_channel.json" }, { "description":"Define StP_comp_headmodel. you can change the file and save different conbinations.", "module_id":"headmodel_params", "file_path":"cfs_properties/process_comp_headmodel.json" }, { "description":"Define StP_integration. you can change the file and save different conbinations.", "module_id":"integration_params", "file_path":"cfs_properties/process_integration.json" } ], "default_param_files":[ { "description":"Define StP_general_params. you can change the file and save different conbinations.", "module_id":"general_params", "file_path":"cfs_properties/defaults/general_params.json" }, { "description":"Define StP_general_params. you can change the file and save different conbinations.", "module_id":"anatomy_params", "file_path":"cfs_properties/defaults/process_import_anat.json" }, { "description":"Define StP_import_channel. you can change the file and save different conbinations.", "module_id":"channel_params", "file_path":"cfs_properties/defaults/process_import_channel.json" }, { "description":"Define StP_comp_headmodel. you can change the file and save different conbinations.", "module_id":"headmodel_params", "file_path":"cfs_properties/defaults/process_comp_headmodel.json" }, { "description":"Define StP_integration. you can change the file and save different conbinations.", "module_id":"integration_params", "file_path":"cfs_properties/defaults/process_integration.json" } ]}
{ "generals":{ "name":"Automatic Head Model Processing", "version":"v.83", "version_date":"10-16-2024", "version_number":83, "test_data_url":"", "url_check":"https://raw.githubusercontent.com/CCC-members/CiftiStorm-ESI/refs/heads/master/app/properties.json", "base_url":"https://codeload.github.com/CCC-members/CiftiStorm-ESI/zip/master", "check_matlab_version":true, "check_app_update":true }, "matlab_runtime":{ "mac":"http://ssd.mathworks.com/supportfiles/downloads/R2018b/deployment_files/R2018b/installers/maci64/MCR_R2018b_maci64_installer.dmg.zip", "win":"http://ssd.mathworks.com/supportfiles/downloads/R2018b/deployment_files/R2018b/installers/win64/MCR_R2018b_win64_installer.exe", "linux":"http://ssd.mathworks.com/supportfiles/downloads/R2018b/deployment_files/R2018b/installers/glnxa64/MCR_R2018b_glnxa64_installer.zip" }, "process_files":[ { "description":"Define StP_general_params. you can change the file and save different conbinations.", "module_id":"general_params", "file_path":"cfs_properties/general_params.json" }, { "description":"Define StP_general_params. you can change the file and save different conbinations.", "module_id":"anatomy_params", "file_path":"cfs_properties/process_import_anat.json" }, { "description":"Define StP_import_channel. you can change the file and save different conbinations.", "module_id":"channel_params", "file_path":"cfs_properties/process_import_channel.json" }, { "description":"Define StP_comp_headmodel. you can change the file and save different conbinations.", "module_id":"headmodel_params", "file_path":"cfs_properties/process_comp_headmodel.json" }, { "description":"Define StP_integration. you can change the file and save different conbinations.", "module_id":"integration_params", "file_path":"cfs_properties/process_integration.json" } ], "default_param_files":[ { "description":"Define StP_general_params. you can change the file and save different conbinations.", "module_id":"general_params", "file_path":"cfs_properties/defaults/general_params.json" }, { "description":"Define StP_general_params. you can change the file and save different conbinations.", "module_id":"anatomy_params", "file_path":"cfs_properties/defaults/process_import_anat.json" }, { "description":"Define StP_import_channel. you can change the file and save different conbinations.", "module_id":"channel_params", "file_path":"cfs_properties/defaults/process_import_channel.json" }, { "description":"Define StP_comp_headmodel. you can change the file and save different conbinations.", "module_id":"headmodel_params", "file_path":"cfs_properties/defaults/process_comp_headmodel.json" }, { "description":"Define StP_integration. you can change the file and save different conbinations.", "module_id":"integration_params", "file_path":"cfs_properties/defaults/process_integration.json" } ]}
Expand Down
Binary file modified guide/CiftiStorm.mlapp
Binary file not shown.

0 comments on commit b435f9c

Please sign in to comment.