Commit 6f254386 authored by Saad Jbabdi's avatar Saad Jbabdi
Browse files

Detects echo time in FID sidecar file

parent ec1ae277
...@@ -295,6 +295,8 @@ def main(): ...@@ -295,6 +295,8 @@ def main():
# Echo time # Echo time
if args.TE is not None: if args.TE is not None:
echotime = args.TE*1E-3 echotime = args.TE*1E-3
elif 'TE' in dataheader:
echotime = dataheader['TE']
elif 'meta' in basisheader: elif 'meta' in basisheader:
if 'TE' in basisheader['meta']: if 'TE' in basisheader['meta']:
echotime = basisheader['meta']['TE'] echotime = basisheader['meta']['TE']
...@@ -306,6 +308,8 @@ def main(): ...@@ -306,6 +308,8 @@ def main():
echotime = None echotime = None
# Internal and Water quantification if requested # Internal and Water quantification if requested
if (mrs.H2O is None) or (echotime is None): if (mrs.H2O is None) or (echotime is None):
if echotime is None:
warnings.warn('H2O file provided but could not determine TE: no absolute quantification will be performed.',UserWarning)
res.calculateConcScaling(mrs,referenceMetab=args.internal_ref) res.calculateConcScaling(mrs,referenceMetab=args.internal_ref)
elif args.tissue_frac is None: elif args.tissue_frac is None:
res.calculateConcScaling(mrs, res.calculateConcScaling(mrs,
......
...@@ -43,7 +43,9 @@ def readNIFTI(datafile,squeezeSVS=True): ...@@ -43,7 +43,9 @@ def readNIFTI(datafile,squeezeSVS=True):
'json':jsonParams, 'json':jsonParams,
'centralFrequency':jsonParams['ImagingFrequency'], 'centralFrequency':jsonParams['ImagingFrequency'],
'dwelltime':jsonParams['Dwelltime'], 'dwelltime':jsonParams['Dwelltime'],
'bandwidth':1/jsonParams['Dwelltime']} 'bandwidth':1/jsonParams['Dwelltime']}
if "EchoTime" in jsonParams:
header['TE'] = jsonParams['EchoTime']
# If there is only one FID (SVS) and squeezeSVS is true then # If there is only one FID (SVS) and squeezeSVS is true then
# remove singleton dimensions # remove singleton dimensions
...@@ -212,4 +214,4 @@ def readAndGenFSLBasis(file,readoutShift,bandwidth,points): ...@@ -212,4 +214,4 @@ def readAndGenFSLBasis(file,readoutShift,bandwidth,points):
'dwelltime':1/bandwidth, 'dwelltime':1/bandwidth,
'fwhm':lw} 'fwhm':lw}
return FID, metabo, header return FID, metabo, header
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment