rapidtide 3.0.11__py3-none-any.whl → 3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rapidtide/Colortables.py +492 -27
- rapidtide/OrthoImageItem.py +1049 -46
- rapidtide/RapidtideDataset.py +1533 -86
- rapidtide/_version.py +3 -3
- rapidtide/calccoherence.py +196 -29
- rapidtide/calcnullsimfunc.py +191 -40
- rapidtide/calcsimfunc.py +245 -42
- rapidtide/correlate.py +1210 -393
- rapidtide/data/examples/src/testLD +56 -0
- rapidtide/data/examples/src/testalign +1 -1
- rapidtide/data/examples/src/testdelayvar +0 -1
- rapidtide/data/examples/src/testfmri +19 -1
- rapidtide/data/examples/src/testglmfilt +5 -5
- rapidtide/data/examples/src/testhappy +25 -3
- rapidtide/data/examples/src/testppgproc +17 -0
- rapidtide/data/examples/src/testrolloff +11 -0
- rapidtide/data/models/model_cnn_pytorch/best_model.pth +0 -0
- rapidtide/data/models/model_cnn_pytorch/loss.png +0 -0
- rapidtide/data/models/model_cnn_pytorch/loss.txt +1 -0
- rapidtide/data/models/model_cnn_pytorch/model.pth +0 -0
- rapidtide/data/models/model_cnn_pytorch/model_meta.json +68 -0
- rapidtide/decorators.py +91 -0
- rapidtide/dlfilter.py +2225 -108
- rapidtide/dlfiltertorch.py +4843 -0
- rapidtide/externaltools.py +327 -12
- rapidtide/fMRIData_class.py +79 -40
- rapidtide/filter.py +1899 -810
- rapidtide/fit.py +2004 -574
- rapidtide/genericmultiproc.py +93 -18
- rapidtide/happy_supportfuncs.py +2044 -171
- rapidtide/helper_classes.py +584 -43
- rapidtide/io.py +2363 -370
- rapidtide/linfitfiltpass.py +341 -75
- rapidtide/makelaggedtcs.py +211 -20
- rapidtide/maskutil.py +423 -53
- rapidtide/miscmath.py +827 -121
- rapidtide/multiproc.py +210 -22
- rapidtide/patchmatch.py +234 -33
- rapidtide/peakeval.py +32 -30
- rapidtide/ppgproc.py +2203 -0
- rapidtide/qualitycheck.py +352 -39
- rapidtide/refinedelay.py +422 -57
- rapidtide/refineregressor.py +498 -184
- rapidtide/resample.py +671 -185
- rapidtide/scripts/applyppgproc.py +28 -0
- rapidtide/simFuncClasses.py +1052 -77
- rapidtide/simfuncfit.py +260 -46
- rapidtide/stats.py +540 -238
- rapidtide/tests/happycomp +9 -0
- rapidtide/tests/test_dlfiltertorch.py +627 -0
- rapidtide/tests/test_findmaxlag.py +24 -8
- rapidtide/tests/test_fullrunhappy_v1.py +0 -2
- rapidtide/tests/test_fullrunhappy_v2.py +0 -2
- rapidtide/tests/test_fullrunhappy_v3.py +1 -0
- rapidtide/tests/test_fullrunhappy_v4.py +2 -2
- rapidtide/tests/test_fullrunrapidtide_v7.py +1 -1
- rapidtide/tests/test_simroundtrip.py +8 -8
- rapidtide/tests/utils.py +9 -8
- rapidtide/tidepoolTemplate.py +142 -38
- rapidtide/tidepoolTemplate_alt.py +165 -44
- rapidtide/tidepoolTemplate_big.py +189 -52
- rapidtide/util.py +1217 -118
- rapidtide/voxelData.py +684 -37
- rapidtide/wiener.py +19 -12
- rapidtide/wiener2.py +113 -7
- rapidtide/wiener_doc.py +255 -0
- rapidtide/workflows/adjustoffset.py +105 -3
- rapidtide/workflows/aligntcs.py +85 -2
- rapidtide/workflows/applydlfilter.py +87 -10
- rapidtide/workflows/applyppgproc.py +522 -0
- rapidtide/workflows/atlasaverage.py +210 -47
- rapidtide/workflows/atlastool.py +100 -3
- rapidtide/workflows/calcSimFuncMap.py +294 -64
- rapidtide/workflows/calctexticc.py +201 -9
- rapidtide/workflows/ccorrica.py +97 -4
- rapidtide/workflows/cleanregressor.py +168 -29
- rapidtide/workflows/delayvar.py +163 -10
- rapidtide/workflows/diffrois.py +81 -3
- rapidtide/workflows/endtidalproc.py +144 -4
- rapidtide/workflows/fdica.py +195 -15
- rapidtide/workflows/filtnifti.py +70 -3
- rapidtide/workflows/filttc.py +74 -3
- rapidtide/workflows/fitSimFuncMap.py +206 -48
- rapidtide/workflows/fixtr.py +73 -3
- rapidtide/workflows/gmscalc.py +113 -3
- rapidtide/workflows/happy.py +801 -199
- rapidtide/workflows/happy2std.py +144 -12
- rapidtide/workflows/happy_parser.py +138 -9
- rapidtide/workflows/histnifti.py +118 -2
- rapidtide/workflows/histtc.py +84 -3
- rapidtide/workflows/linfitfilt.py +117 -4
- rapidtide/workflows/localflow.py +328 -28
- rapidtide/workflows/mergequality.py +79 -3
- rapidtide/workflows/niftidecomp.py +322 -18
- rapidtide/workflows/niftistats.py +174 -4
- rapidtide/workflows/pairproc.py +88 -2
- rapidtide/workflows/pairwisemergenifti.py +85 -2
- rapidtide/workflows/parser_funcs.py +1421 -40
- rapidtide/workflows/physiofreq.py +137 -11
- rapidtide/workflows/pixelcomp.py +208 -5
- rapidtide/workflows/plethquality.py +103 -21
- rapidtide/workflows/polyfitim.py +151 -11
- rapidtide/workflows/proj2flow.py +75 -2
- rapidtide/workflows/rankimage.py +111 -4
- rapidtide/workflows/rapidtide.py +272 -15
- rapidtide/workflows/rapidtide2std.py +98 -2
- rapidtide/workflows/rapidtide_parser.py +109 -9
- rapidtide/workflows/refineDelayMap.py +143 -33
- rapidtide/workflows/refineRegressor.py +682 -93
- rapidtide/workflows/regressfrommaps.py +152 -31
- rapidtide/workflows/resamplenifti.py +85 -3
- rapidtide/workflows/resampletc.py +91 -3
- rapidtide/workflows/retrolagtcs.py +98 -6
- rapidtide/workflows/retroregress.py +165 -9
- rapidtide/workflows/roisummarize.py +173 -5
- rapidtide/workflows/runqualitycheck.py +71 -3
- rapidtide/workflows/showarbcorr.py +147 -4
- rapidtide/workflows/showhist.py +86 -2
- rapidtide/workflows/showstxcorr.py +160 -3
- rapidtide/workflows/showtc.py +159 -3
- rapidtide/workflows/showxcorrx.py +184 -4
- rapidtide/workflows/showxy.py +185 -15
- rapidtide/workflows/simdata.py +262 -36
- rapidtide/workflows/spatialfit.py +77 -2
- rapidtide/workflows/spatialmi.py +251 -27
- rapidtide/workflows/spectrogram.py +305 -32
- rapidtide/workflows/synthASL.py +154 -3
- rapidtide/workflows/tcfrom2col.py +76 -2
- rapidtide/workflows/tcfrom3col.py +74 -2
- rapidtide/workflows/tidepool.py +2969 -130
- rapidtide/workflows/utils.py +19 -14
- rapidtide/workflows/utils_doc.py +293 -0
- rapidtide/workflows/variabilityizer.py +116 -3
- {rapidtide-3.0.11.dist-info → rapidtide-3.1.dist-info}/METADATA +3 -2
- {rapidtide-3.0.11.dist-info → rapidtide-3.1.dist-info}/RECORD +139 -122
- {rapidtide-3.0.11.dist-info → rapidtide-3.1.dist-info}/entry_points.txt +1 -0
- {rapidtide-3.0.11.dist-info → rapidtide-3.1.dist-info}/WHEEL +0 -0
- {rapidtide-3.0.11.dist-info → rapidtide-3.1.dist-info}/licenses/LICENSE +0 -0
- {rapidtide-3.0.11.dist-info → rapidtide-3.1.dist-info}/top_level.txt +0 -0
|
@@ -21,9 +21,11 @@ import logging
|
|
|
21
21
|
import os
|
|
22
22
|
import sys
|
|
23
23
|
from argparse import Namespace
|
|
24
|
+
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
|
24
25
|
|
|
25
26
|
import nibabel as nib
|
|
26
27
|
import numpy as np
|
|
28
|
+
from numpy.typing import NDArray
|
|
27
29
|
|
|
28
30
|
import rapidtide.io as tide_io
|
|
29
31
|
import rapidtide.util as tide_util
|
|
@@ -108,10 +110,37 @@ DEFAULT_DELAYOFFSETSPATIALFILT = -1
|
|
|
108
110
|
DEFAULT_PATCHMINSIZE = 10
|
|
109
111
|
DEFAULT_PATCHFWHM = 5
|
|
110
112
|
|
|
113
|
+
DEFAULT_PREWHITEN_LAGS = -1
|
|
111
114
|
|
|
112
|
-
|
|
115
|
+
|
|
116
|
+
def _get_parser() -> Any:
|
|
113
117
|
"""
|
|
114
|
-
|
|
118
|
+
Set up the argument parser for rapidtide command-line interface.
|
|
119
|
+
|
|
120
|
+
This function configures all available command-line arguments for the rapidtide
|
|
121
|
+
tool, organizing them into logical groups for easy reference and use.
|
|
122
|
+
|
|
123
|
+
Returns
|
|
124
|
+
-------
|
|
125
|
+
argparse.ArgumentParser
|
|
126
|
+
Configured argument parser with all rapidtide options added
|
|
127
|
+
|
|
128
|
+
Notes
|
|
129
|
+
-----
|
|
130
|
+
The parser includes several groups of options:
|
|
131
|
+
- Input/Output options
|
|
132
|
+
- Processing options
|
|
133
|
+
- Performance options
|
|
134
|
+
- Miscellaneous options
|
|
135
|
+
- Experimental options (not fully tested)
|
|
136
|
+
- Deprecated options (will be removed in future versions)
|
|
137
|
+
- Debugging options (for development and troubleshooting)
|
|
138
|
+
|
|
139
|
+
Examples
|
|
140
|
+
--------
|
|
141
|
+
>>> parser = setup_parser()
|
|
142
|
+
>>> args = parser.parse_args()
|
|
143
|
+
>>> print(args.version)
|
|
115
144
|
"""
|
|
116
145
|
parser = argparse.ArgumentParser(
|
|
117
146
|
prog="rapidtide",
|
|
@@ -1445,7 +1474,7 @@ def _get_parser():
|
|
|
1445
1474
|
experimental = parser.add_argument_group(
|
|
1446
1475
|
"Experimental options (not fully tested, or not tested at all, may not work). Beware!"
|
|
1447
1476
|
)
|
|
1448
|
-
|
|
1477
|
+
experimental.add_argument(
|
|
1449
1478
|
"--riptidestep", # was -h
|
|
1450
1479
|
dest="riptidestep",
|
|
1451
1480
|
action="store",
|
|
@@ -1572,6 +1601,24 @@ def _get_parser():
|
|
|
1572
1601
|
help=("Perform patch shift correction."),
|
|
1573
1602
|
default=False,
|
|
1574
1603
|
)
|
|
1604
|
+
experimental.add_argument(
|
|
1605
|
+
"--prewhitenregressor",
|
|
1606
|
+
dest="prewhitenregressor",
|
|
1607
|
+
action="store_true",
|
|
1608
|
+
help=("Prewhiten probe regressor prior to calculating correlations."),
|
|
1609
|
+
default=False,
|
|
1610
|
+
)
|
|
1611
|
+
experimental.add_argument(
|
|
1612
|
+
"--prewhitenlags",
|
|
1613
|
+
dest="prewhitenlags",
|
|
1614
|
+
action="store",
|
|
1615
|
+
type=lambda x: pf.is_int(parser, x, minval=0),
|
|
1616
|
+
metavar="LAGS",
|
|
1617
|
+
help=(
|
|
1618
|
+
f"Set number of TRs to use in prewhitening. Set to -1 to calculate automatically. Default is {DEFAULT_PREWHITEN_LAGS}."
|
|
1619
|
+
),
|
|
1620
|
+
default=DEFAULT_PREWHITEN_LAGS,
|
|
1621
|
+
)
|
|
1575
1622
|
|
|
1576
1623
|
# Deprecated options
|
|
1577
1624
|
deprecated = parser.add_argument_group(
|
|
@@ -1731,9 +1778,51 @@ def _get_parser():
|
|
|
1731
1778
|
return parser
|
|
1732
1779
|
|
|
1733
1780
|
|
|
1734
|
-
def process_args(inputargs=None):
|
|
1781
|
+
def process_args(inputargs: Optional[Any] = None) -> Tuple[Any, object]:
|
|
1735
1782
|
"""
|
|
1736
1783
|
Compile arguments for rapidtide workflow.
|
|
1784
|
+
|
|
1785
|
+
This function processes command-line arguments and sets up the configuration
|
|
1786
|
+
for the rapidtide workflow. It handles argument parsing, logging setup,
|
|
1787
|
+
command-line saving, and various parameter defaults and overrides based on
|
|
1788
|
+
analysis modes and macros.
|
|
1789
|
+
|
|
1790
|
+
Parameters
|
|
1791
|
+
----------
|
|
1792
|
+
inputargs : optional
|
|
1793
|
+
Input arguments to be processed. If None, arguments are parsed from
|
|
1794
|
+
sys.argv. Default is None.
|
|
1795
|
+
|
|
1796
|
+
Returns
|
|
1797
|
+
-------
|
|
1798
|
+
tuple
|
|
1799
|
+
A tuple containing:
|
|
1800
|
+
- args : dict
|
|
1801
|
+
Dictionary of processed arguments.
|
|
1802
|
+
- theprefilter : object
|
|
1803
|
+
Preprocessing filter object.
|
|
1804
|
+
|
|
1805
|
+
Notes
|
|
1806
|
+
-----
|
|
1807
|
+
The function performs the following key operations:
|
|
1808
|
+
1. Parses command-line arguments using `_get_parser`
|
|
1809
|
+
2. Sets up logging based on debug flag
|
|
1810
|
+
3. Saves raw and formatted command lines to files
|
|
1811
|
+
4. Applies default values and overrides for various parameters
|
|
1812
|
+
5. Handles analysis modes (delaymapping, denoising, cvrmap, etc.)
|
|
1813
|
+
6. Processes macros (venousrefine, nirs)
|
|
1814
|
+
7. Configures output options based on `outputlevel`
|
|
1815
|
+
8. Sets up pass options and dispersion calculation parameters
|
|
1816
|
+
9. Handles mask specifications and file processing
|
|
1817
|
+
10. Initializes filter options
|
|
1818
|
+
|
|
1819
|
+
Examples
|
|
1820
|
+
--------
|
|
1821
|
+
>>> args, prefilter = process_args()
|
|
1822
|
+
>>> print(args['passes'])
|
|
1823
|
+
1
|
|
1824
|
+
>>> print(args['outputlevel'])
|
|
1825
|
+
'normal'
|
|
1737
1826
|
"""
|
|
1738
1827
|
inargs, argstowrite = pf.setargs(_get_parser, inputargs=inputargs)
|
|
1739
1828
|
args = vars(inargs)
|
|
@@ -1747,7 +1836,7 @@ def process_args(inputargs=None):
|
|
|
1747
1836
|
# save the raw and formatted command lines
|
|
1748
1837
|
args["commandlineargs"] = argstowrite[1:]
|
|
1749
1838
|
thecommandline = " ".join(argstowrite)
|
|
1750
|
-
tide_io.writevec([thecommandline], args["outputname"] + "_commandline.txt")
|
|
1839
|
+
tide_io.writevec(np.array([thecommandline]), args["outputname"] + "_commandline.txt")
|
|
1751
1840
|
formattedcommandline = []
|
|
1752
1841
|
for thetoken in argstowrite[0:3]:
|
|
1753
1842
|
formattedcommandline.append(thetoken)
|
|
@@ -1766,7 +1855,9 @@ def process_args(inputargs=None):
|
|
|
1766
1855
|
else:
|
|
1767
1856
|
suffix = ""
|
|
1768
1857
|
formattedcommandline[i] = prefix + formattedcommandline[i] + suffix
|
|
1769
|
-
tide_io.writevec(
|
|
1858
|
+
tide_io.writevec(
|
|
1859
|
+
np.array(formattedcommandline), args["outputname"] + "_formattedcommandline.txt"
|
|
1860
|
+
)
|
|
1770
1861
|
|
|
1771
1862
|
LGR.debug("\nbefore postprocessing:\n{}".format(args))
|
|
1772
1863
|
|
|
@@ -1847,6 +1938,9 @@ def process_args(inputargs=None):
|
|
|
1847
1938
|
args["lagmin"] = args["lag_extrema"][0]
|
|
1848
1939
|
args["lagmax"] = args["lag_extrema"][1]
|
|
1849
1940
|
|
|
1941
|
+
if args["prewhitenlags"] == -1:
|
|
1942
|
+
args["prewhitenlags"] = int(np.max([np.fabs(args["lagmin"]), np.fabs(args["lagmax"])]))
|
|
1943
|
+
|
|
1850
1944
|
# set startpoint and endpoint
|
|
1851
1945
|
args["startpoint"], args["endpoint"] = pf.parserange(args["timerange"], descriptor="timerange")
|
|
1852
1946
|
|
|
@@ -2222,9 +2316,15 @@ def process_args(inputargs=None):
|
|
|
2222
2316
|
|
|
2223
2317
|
# make the pass options dictionary
|
|
2224
2318
|
args["passoptions"] = [
|
|
2225
|
-
{
|
|
2226
|
-
|
|
2227
|
-
|
|
2319
|
+
{
|
|
2320
|
+
"similaritymetric": "riptide",
|
|
2321
|
+
},
|
|
2322
|
+
{
|
|
2323
|
+
"similaritymetric": "correlation",
|
|
2324
|
+
},
|
|
2325
|
+
{
|
|
2326
|
+
"similaritymetric": "correlation",
|
|
2327
|
+
},
|
|
2228
2328
|
]
|
|
2229
2329
|
|
|
2230
2330
|
# dispersion calculation
|
|
@@ -16,46 +16,156 @@
|
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
#
|
|
18
18
|
#
|
|
19
|
+
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
|
20
|
+
|
|
19
21
|
import numpy as np
|
|
22
|
+
from numpy.typing import NDArray
|
|
20
23
|
|
|
21
24
|
import rapidtide.refinedelay as tide_refinedelay
|
|
22
25
|
import rapidtide.stats as tide_stats
|
|
23
26
|
|
|
24
27
|
|
|
25
28
|
def refineDelay(
|
|
26
|
-
fmri_data_valid,
|
|
27
|
-
initial_fmri_x,
|
|
28
|
-
xdim,
|
|
29
|
-
ydim,
|
|
30
|
-
slicethickness,
|
|
31
|
-
sLFOfiltmask,
|
|
32
|
-
genlagtc,
|
|
33
|
-
oversamptr,
|
|
34
|
-
sLFOfitmean,
|
|
35
|
-
rvalue,
|
|
36
|
-
r2value,
|
|
37
|
-
fitNorm,
|
|
38
|
-
fitcoeff,
|
|
39
|
-
lagtc,
|
|
40
|
-
outputname,
|
|
41
|
-
validvoxels,
|
|
42
|
-
nativespaceshape,
|
|
43
|
-
theinputdata,
|
|
44
|
-
lagtimes,
|
|
45
|
-
optiondict,
|
|
46
|
-
LGR,
|
|
47
|
-
TimingLGR,
|
|
48
|
-
outputlevel="normal",
|
|
49
|
-
gausssigma
|
|
50
|
-
patchthresh=3.0,
|
|
51
|
-
mindelay
|
|
52
|
-
maxdelay=5.0,
|
|
53
|
-
numpoints=501,
|
|
54
|
-
histlen=101,
|
|
55
|
-
rt_floatset=np.float64,
|
|
56
|
-
rt_floattype="float64",
|
|
57
|
-
debug=False,
|
|
58
|
-
):
|
|
29
|
+
fmri_data_valid: Any,
|
|
30
|
+
initial_fmri_x: Any,
|
|
31
|
+
xdim: Any,
|
|
32
|
+
ydim: Any,
|
|
33
|
+
slicethickness: Any,
|
|
34
|
+
sLFOfiltmask: Any,
|
|
35
|
+
genlagtc: Any,
|
|
36
|
+
oversamptr: Any,
|
|
37
|
+
sLFOfitmean: Any,
|
|
38
|
+
rvalue: Any,
|
|
39
|
+
r2value: Any,
|
|
40
|
+
fitNorm: Any,
|
|
41
|
+
fitcoeff: Any,
|
|
42
|
+
lagtc: Any,
|
|
43
|
+
outputname: Any,
|
|
44
|
+
validvoxels: Any,
|
|
45
|
+
nativespaceshape: Any,
|
|
46
|
+
theinputdata: Any,
|
|
47
|
+
lagtimes: Any,
|
|
48
|
+
optiondict: Any,
|
|
49
|
+
LGR: Any,
|
|
50
|
+
TimingLGR: Any,
|
|
51
|
+
outputlevel: str = "normal",
|
|
52
|
+
gausssigma: int = -1,
|
|
53
|
+
patchthresh: float = 3.0,
|
|
54
|
+
mindelay: float = -5.0,
|
|
55
|
+
maxdelay: float = 5.0,
|
|
56
|
+
numpoints: int = 501,
|
|
57
|
+
histlen: int = 101,
|
|
58
|
+
rt_floatset: Any = np.float64,
|
|
59
|
+
rt_floattype: str = "float64",
|
|
60
|
+
debug: bool = False,
|
|
61
|
+
) -> None:
|
|
62
|
+
"""
|
|
63
|
+
Refine delay estimates using regression derivative ratios and histogram-based calibration.
|
|
64
|
+
|
|
65
|
+
This function performs calibration of delay estimates by computing regression derivative
|
|
66
|
+
ratios, filtering them, training a mapping from ratios to delays, and finally calculating
|
|
67
|
+
delay offsets for each voxel. It also generates a histogram of the computed delay offsets.
|
|
68
|
+
|
|
69
|
+
Parameters
|
|
70
|
+
----------
|
|
71
|
+
fmri_data_valid : Any
|
|
72
|
+
Valid fMRI data used for delay refinement.
|
|
73
|
+
initial_fmri_x : Any
|
|
74
|
+
Initial fMRI design matrix.
|
|
75
|
+
xdim : Any
|
|
76
|
+
X dimension of the data.
|
|
77
|
+
ydim : Any
|
|
78
|
+
Y dimension of the data.
|
|
79
|
+
slicethickness : Any
|
|
80
|
+
Thickness of the slices in the data.
|
|
81
|
+
sLFOfiltmask : Any
|
|
82
|
+
Mask for filtering based on SLOF (slice timing) effects.
|
|
83
|
+
genlagtc : Any
|
|
84
|
+
Generated lag time course.
|
|
85
|
+
oversamptr : Any
|
|
86
|
+
Oversampling time resolution.
|
|
87
|
+
sLFOfitmean : Any
|
|
88
|
+
Mean SLOF fit values.
|
|
89
|
+
rvalue : Any
|
|
90
|
+
R-values from regression.
|
|
91
|
+
r2value : Any
|
|
92
|
+
R-squared values from regression.
|
|
93
|
+
fitNorm : Any
|
|
94
|
+
Normalized fit coefficients.
|
|
95
|
+
fitcoeff : Any
|
|
96
|
+
Fit coefficients.
|
|
97
|
+
lagtc : Any
|
|
98
|
+
Lag time course.
|
|
99
|
+
outputname : Any
|
|
100
|
+
Base name for output files.
|
|
101
|
+
validvoxels : Any
|
|
102
|
+
Indices of valid voxels.
|
|
103
|
+
nativespaceshape : Any
|
|
104
|
+
Shape of the native space.
|
|
105
|
+
theinputdata : Any
|
|
106
|
+
Input data object.
|
|
107
|
+
lagtimes : Any
|
|
108
|
+
Time lags used for analysis.
|
|
109
|
+
optiondict : Any
|
|
110
|
+
Dictionary of options for processing.
|
|
111
|
+
LGR : Any
|
|
112
|
+
Logger for general messages.
|
|
113
|
+
TimingLGR : Any
|
|
114
|
+
Logger for timing-related messages.
|
|
115
|
+
outputlevel : str, optional
|
|
116
|
+
Level of output verbosity, default is "normal".
|
|
117
|
+
gausssigma : int, optional
|
|
118
|
+
Sigma for Gaussian filtering, default is -1 (no filtering).
|
|
119
|
+
patchthresh : float, optional
|
|
120
|
+
Threshold for patch-based filtering, default is 3.0.
|
|
121
|
+
mindelay : float, optional
|
|
122
|
+
Minimum delay value, default is -5.0.
|
|
123
|
+
maxdelay : float, optional
|
|
124
|
+
Maximum delay value, default is 5.0.
|
|
125
|
+
numpoints : int, optional
|
|
126
|
+
Number of points for delay interpolation, default is 501.
|
|
127
|
+
histlen : int, optional
|
|
128
|
+
Length of histogram bins, default is 101.
|
|
129
|
+
rt_floatset : Any, optional
|
|
130
|
+
Data type for real-time float operations, default is np.float64.
|
|
131
|
+
rt_floattype : str, optional
|
|
132
|
+
String representation of float type, default is "float64".
|
|
133
|
+
debug : bool, optional
|
|
134
|
+
Enable debug mode, default is False.
|
|
135
|
+
|
|
136
|
+
Returns
|
|
137
|
+
-------
|
|
138
|
+
tuple
|
|
139
|
+
A tuple containing:
|
|
140
|
+
- delayoffset : ndarray
|
|
141
|
+
Calculated delay offsets for each voxel.
|
|
142
|
+
- regressderivratios : ndarray
|
|
143
|
+
Raw regression derivative ratios.
|
|
144
|
+
- medfiltregressderivratios : ndarray
|
|
145
|
+
Median-filtered regression derivative ratios.
|
|
146
|
+
- filteredregressderivratios : ndarray
|
|
147
|
+
Final filtered regression derivative ratios.
|
|
148
|
+
- delayoffsetMAD : ndarray
|
|
149
|
+
Median absolute deviation of delay offsets.
|
|
150
|
+
|
|
151
|
+
Notes
|
|
152
|
+
-----
|
|
153
|
+
The function uses the `tide_refinedelay` module to perform various steps:
|
|
154
|
+
1. Computes regression derivative ratios using `getderivratios`.
|
|
155
|
+
2. Filters these ratios using `filterderivratios`.
|
|
156
|
+
3. Trains a ratio-to-delay mapping using `trainratiotooffset`.
|
|
157
|
+
4. Converts ratios to delay offsets using `ratiotodelay`.
|
|
158
|
+
5. Saves a histogram of delay offsets to disk.
|
|
159
|
+
|
|
160
|
+
Examples
|
|
161
|
+
--------
|
|
162
|
+
>>> delayoffset, regressderivratios, medfiltregressderivratios, filteredregressderivratios, delayoffsetMAD = refineDelay(
|
|
163
|
+
... fmri_data_valid, initial_fmri_x, xdim, ydim, slicethickness,
|
|
164
|
+
... sLFOfiltmask, genlagtc, oversamptr, sLFOfitmean, rvalue, r2value,
|
|
165
|
+
... fitNorm, fitcoeff, lagtc, outputname, validvoxels, nativespaceshape,
|
|
166
|
+
... theinputdata, lagtimes, optiondict, LGR, TimingLGR
|
|
167
|
+
... )
|
|
168
|
+
"""
|
|
59
169
|
# do the calibration
|
|
60
170
|
TimingLGR.info("Refinement calibration start")
|
|
61
171
|
regressderivratios, regressrvalues = tide_refinedelay.getderivratios(
|