-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from tincala91/nb_plugins
Implementation of plugins
- Loading branch information
Showing
13 changed files
with
65 additions
and
12,443 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
12,304 changes: 0 additions & 12,304 deletions
12,304
MASK_TEMPLATES_HC/06_Template_PET_Report_neu.rtf
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
*/ |
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,3 @@ | ||
Place the plugins in this folder. | ||
|
||
The folders in this directory will be added to path at runtime. |
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
This file was deleted.
Oops, something went wrong.
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,7 +1,8 @@ | ||
function params = get_renderer(xSPM) | ||
|
||
params.XYZ = xSPM.XYZ; | ||
params.t = xSPM.Z; | ||
params.mat = xSPM.M; | ||
params.dim = xSPM.DIM; | ||
end | ||
function params = get_renderer() | ||
global xSPM; | ||
|
||
params.XYZ = xSPM.XYZ; | ||
params.t = xSPM.Z; | ||
params.mat = xSPM.M; | ||
params.dim = xSPM.DIM; | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
function run_plugin(index, varargin) | ||
% Simple wrapper to run function from Plugins directory | ||
% with same letter index and given parameters | ||
% | ||
% The plugin script must have same name as folder, including the index | ||
|
||
cur_dir = pwd(); | ||
paths = path(); | ||
cleanup = onCleanup(@()restorePaths(paths, cur_dir)); | ||
|
||
pth = fileparts(mfilename('fullpath')); | ||
plugins_path = fullfile(pth, '..', 'Plugins'); | ||
|
||
plugins = dir(fullfile(plugins_path, [index, '_*'])); | ||
|
||
if numel(plugins) == 0 | ||
return; | ||
end | ||
|
||
if numel(plugins) > 1 | ||
warning('Plugin %s: Found several plugins, will run only first', index); | ||
end | ||
|
||
plugin_path = fullfile(plugins(1).folder, plugins(1).name); | ||
plugin_script = fullfile(plugin_path, 'plugin.m'); | ||
if ~exist(plugin_script, 'file') | ||
warning('Plugin %s: Can''t find script plugin.m', index); | ||
return; | ||
end | ||
|
||
fprintf('Plugin %s: Running from %s\n', index, plugin_path); | ||
|
||
addpath(plugin_path); | ||
plugin(varargin{:}); | ||
|
||
end | ||
|
||
|
||
function restorePaths(search_paths, current_path) | ||
path(search_paths); | ||
cd(current_path); | ||
end |