Bo = '3T';
mm = 1;
ss = 1;
AlphaMets = 1;
metabNames = {'GABA','Glu','Gln','Glx'};
metsName.metab{mm,ss} = {'Cr', 'GPC', 'Glu', 'NAA', 'PCh', 'PCr', 'CrCH2', 'tCho', 'tCr'};

idx  = find(strcmp(metsName.metab{mm,ss},metabNames{AlphaMets}));

[T1_Metab_GM, T1_Metab_WM, T2_Metab_GM, T2_Metab_WM] = lookUpRelaxTimes(metsName.metab{mm,ss}{idx},Bo);


function [T1_GM, T1_WM, T2_GM, T2_WM] = lookUpRelaxTimes(metName,Bo)

    % Look up table below
    switch Bo
    case '3T'
        % T1 values for NAA, Glu, Cr, Cho, mI from Mlynarik et al, NMR Biomed
        % 14:325-331 (2001)
        % T1 for GABA from Puts et al, J Magn Reson Imaging 37:999-1003 (2013)
        % T2 values from Wyss et al, Magn Reson Med 80:452-461 (2018)
        % T2 values are averaged between OCC and pACC for GM; and PVWM for WM
        % Structure is [T1_GM T1_WM T2_GM T2_WM]
        relax.Asc   = [1340 1190 (125+105)/2 172];
        relax.Asp   = [1340 1190 (111+90)/2 148];
        relax.Cr    = [1460 1240 (148+144)/2 166]; % 3.03 ppm resonance; 3.92 ppm signal is taken care of by -CrCH2 during fitting
        relax.GABA  = [1310 1310 (102+75)/2 (102+75)/2]; % No WM estimate available; take GM estimate; both in good accordance with 88 ms reported by Edden et al
        relax.Glc   = [1340 1190 (117+88)/2 155]; % Glc1: [1310 1310 (128+90)/2 156];
        relax.Gln   = [1340 1190 (122+99)/2 168];
        relax.Glu   = [1270 1170 (135+122)/2 124];
        relax.Gly   = [1340 1190 (102+81)/2 152];
        relax.GPC   = [1300 1080 (274+222)/2 218]; % This is the Choline singlet (3.21 ppm, tcho2 in the paper); glycerol is tcho: [1310 1310 (257+213)/2 182]; % choline multiplet is tcho1: [1310 1310 (242+190)/2 178];
        relax.GSH   = [1340 1190 (100+77)/2 145]; % This is the cysteine signal (GSH1 in the paper), glycine is GSH: [1310 1310 (99+72)/2 145]; % glutamate is GSH2: [1310 1310 (102+76)/2 165];
        relax.Lac   = [1340 1190 (110+99)/2 159];
        relax.mI   = [1230 1010 (244+229)/2 161];
        relax.NAA   = [1470 1350 (253+263)/2 343]; % This is the 2.008 ppm acetyl signal (naa in the paper); aspartyl is naa1: [1310 1310 (223+229)/2 310];
        relax.NAAG  = [1340 1190 (128+107)/2 185]; % This is the 2.042 ppm acetyl signal (naag in the paper); aspartyl is naag1: [1310 1310 (108+87)/2 180]; % glutamate is NAAG2: [1310 1310 (110+78)/2 157];
        relax.PCh   = [1300 1080 (274+221)/2 213]; % This is the singlet (3.20 ppm, tcho4 in the paper); multiple is tcho3: [1310 1310 (243+191)/2 178];
        relax.PCr   = [1460 1240 (148+144)/2 166]; % 3.03 ppm resonance; 3.92 ppm signal is taken care of by -CrCH2 during fitting; same as Cr
        relax.PE    = [1340 1190 (119+86)/2 158];
        relax.Scy   = [1340 1190 (125+107)/2 170];
        relax.Tau   = [1340 1190 (123+102)/2 (123+102)/2]; % No WM estimate available; take GM estimate
        relax.tNAA  = [(1470+1340)/2 (1350+1190)/2 (253+263+128+107)/4 (343+185)/2]; % Mean values from NAA + NAAG
        relax.tCr  = [(1460+1460)/2 (1240+1240)/2 (148+144+148+144)/4 (166+166)/2]; % Mean values from Cr + PCr
        relax.tCho  = [(1300+1080)/2 (1080+1080)/2 (274+222+274+221)/4 (218+213)/2]; % Mean values from GPC + PCh
        relax.Glx  = [(1340+1270)/2 (1190+1170)/2 (122+99+135+122)/4 (168+124)/2]; % Mean values from Glu + Glx

        % Check if metabolite name is in the look-up table
        if (length(metName) == 1) && (isfield(relax, metName))
            T1_GM = relax.(metName)(1) * 1e-3;
            T1_WM = relax.(metName)(2) * 1e-3;
            T2_GM = relax.(metName)(3) * 1e-3;
            T2_WM = relax.(metName)(4) * 1e-3;
        else
            % If not, use an average
            T1_GM = 1340 * 1e-3;
            T1_WM = 1190 * 1e-3;
            T2_GM = 140 * 1e-3;
            T2_WM = 169 * 1e-3;
        end
    case '7T'
        % T2 values of water, NAA, tCr, tCho, sI, mI, Glu,GSH, mI,
        % and Tau are taken from Marjanska et al. 2011 (NMR
        % 10.1002/nbm.1754). It was averaged across 4 regions OCC, SM1, BG, CER
        % Penner et al (2014) https://doi.org/10.1002/mrm.25380 for
        relax.Asc   = [1530 1484 127 128]; % This is the average from tNAA, tCr, tCho, Glx, and mI
        relax.Asp   = [1530 1484 127 128]; % This is the average from tNAA, tCr, tCho, Glx, and mI
        relax.Cr    = [1740 1780 107 107]; % Taken from tCr
        relax.GABA  = [1334 1334 87 87]; % Andreychenko et al. (2012) 10.1002/nbm.2997
        relax.Glc   = [1530 1484 127 128]; % This is the average from tNAA, tCr, tCho, Glx, and mI
        relax.Gln   = [1640 1740 107 107]; %T1 from Mlynarik et al. (2012) 10.1002/mrm.24352 % T2 as Gln
        relax.Glu   = [1610 1750 107 117]; % T1 from Mlynarik et al. (2012) 10.1002/mrm.24352, T2 from https://doi.org/10.1371/journal.pone.0215210
        relax.Gly   = [1530 1484 127 128]; % This is the average from tNAA, tCr, tCho, Glx, and mI
        relax.GPC   = [1510 1320  153 153]; % Taken from tCho
        relax.GSH   = [1140 1060 79 79]; % Entire molecule; T1 from Mlynarik et al. (2012) 10.1002/mrm.24352
        relax.Lac   = [1530 1484 182 182]; % The use of MEGA-sLASER with J-refocusing echo time extension to measure the proton T2 of lactate in healthy human brain at 7 T ISMRM
        relax.mI   = [1280 1190 111 111]; %T1 from Mlynarik et al. (2012) 10.1002/mrm.24352
        relax.NAA   = [1780 1830 155 155]; % This is the 2.008 ppm acetyl signal (naa in the paper); aspartyl is naa1: [1310 1310 110 110]; T1 from Mlynarik et al. (2012) 10.1002/mrm.24352
        relax.NAAG  = [1210 940 155 155]; % This is the 2.042 ppm acetyl signal (naag in the paper); aspartyl is naag1: [1310 1310 (108+87)/2 180]; % glutamate is NAAG2: [1310 1310 (110+78)/2 157];
        relax.PCh   = [1510 1320  153 153]; % Taken from tCho
        relax.PCr   = [1740 1780 107 107]; % Taken from tCr
        relax.PE    = [1310 1320 182 182]; %T1 from Mlynarik et al. (2012) 10.1002/mrm.24352; No reference values available. T2s copied from Lac (closest match at 3T)
        relax.sI   = [1310 1230 105 105]; %T1 from Mlynarik et al. (2012) 10.1002/mrm.24352 T2 from https://onlinelibrary.wiley.com/doi/full/10.1002/mrm.24352
        relax.Tau   = [2150 2090 97 97]; %T1 from Mlynarik et al. (2012) 10.1002/mrm.24352 % T2 as Gln
        relax.tNAA  = [1495 1385 155 155]; % Mean values from NAA + NAAG
        relax.tCr  = [1740 1780 107 107]; % The singlet peak ar 3 ppm. 3.9 ppm peak values are [1240 1190 94 94] %T1 from Mlynarik et al. (2012)
        relax.tCho  = [1510 1320  153 153]; % Entire molecule; T1 from Mlynarik et al. (2012) 10.1002/mrm.24352
        relax.Glx  = [1625 1745 107 112]; % Mean values from Glu + Glx

        % Check if metabolite name is in the look-up table
        if isfield(relax, metName)
            T1_GM = relax.(metName)(1) * 1e-3;
            T1_WM = relax.(metName)(2) * 1e-3;
            T2_GM = relax.(metName)(3) * 1e-3;
            T2_WM = relax.(metName)(4) * 1e-3;
        else
            % If not, use an average
            T1_GM = 1530 * 1e-3; % This is the average from tNAA, tCr, tCho, Glx, and mI
            T1_WM = 1484 * 1e-3; % This is the average from tNAA, tCr, tCho, Glx, and mI
            T2_GM = 127 * 1e-3; % This is the average from tNAA, tCr, tCho, Glx, and mI
            T2_WM = 128 * 1e-3; % This is the average from tNAA, tCr, tCho, Glx, and mI
        end
    end
end