Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
fsl_mrs
Commits
e5d4cd8c
Commit
e5d4cd8c
authored
Jun 19, 2020
by
William Clarke
Browse files
New options in fsl_mrs.
parent
f3c6e63b
Changes
2
Hide whitespace changes
Inline
Side-by-side
fsl_mrs/core/MRS.py
View file @
e5d4cd8c
...
...
@@ -252,13 +252,13 @@ class MRS(object):
# Helper functions
def
processForFitting
(
self
,
ppmlim
=
(.
2
,
4.2
),):
def
processForFitting
(
self
,
ppmlim
=
(.
2
,
4.2
),
ind_scaling
=
None
):
""" Apply rescaling and run the conjugation checks"""
self
.
check_FID
(
ppmlim
=
ppmlim
,
repair
=
True
)
self
.
check_Basis
(
ppmlim
=
ppmlim
,
repair
=
True
)
self
.
rescaleForFitting
()
self
.
rescaleForFitting
(
ind_scaling
=
ind_scaling
)
def
rescaleForFitting
(
self
,
scale
=
100
):
def
rescaleForFitting
(
self
,
scale
=
100
,
ind_scaling
=
None
):
""" Apply rescaling across data, basis and H20"""
scaledFID
,
scaling
=
misc
.
rescale_FID
(
self
.
FID
,
scale
=
scale
)
...
...
@@ -267,7 +267,17 @@ class MRS(object):
self
.
H2O
*=
scaling
if
self
.
basis
is
not
None
:
self
.
basis
,
scaling_basis
=
misc
.
rescale_FID
(
self
.
basis
,
scale
=
scale
)
if
ind_scaling
is
None
:
self
.
basis
,
scaling_basis
=
misc
.
rescale_FID
(
self
.
basis
,
scale
=
scale
)
else
:
index
=
[
self
.
names
.
index
(
n
)
for
n
in
ind_scaling
]
mask
=
np
.
zeros_like
(
self
.
names
,
dtype
=
bool
)
mask
[
index
]
=
True
self
.
basis
[:,
~
mask
],
scaling_basis
=
misc
.
rescale_FID
(
self
.
basis
[:,
~
mask
],
scale
=
scale
)
scaling_basis
=
[
scaling_basis
]
for
idx
in
index
:
self
.
basis
[:,
idx
],
tmp
=
misc
.
rescale_FID
(
self
.
basis
[:,
idx
],
scale
=
scale
)
scaling_basis
.
append
(
tmp
)
else
:
scaling_basis
=
None
...
...
fsl_mrs/scripts/fsl_mrs
View file @
e5d4cd8c
...
...
@@ -77,6 +77,12 @@ def main():
fitting_args
.
add_argument
(
'--lorentzian'
,
action
=
"store_true"
,
help
=
'Enable purely lorentzian broadening'
' (default is Voigt)'
)
fitting_args
.
add_argument
(
'--ind_scale'
,
default
=
None
,
type
=
str
,
nargs
=
'+'
,
help
=
'List of basis spectra to scale'
' independently of other basis spectra.'
)
fitting_args
.
add_argument
(
'--disable_MH_priors'
,
action
=
"store_true"
,
help
=
"Disable MH priors."
)
# ADDITIONAL OPTIONAL ARGUMENTS
optional
.
add_argument
(
'--t1'
,
type
=
str
,
default
=
None
,
metavar
=
'IMAGE'
,
...
...
@@ -244,7 +250,7 @@ def main():
# Rescale FID, H2O and basis to have nice range
if
not
args
.
no_rescale
:
mrs
.
rescaleForFitting
()
mrs
.
rescaleForFitting
(
ind_scaling
=
args
.
ind_scale
)
# Do phase correction
if
args
.
phase_correct
:
...
...
@@ -278,18 +284,21 @@ def main():
G
=
[
i
+
max
(
metab_groups
)
+
1
for
i
in
range
(
nMM
)]
metab_groups
+=
G
# Choose fitting lineshape model.
if
args
.
lorentzian
:
Fitargs
=
{
'ppmlim'
:
ppmlim
,
'method'
:
args
.
algo
,
'baseline_order'
:
args
.
baseline_order
,
'metab_groups'
:
metab_groups
,
'model'
:
'lorentzian'
}
'model'
:
'lorentzian'
,
'disable_mh_priors'
:
args
.
disable_MH_priors
}
else
:
Fitargs
=
{
'ppmlim'
:
ppmlim
,
'method'
:
args
.
algo
,
'baseline_order'
:
args
.
baseline_order
,
'metab_groups'
:
metab_groups
,
'model'
:
'voigt'
}
'model'
:
'voigt'
,
'disable_mh_priors'
:
args
.
disable_MH_priors
}
if
args
.
verbose
:
print
(
mrs
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment