Skip to content
Snippets Groups Projects
Commit e823a650 authored by Tamas Borbath's avatar Tamas Borbath
Browse files

Added the export and fitting also of the MC water signals

parent aad3d1bb
No related branches found
No related tags found
No related merge requests found
function fittingLCModelWithTransfer(LCModelCallerInstance, localFilePath, filenameData, dataPath, ...
filenameWater, waterPath, currentTEString, copyFiles)
filenameWater, waterPath, currentTEString, copyFiles, fitWater)
if ~exist('fitWater','var')
fitWater = false;
end
extensionTable = '.table';
extensionCoord = '.coord';
defaultTE = 'TE24';
......@@ -9,7 +13,11 @@ defaultLCModelUser = 'tborbath';
defaultSpectraName = 'XXXX';
defaultWaterRefName = 'YYYY';
controlFilesBase = 'fitsettings_';
controlFilesBaseSuffix = '_Metabolite.control';
if fitWater
controlFilesBaseSuffix = '_MC_Water.control';
else %normal case
controlFilesBaseSuffix = '_Metabolite.control';
end
%% file paths setup
controlFilesPathLocal = [localFilePath, 'LCModelConfig/'];
......
......@@ -97,6 +97,7 @@ for indexSubj = 1:numberOfSubjects
concentrations = cell(numberOfTEs,length(namingSuffixesAve));
concentrations_H2O = cell(numberOfTEs,length(namingSuffixesAve));
concentrations_MC_H2O = cell(numberOfTEs,length(namingSuffixesAve));
if ~fitLCModel
FQNs = cell(numberOfTEs,length(namingSuffixesAve));
FQNs2 = cell(numberOfTEs,length(namingSuffixesAve));
......@@ -112,6 +113,10 @@ for indexSubj = 1:numberOfSubjects
filenameData = [ subjects{indexSubj}, '_', TE_string namingSuffixAve namingSuffixCoil truncSuffix];
dataExportPathTE = [dataExportPath{indexSubj}, '\\', TE_string, '\\'];
load([dataExportPathTE, filenameData, '.mat'],'a')
MC_mix =2;
filenameData_MC_water = [filenameData, '_MC_water'];
a.ExportLcmRaw(dataExportPathTE, filenameData_MC_water, false, 'No', -4.7, 0.05, MC_mix);
if fitLCModel
if use_water_references
try
......@@ -120,6 +125,12 @@ for indexSubj = 1:numberOfSubjects
movefile([outputFilesPathLocal filenameData '.*'], dataExportPathTE);
concentrations{indexTE,indexAverageDelete, indexCoilDelete} = ...
importConcentrationLCModelTable([filenameData '.table'],dataExportPathTE, TE_string, 'Met moiety');
%MC_water
% fittingLCModelWithTransfer(LCModelCallerInstance, pathBaseExportFiles, ...
% filenameData_MC_water, dataExportPathTE, filenameWater, waterPath, TE_string, copyFiles, true);
% movefile([outputFilesPathLocal filenameData_MC_water '.*'], dataExportPathTE);
% concentrations_MC_H2O{indexTE,indexAverageDelete, indexCoilDelete} = ...
% importConcentrationLCModelTable([filenameData_MC_water '.table'],dataExportPathTE, TE_string, 'Met moiety');
catch
concentrations{indexTE,indexAverageDelete, indexCoilDelete} = {};
continue;
......@@ -132,6 +143,7 @@ for indexSubj = 1:numberOfSubjects
else %TODO
if use_water_references
fittingProFit(filenameData, dataExportPathTE, filenameWater, waterPath, TEs(indexTE), TR, dataExportPathTE);
fitting_MC_water(filenameData_MC_water, dataExportPathTE, TEs(indexTE), TR, dataExportPathTE)
else
fittingProFit(filenameData, dataExportPathTE, [], [], TEs(indexTE), TR, dataExportPathTE);
end
......@@ -139,6 +151,8 @@ for indexSubj = 1:numberOfSubjects
plot_ProFit_Metabolites_Fit([filenameData, '_profit.mat'],dataExportPathTE, 'Met', true);
load([dataExportPathTE, filenameData, '_profit_H2O.mat'],'concH2O');
concentrations_H2O{indexTE,indexAverageDelete, indexCoilDelete}=concH2O;
load([dataExportPathTE, filenameData_MC_water, '_profit.mat'],'concH2O');
concentrations_MC_H2O{indexTE,indexAverageDelete, indexCoilDelete}=concH2O;
end
close all
end
......@@ -146,9 +160,11 @@ for indexSubj = 1:numberOfSubjects
end
if fitLCModel
save([dataExportPath{indexSubj}, 'concentrations' truncSuffix '.mat'], 'concentrations');
save([dataExportPath{indexSubj}, 'concentrations', truncSuffix '_MC_H2O.mat'], 'concentrations_MC_H2O');
else
save([dataExportPath{indexSubj}, 'concentrations', truncSuffix '_profit.mat'], 'concentrations', 'activeMetabolites', 'FQNs', 'FQNs2');
save([dataExportPath{indexSubj}, 'concentrations', truncSuffix '_H2O_profit.mat'], 'concentrations_H2O');
save([dataExportPath{indexSubj}, 'concentrations', truncSuffix '_MC_H2O_profit.mat'], 'concentrations_MC_H2O');
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment