diff --git a/connectome_evaluator.m b/connectome_evaluator.m index bb71851..7b0b9f4 100644 --- a/connectome_evaluator.m +++ b/connectome_evaluator.m @@ -55,10 +55,10 @@ % We brighten the symbols to use them as background. Generate_Fig3_paper_Caiafa_Pestilli('gray') -% We load the FE structure from the file path stored locally on the SCA -% configuration file. -% -load(config.input_fe) +% If we were about to read from disk the path to the input FE strcutre we +% should now be abel to load it. +disp('Loading FE strcutre from sca config file...') +load(config.input_fe); % We use the core function feGet.m to extract the RMSE and the B0 (MRI % measureemnts without the diffusion-weighted gradient applied). @@ -69,15 +69,16 @@ % We find the positive weights and disregard the NaNs. THen compute the % number of postive weights (number of fascicles with non-zero weight, alse % referred to as conenctome density). + output_sbj.nnz = feGet(fe,'connectome density'); % Finally we add the new data point to the plot we have generted. This si % doen by plotting connectome density on the ordinate and RMSE on the % abscissa. -fh = Add_new_data_point(output_sbj,'cold',2) +fh = Add_new_data_point(output_sbj,'cold',2); % Write figure to disk. -fig_file_name = feSavefig(h,) +%fig_file_name = feSavefig(h,) % Try to modify the jason file % @@ -88,7 +89,32 @@ end +% % Below is a series of local helper functions. +% +function [] = Add_new_data_point(sbj,color_type,order) +% +% This function adds a new data point precomputed into the scater plot that +% compares connectome prediction error and resolution. +% +c = getNiceColors(color_type); + +%% scatter plot +a = 0.5; + +switch sbj.alg + case 'PROB' + plot(sbj.rmse, sbj.nnz,'o','markerfacecolor',c(order,:),'markeredgecolor','k','linewidth',a,'markersize',14,'DisplayName',[sbj.name,' ',sbj.alg]) + case 'DET' + plot(sbj.rmse, sbj.nnz,'s','markerfacecolor',c(order,:),'markeredgecolor','k','linewidth',a,'markersize',14,'DisplayName',[sbj.name,' ',sbj.alg]) + case 'TENSOR' + plot(sbj.rmse, sbj.nnz,'d','markerfacecolor',c(order,:),'markeredgecolor','k','linewidth',a,'markersize',14,'DisplayName',[sbj.name,' ',sbj.alg]) +end + +drawnow + +end + function [] = Generate_Fig3_paper_Caiafa_Pestilli(color_mode) % % Load data from the demo data repositroy and geenrate a plot similar to @@ -327,29 +353,5 @@ end -function [] = Add_new_data_point(sbj,color_type,order) -% -% This function adds a new data point precomputed into the scater plot that -% compares connectome prediction error and resolution. -% -c = getNiceColors(color_type); - -%% scatter plot -a = 0.5; - -switch sbj.alg - case 'PROB' - plot(sbj.rmse, sbj.nnz,'o','markerfacecolor',c(order,:),'markeredgecolor','k','linewidth',a,'markersize',14,'DisplayName',[sbj.name,' ',sbj.alg]) - case 'DET' - plot(sbj.rmse, sbj.nnz,'s','markerfacecolor',c(order,:),'markeredgecolor','k','linewidth',a,'markersize',14,'DisplayName',[sbj.name,' ',sbj.alg]) - case 'TENSOR' - plot(sbj.rmse, sbj.nnz,'d','markerfacecolor',c(order,:),'markeredgecolor','k','linewidth',a,'markersize',14,'DisplayName',[sbj.name,' ',sbj.alg]) -end - -drawnow - -end - - diff --git a/main.m b/main.m index 2b0f59a..acdadc3 100644 --- a/main.m +++ b/main.m @@ -1,4 +1,8 @@ - +function config = main() +% +% +% +% disp('loading application paths') %TODO - move this to more permanent location - probably even /N/soft? @@ -8,15 +12,15 @@ addpath('lib') -%disp("loading demo data") -%addpath(genpath('/N/dc2/scratch/hayashis/sca/demo_data_encode')) +disp('loading demo data') +addpath(genpath('/N/dc2/scratch/hayashis/sca/demo_data_encode')); -config = loadjson('config.json') +config = loadjson('config.json'); disp(config) -disp('running connectome_data_comparison') -connectome_data_comparison(config) +disp('running connectome_evaluator') +connectome_evaluator(config); %all sca service needs to write products.json - empty for now -products = [] +products = []; savejson('', products, 'FileName', 'products.json')