CHECK_C2F_QUALITY Check the coarse2fine mapping between two models CHECK_C2F_QUALITY(F_MDL, C_MDL, C2F) creates a plot for assessing the quality of a coars2fine mapping. A coarse2fine mapping matrix C2F between a fine model F_MDL and a coarse model C_MDL contains in each element C2F(i,j) the fraction of F_MDL element i contained in C_MDL element j. CHECK_C2F_QUALITY calculates the fraction of the volume of each element of both models that is covered by the C2F mapping. Ideally, the result is always 1, other than in places where models don't overlap. [ f_frac, c_frac ] = CHECK_C2F_QUALITY(...) returns the calculated volumes for further analysis.
0001 function [ f_frac, c_frac ] = check_c2f_quality( f_mdl, c_mdl, c2f ) 0002 %CHECK_C2F_QUALITY Check the coarse2fine mapping between two models 0003 % CHECK_C2F_QUALITY(F_MDL, C_MDL, C2F) creates a plot for assessing the 0004 % quality of a coars2fine mapping. 0005 % A coarse2fine mapping matrix C2F between a fine model F_MDL and a 0006 % coarse model C_MDL contains in each element C2F(i,j) the fraction of 0007 % F_MDL element i contained in C_MDL element j. CHECK_C2F_QUALITY 0008 % calculates the fraction of the volume of each element of both models 0009 % that is covered by the C2F mapping. Ideally, the result is always 1, 0010 % other than in places where models don't overlap. 0011 % 0012 % [ f_frac, c_frac ] = CHECK_C2F_QUALITY(...) returns the calculated 0013 % volumes for further analysis. 0014 0015 % (C) 2017 Bartlomiej Grychtol 0016 % License: GPL version 2 or 3 0017 % $Id: check_c2f_quality.m 5802 2018-06-01 19:39:08Z bgrychtol $ 0018 0019 c_vol = get_elem_volume(c_mdl, -2); 0020 f_vol = get_elem_volume(f_mdl, -2); 0021 0022 % C2F(i,j) is the fraction of f_mdl element i contained in c_mdl element j 0023 0024 % Fraction of f_mdl covered by c2f: 0025 f_frac = full(sum(c2f,2)); 0026 f_img = mk_image(f_mdl, f_frac); 0027 0028 % Fraction of c_mdl elements covered by c2f 0029 c_frac = (c2f'*f_vol) ./ c_vol; 0030 c_img = mk_image(c_mdl, c_frac); 0031 0032 subplot(221) 0033 show_fem(f_img) 0034 title('Fine model coverage') 0035 % hold on 0036 % h = show_fem(c_mdl); 0037 % set(h,'EdgeColor','b') 0038 eidors_colourbar(f_img); 0039 hold off 0040 0041 subplot(222) 0042 hist(f_frac,1000); 0043 title('Fine model coverage') 0044 0045 subplot(223) 0046 show_fem(c_img) 0047 % hold on 0048 % h = show_fem(f_mdl); 0049 % set(h,'EdgeColor','b') 0050 eidors_colourbar(c_img); 0051 hold off 0052 title('Coarse model coverage') 0053 0054 0055 subplot(224) 0056 hist(c_frac,1000); 0057 title('Coarse model coverage'); 0058 end 0059