IMG2IGT returns an IGT-compatible image matrix from any EIDORS IMG struct. IGT = IMG2IGT(IMG) returns a vector NFrames-by-912. WARNING: When the mesh stored in fwd_model is not a resterised 32-by-32 matrix, this conversion results in a loss of quality. See also IGT2IMG, EIDORS_SAVEIMG.
0001 function igt = img2igt(img) 0002 %IMG2IGT returns an IGT-compatible image matrix from any EIDORS 0003 % IMG struct. 0004 % 0005 % IGT = IMG2IGT(IMG) returns a vector NFrames-by-912. 0006 % 0007 % WARNING: When the mesh stored in fwd_model is not a resterised 32-by-32 0008 % matrix, this conversion results in a loss of quality. 0009 % 0010 % See also IGT2IMG, EIDORS_SAVEIMG. 0011 0012 % (C) 2009 by Bartlomiej Grychtol. Licensed under GPL v2 or v3 0013 % $Id: img2igt.m 5290 2016-11-02 08:44:14Z fab-b $ 0014 0015 % render the image on a 34-by-34 grid 0016 img.calc_colours.npoints=34; 0017 greit_m = calc_slices(img); 0018 % reduce to 32-by-32 0019 greit_m = greit_m(2:33,2:33,:); 0020 0021 greit_m(isnan(greit_m)) = 0; 0022 0023 0024 % create an IGT mask 0025 ind=[8:25,39:58,70:91,101:124,132:157,163:190,194:223,225:800, ... 0026 802:831,835:862,868:893,901:924,934:955,967:986,1000:1017]; 0027 igt_m = zeros(1,1024); 0028 igt_m(ind) = 1:912; 0029 igt_m = reshape(igt_m,32,32)'; 0030 0031 % create IGT vector 0032 igt=zeros(size(img.elem_data,2),912); 0033 for i = 1:32 0034 for j = 1:32 0035 if igt_m(i,j)>0 0036 igt(:,igt_m(i,j)) = greit_m(i,j,:); 0037 end 0038 end 0039 end