Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
good data, the full map uses the single echo's
value while the limited map has a NaN.
s0vG.nii Full S0 map/timeseries.
ts_OC.nii Optimally combined timeseries.
====================== =================================================
"""
# ensure tes are in appropriate format
tes = [float(te) for te in tes]
n_echos = len(tes)
# coerce data to samples x echos x time array
if isinstance(data, str):
data = [data]
LGR.info('Loading input data: {}'.format([f for f in data]))
catd, ref_img = io.load_data(data, n_echos=n_echos)
n_samp, n_echos, n_vols = catd.shape
LGR.debug('Resulting data shape: {}'.format(catd.shape))
try:
ref_label = op.basename(ref_img).split('.')[0]
except (TypeError, AttributeError):
ref_label = op.basename(str(data[0])).split('.')[0]
if label is not None:
out_dir = 'TED.{0}.{1}'.format(ref_label, label)
else:
out_dir = 'TED.{0}'.format(ref_label)
out_dir = op.abspath(out_dir)
if not op.isdir(out_dir):
LGR.info('Creating output directory: {}'.format(out_dir))
os.mkdir(out_dir)
# ensure tes are in appropriate format
tes = [float(te) for te in tes]
n_echos = len(tes)
# Coerce gscontrol to list
if not isinstance(gscontrol, list):
gscontrol = [gscontrol]
# coerce data to samples x echos x time array
if isinstance(data, str):
if not op.exists(data):
raise ValueError('Zcat file {} does not exist'.format(data))
data = [data]
LGR.info('Loading input data: {}'.format([f for f in data]))
catd, ref_img = io.load_data(data, n_echos=n_echos)
n_samp, n_echos, n_vols = catd.shape
LGR.debug('Resulting data shape: {}'.format(catd.shape))
if no_png and (png_cmap != 'coolwarm'):
LGR.warning('Overriding --no-png since --png-cmap provided.')
no_png = False
# check if TR is 0
img_t_r = ref_img.header.get_zooms()[-1]
if img_t_r == 0 and not no_png:
raise IOError('Dataset has a TR of 0. This indicates incorrect'
' header information. To correct this, we recommend'
' using this snippet:'
'\n'
'https://gist.github.com/jbteves/032c87aeb080dd8de8861cb151bff5d6'
'\n'