rapidtide 3.1__py3-none-any.whl → 3.1.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/OrthoImageItem.py +4 -4
- rapidtide/_version.py +3 -3
- rapidtide/calccoherence.py +4 -4
- rapidtide/calcnullsimfunc.py +2 -5
- rapidtide/calcsimfunc.py +1 -4
- rapidtide/correlate.py +130 -127
- rapidtide/data/examples/src/testfmri +41 -9
- rapidtide/data/examples/src/testhappy +8 -8
- rapidtide/dlfilter.py +21 -22
- rapidtide/dlfiltertorch.py +18 -19
- rapidtide/filter.py +4 -4
- rapidtide/fit.py +18 -18
- rapidtide/happy_supportfuncs.py +84 -82
- rapidtide/helper_classes.py +2 -2
- rapidtide/io.py +88 -83
- rapidtide/linfitfiltpass.py +30 -49
- rapidtide/makelaggedtcs.py +11 -16
- rapidtide/maskutil.py +30 -14
- rapidtide/miscmath.py +2 -2
- rapidtide/patchmatch.py +10 -11
- rapidtide/peakeval.py +1 -3
- rapidtide/ppgproc.py +3 -3
- rapidtide/qualitycheck.py +2 -2
- rapidtide/refinedelay.py +12 -3
- rapidtide/refineregressor.py +20 -29
- rapidtide/scripts/showxcorr_legacy.py +7 -7
- rapidtide/scripts/stupidramtricks.py +15 -17
- rapidtide/simFuncClasses.py +2 -2
- rapidtide/simfuncfit.py +27 -41
- rapidtide/tests/test_cleanregressor.py +1 -2
- rapidtide/tests/test_fullrunhappy_v3.py +11 -5
- rapidtide/tests/test_fullrunhappy_v4.py +9 -1
- rapidtide/tests/test_getparsers.py +11 -3
- rapidtide/tests/test_refinedelay.py +0 -1
- rapidtide/tests/test_simroundtrip.py +8 -0
- rapidtide/tests/test_stcorrelate.py +3 -1
- rapidtide/util.py +6 -6
- rapidtide/voxelData.py +1 -1
- rapidtide/wiener.py +122 -16
- rapidtide/wiener2.py +3 -3
- rapidtide/workflows/applyppgproc.py +33 -15
- rapidtide/workflows/calcSimFuncMap.py +11 -22
- rapidtide/workflows/ccorrica.py +4 -2
- rapidtide/workflows/cleanregressor.py +6 -11
- rapidtide/workflows/delayvar.py +8 -13
- rapidtide/workflows/fitSimFuncMap.py +2 -9
- rapidtide/workflows/happy.py +6 -6
- rapidtide/workflows/happy_parser.py +36 -25
- rapidtide/workflows/pairproc.py +10 -2
- rapidtide/workflows/pixelcomp.py +1 -2
- rapidtide/workflows/rankimage.py +1 -1
- rapidtide/workflows/rapidtide.py +98 -63
- rapidtide/workflows/refineDelayMap.py +7 -6
- rapidtide/workflows/refineRegressor.py +6 -16
- rapidtide/workflows/regressfrommaps.py +9 -6
- rapidtide/workflows/retrolagtcs.py +5 -7
- rapidtide/workflows/retroregress.py +11 -17
- rapidtide/workflows/roisummarize.py +11 -10
- rapidtide/workflows/showarbcorr.py +2 -2
- rapidtide/workflows/showxcorrx.py +6 -6
- rapidtide/workflows/simdata.py +31 -31
- rapidtide/workflows/spatialmi.py +0 -1
- rapidtide/workflows/tidepool.py +6 -4
- {rapidtide-3.1.dist-info → rapidtide-3.1.1.dist-info}/METADATA +8 -7
- {rapidtide-3.1.dist-info → rapidtide-3.1.1.dist-info}/RECORD +69 -70
- rapidtide/wiener_doc.py +0 -255
- {rapidtide-3.1.dist-info → rapidtide-3.1.1.dist-info}/WHEEL +0 -0
- {rapidtide-3.1.dist-info → rapidtide-3.1.1.dist-info}/entry_points.txt +0 -0
- {rapidtide-3.1.dist-info → rapidtide-3.1.1.dist-info}/licenses/LICENSE +0 -0
- {rapidtide-3.1.dist-info → rapidtide-3.1.1.dist-info}/top_level.txt +0 -0
|
@@ -87,8 +87,7 @@ class RegressorRefiner:
|
|
|
87
87
|
prewhitenregressor: bool = False,
|
|
88
88
|
prewhitenlags: int = 10,
|
|
89
89
|
debug: bool = False,
|
|
90
|
-
rt_floattype:
|
|
91
|
-
rt_floatset: Any = np.float64,
|
|
90
|
+
rt_floattype: np.dtype = np.float64,
|
|
92
91
|
) -> None:
|
|
93
92
|
"""
|
|
94
93
|
Initialize the object with configuration parameters for fMRI data processing.
|
|
@@ -188,10 +187,8 @@ class RegressorRefiner:
|
|
|
188
187
|
Number of lags for pre-whitening (default is 10).
|
|
189
188
|
debug : bool, optional
|
|
190
189
|
Enable debug mode (default is False).
|
|
191
|
-
rt_floattype :
|
|
192
|
-
|
|
193
|
-
rt_floatset : Any, optional
|
|
194
|
-
Real-time float type setting (default is np.float64).
|
|
190
|
+
rt_floattype : np.dtype, optional
|
|
191
|
+
Rapidtide floating-point data type (default is np.float64).
|
|
195
192
|
|
|
196
193
|
Returns
|
|
197
194
|
-------
|
|
@@ -252,8 +249,7 @@ class RegressorRefiner:
|
|
|
252
249
|
... prewhitenregressor=True,
|
|
253
250
|
... prewhitenlags=5,
|
|
254
251
|
... debug=False,
|
|
255
|
-
... rt_floattype=
|
|
256
|
-
... rt_floatset=np.float32,
|
|
252
|
+
... rt_floattype=np.float32,
|
|
257
253
|
... )
|
|
258
254
|
"""
|
|
259
255
|
self.internalvalidfmrishape = internalvalidfmrishape
|
|
@@ -300,7 +296,6 @@ class RegressorRefiner:
|
|
|
300
296
|
self.prewhitenlags = prewhitenlags
|
|
301
297
|
self.debug = debug
|
|
302
298
|
self.rt_floattype = rt_floattype
|
|
303
|
-
self.rt_floatset = rt_floatset
|
|
304
299
|
|
|
305
300
|
self.setmasks(includemask, excludemask)
|
|
306
301
|
self.totalrefinementbytes = self._allocatemem(pid)
|
|
@@ -638,7 +633,6 @@ class RegressorRefiner:
|
|
|
638
633
|
showprogressbar=self.showprogressbar,
|
|
639
634
|
chunksize=self.chunksize,
|
|
640
635
|
padtrs=self.padtrs,
|
|
641
|
-
rt_floatset=self.rt_floatset,
|
|
642
636
|
rt_floattype=self.rt_floattype,
|
|
643
637
|
)
|
|
644
638
|
return voxelsprocessed_rra
|
|
@@ -781,7 +775,6 @@ class RegressorRefiner:
|
|
|
781
775
|
windowfunc=self.windowfunc,
|
|
782
776
|
cleanrefined=self.cleanrefined,
|
|
783
777
|
bipolar=self.bipolar,
|
|
784
|
-
rt_floatset=self.rt_floatset,
|
|
785
778
|
rt_floattype=self.rt_floattype,
|
|
786
779
|
)
|
|
787
780
|
outputdict = {}
|
|
@@ -976,8 +969,7 @@ def refineRegressor(
|
|
|
976
969
|
outputname: Any,
|
|
977
970
|
nativefmrishape: Any,
|
|
978
971
|
bidsbasedict: Any,
|
|
979
|
-
|
|
980
|
-
rt_floattype: str = "float64",
|
|
972
|
+
rt_floattype: np.dtype = np.float64,
|
|
981
973
|
debug: bool = False,
|
|
982
974
|
) -> None:
|
|
983
975
|
"""
|
|
@@ -1042,10 +1034,8 @@ def refineRegressor(
|
|
|
1042
1034
|
Shape of the native fMRI data.
|
|
1043
1035
|
bidsbasedict : dict
|
|
1044
1036
|
Dictionary for BIDS metadata.
|
|
1045
|
-
|
|
1037
|
+
rt_floattype : numpy.dtype, optional
|
|
1046
1038
|
Data type for floating-point operations, default is np.float64.
|
|
1047
|
-
rt_floattype : str, optional
|
|
1048
|
-
String representation of floating-point data type, default is "float64".
|
|
1049
1039
|
debug : bool, optional
|
|
1050
1040
|
Enable debug mode, default is False.
|
|
1051
1041
|
|
|
@@ -57,6 +57,7 @@ def regressfrommaps(
|
|
|
57
57
|
alwaysmultiproc: bool = False,
|
|
58
58
|
saveEVsandquit: bool = False,
|
|
59
59
|
coefficientsonly: bool = False,
|
|
60
|
+
timemask: Optional[NDArray] = None,
|
|
60
61
|
debug: bool = False,
|
|
61
62
|
) -> None:
|
|
62
63
|
"""
|
|
@@ -127,6 +128,8 @@ def regressfrommaps(
|
|
|
127
128
|
Save EVs and quit early (default is False).
|
|
128
129
|
coefficientsonly : bool, optional
|
|
129
130
|
Return only coefficients (default is False).
|
|
131
|
+
timemask : NDArray, optional
|
|
132
|
+
Mask of timepoints to include in regression filtering.
|
|
130
133
|
debug : bool, optional
|
|
131
134
|
Enable debug output (default is False).
|
|
132
135
|
|
|
@@ -189,8 +192,7 @@ def regressfrommaps(
|
|
|
189
192
|
print(f"\t{outputname=}")
|
|
190
193
|
print(f"\t{oversamptr=}")
|
|
191
194
|
print(f"\t{regressfiltthreshval=}")
|
|
192
|
-
|
|
193
|
-
rt_floattype = "float64"
|
|
195
|
+
rt_floattype = np.float64
|
|
194
196
|
numvalidspatiallocs = np.shape(validvoxels)[0]
|
|
195
197
|
|
|
196
198
|
# generate the voxel specific regressors
|
|
@@ -210,10 +212,12 @@ def regressfrommaps(
|
|
|
210
212
|
alwaysmultiproc=alwaysmultiproc,
|
|
211
213
|
showprogressbar=showprogressbar,
|
|
212
214
|
chunksize=chunksize,
|
|
213
|
-
rt_floatset=rt_floatset,
|
|
214
215
|
rt_floattype=rt_floattype,
|
|
215
216
|
debug=debug,
|
|
216
217
|
)
|
|
218
|
+
if timemask is not None:
|
|
219
|
+
lagtc = lagtc * timemask[None, :]
|
|
220
|
+
|
|
217
221
|
if debug:
|
|
218
222
|
print(f"\t{lagtimes.shape=}")
|
|
219
223
|
threshmask = np.where(fitmask > 0, 1, 0)
|
|
@@ -234,7 +238,7 @@ def regressfrommaps(
|
|
|
234
238
|
if debug:
|
|
235
239
|
print(f"adding derivatives up to order {regressderivs} prior to regression")
|
|
236
240
|
regressorset = tide_linfitfiltpass.makevoxelspecificderivs(lagtc, regressderivs)
|
|
237
|
-
baseev =
|
|
241
|
+
baseev = (genlagtc.yfromx(initial_fmri_x)).astype(rt_floattype)
|
|
238
242
|
evset = tide_linfitfiltpass.makevoxelspecificderivs(
|
|
239
243
|
baseev.reshape((1, -1)), regressderivs
|
|
240
244
|
).reshape((-1, 2))
|
|
@@ -242,7 +246,7 @@ def regressfrommaps(
|
|
|
242
246
|
if debug:
|
|
243
247
|
print(f"using raw lagged regressors for regression")
|
|
244
248
|
regressorset = lagtc
|
|
245
|
-
evset =
|
|
249
|
+
evset = (genlagtc.yfromx(initial_fmri_x)).astype(rt_floattype)
|
|
246
250
|
if debug:
|
|
247
251
|
print(f"{regressorset.shape=}")
|
|
248
252
|
|
|
@@ -273,7 +277,6 @@ def regressfrommaps(
|
|
|
273
277
|
showprogressbar=showprogressbar,
|
|
274
278
|
verbose=(LGR is not None),
|
|
275
279
|
chunksize=chunksize,
|
|
276
|
-
rt_floatset=rt_floatset,
|
|
277
280
|
rt_floattype=rt_floattype,
|
|
278
281
|
debug=debug,
|
|
279
282
|
)
|
|
@@ -215,10 +215,8 @@ def retrolagtcs(args: Any) -> None:
|
|
|
215
215
|
... )
|
|
216
216
|
>>> retrolagtcs(args)
|
|
217
217
|
"""
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
rt_outfloatset = np.float64
|
|
221
|
-
rt_outfloattype = "float64"
|
|
218
|
+
rt_floattype = np.float64
|
|
219
|
+
rt_outfloattype = np.float64
|
|
222
220
|
|
|
223
221
|
# get the pid of the parent process
|
|
224
222
|
args.pid = os.getpid()
|
|
@@ -318,13 +316,13 @@ def retrolagtcs(args: Any) -> None:
|
|
|
318
316
|
if args.debug:
|
|
319
317
|
print("allocating memory")
|
|
320
318
|
fitNorm, fitNorm_shm = tide_util.allocarray(
|
|
321
|
-
internalvalidspaceshapederivs,
|
|
319
|
+
internalvalidspaceshapederivs, rt_outfloattype, shared=usesharedmem
|
|
322
320
|
)
|
|
323
321
|
fitcoeff, fitcoeff_shm = tide_util.allocarray(
|
|
324
|
-
internalvalidspaceshapederivs,
|
|
322
|
+
internalvalidspaceshapederivs, rt_outfloattype, shared=usesharedmem
|
|
325
323
|
)
|
|
326
324
|
lagtc, lagtc_shm = tide_util.allocarray(
|
|
327
|
-
internalvalidfmrishape,
|
|
325
|
+
internalvalidfmrishape, rt_floattype, shared=usesharedmem
|
|
328
326
|
)
|
|
329
327
|
|
|
330
328
|
outputpath = os.path.dirname(args.outputroot)
|
|
@@ -414,7 +414,7 @@ def retroregress(args: Any) -> None:
|
|
|
414
414
|
# save the raw and formatted command lines
|
|
415
415
|
argstowrite = sys.argv
|
|
416
416
|
thecommandline = " ".join(sys.argv[1:])
|
|
417
|
-
tide_io.writevec([thecommandline], f"{outputname}_retrocommandline.txt")
|
|
417
|
+
tide_io.writevec(np.asarray([thecommandline]), f"{outputname}_retrocommandline.txt")
|
|
418
418
|
formattedcommandline = []
|
|
419
419
|
for thetoken in argstowrite[0:3]:
|
|
420
420
|
formattedcommandline.append(thetoken)
|
|
@@ -433,7 +433,9 @@ def retroregress(args: Any) -> None:
|
|
|
433
433
|
else:
|
|
434
434
|
suffix = ""
|
|
435
435
|
formattedcommandline[i] = prefix + formattedcommandline[i] + suffix
|
|
436
|
-
tide_io.writevec(
|
|
436
|
+
tide_io.writevec(
|
|
437
|
+
np.asarray(formattedcommandline), f"{outputname}_retroformattedcommandline.txt"
|
|
438
|
+
)
|
|
437
439
|
|
|
438
440
|
if args.nprocs < 1:
|
|
439
441
|
args.nprocs = tide_multiproc.maxcpus()
|
|
@@ -469,19 +471,15 @@ def retroregress(args: Any) -> None:
|
|
|
469
471
|
sys.exit()
|
|
470
472
|
|
|
471
473
|
if therunoptions["internalprecision"] == "double":
|
|
472
|
-
rt_floattype =
|
|
473
|
-
rt_floatset = np.float64
|
|
474
|
+
rt_floattype = np.float64
|
|
474
475
|
else:
|
|
475
|
-
rt_floattype =
|
|
476
|
-
rt_floatset = np.float32
|
|
476
|
+
rt_floattype = np.float32
|
|
477
477
|
|
|
478
478
|
# set the output precision
|
|
479
479
|
if therunoptions["outputprecision"] == "double":
|
|
480
|
-
rt_outfloattype =
|
|
481
|
-
rt_outfloatset = np.float64
|
|
480
|
+
rt_outfloattype = np.float64
|
|
482
481
|
else:
|
|
483
|
-
rt_outfloattype =
|
|
484
|
-
rt_outfloatset = np.float32
|
|
482
|
+
rt_outfloattype = np.float32
|
|
485
483
|
therunoptions["saveminimumsLFOfiltfiles"] = args.saveminimumsLFOfiltfiles
|
|
486
484
|
|
|
487
485
|
# read the fmri input files
|
|
@@ -773,7 +771,6 @@ def retroregress(args: Any) -> None:
|
|
|
773
771
|
maxdelay=args.maxdelay,
|
|
774
772
|
numpoints=args.numpoints,
|
|
775
773
|
histlen=therunoptions["histlen"],
|
|
776
|
-
rt_floatset=rt_floatset,
|
|
777
774
|
rt_floattype=rt_floattype,
|
|
778
775
|
debug=args.debug,
|
|
779
776
|
)
|
|
@@ -1058,13 +1055,10 @@ def retroregress(args: Any) -> None:
|
|
|
1058
1055
|
(initialvariance, "lfofilterInbandVarianceBefore", "map", None),
|
|
1059
1056
|
(finalvariance, "lfofilterInbandVarianceAfter", "map", None),
|
|
1060
1057
|
(varchange, "CVRVariance", "map", None),
|
|
1058
|
+
(rvalue, "CVRR", "map", None),
|
|
1059
|
+
(r2value, "CVRR2", "map", None),
|
|
1060
|
+
(fitcoeff[:, 0], "CVR", "map", "percent"),
|
|
1061
1061
|
]
|
|
1062
|
-
if args.savenormalsLFOfiltfiles:
|
|
1063
|
-
maplist += [
|
|
1064
|
-
(rvalue, "CVRR", "map", None),
|
|
1065
|
-
(r2value, "CVRR2", "map", None),
|
|
1066
|
-
(fitcoeff, "CVR", "map", "percent"),
|
|
1067
|
-
]
|
|
1068
1062
|
bidsdict = bidsbasedict.copy()
|
|
1069
1063
|
|
|
1070
1064
|
if args.debug or args.focaldebug:
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
#
|
|
19
19
|
import argparse
|
|
20
20
|
import sys
|
|
21
|
-
from argparse import Namespace
|
|
22
21
|
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
|
23
22
|
|
|
24
23
|
import numpy as np
|
|
@@ -128,8 +127,8 @@ def _get_parser() -> Any:
|
|
|
128
127
|
|
|
129
128
|
|
|
130
129
|
def summarize4Dbylabel(
|
|
131
|
-
inputvoxels:
|
|
132
|
-
) ->
|
|
130
|
+
inputvoxels: NDArray, templatevoxels: NDArray, normmethod: str = "z", debug: bool = False
|
|
131
|
+
) -> NDArray:
|
|
133
132
|
"""
|
|
134
133
|
Summarize 4D voxel data by region labels from a template.
|
|
135
134
|
|
|
@@ -138,9 +137,9 @@ def summarize4Dbylabel(
|
|
|
138
137
|
|
|
139
138
|
Parameters
|
|
140
139
|
----------
|
|
141
|
-
inputvoxels :
|
|
140
|
+
inputvoxels : NDArray
|
|
142
141
|
4D array containing voxel data with shape (n_voxels, n_timepoints, n_other_dims)
|
|
143
|
-
templatevoxels :
|
|
142
|
+
templatevoxels : NDArray
|
|
144
143
|
3D array containing region labels with shape (n_voxels, 1, 1)
|
|
145
144
|
normmethod : str, optional
|
|
146
145
|
Normalization method to apply to time courses, default is "z"
|
|
@@ -151,7 +150,7 @@ def summarize4Dbylabel(
|
|
|
151
150
|
|
|
152
151
|
Returns
|
|
153
152
|
-------
|
|
154
|
-
timecourses :
|
|
153
|
+
timecourses : NDArray
|
|
155
154
|
2D array of shape (n_regions, n_timepoints) containing normalized mean
|
|
156
155
|
time courses for each region
|
|
157
156
|
|
|
@@ -187,7 +186,9 @@ def summarize4Dbylabel(
|
|
|
187
186
|
return timecourses
|
|
188
187
|
|
|
189
188
|
|
|
190
|
-
def summarize3Dbylabel(
|
|
189
|
+
def summarize3Dbylabel(
|
|
190
|
+
inputvoxels: NDArray, templatevoxels: NDArray, debug: bool = False
|
|
191
|
+
) -> Tuple[NDArray, list]:
|
|
191
192
|
"""
|
|
192
193
|
Summarize 3D voxel data by label using mean, standard deviation, and median statistics.
|
|
193
194
|
|
|
@@ -197,9 +198,9 @@ def summarize3Dbylabel(inputvoxels: Any, templatevoxels: Any, debug: bool = Fals
|
|
|
197
198
|
|
|
198
199
|
Parameters
|
|
199
200
|
----------
|
|
200
|
-
inputvoxels :
|
|
201
|
+
inputvoxels : NDArray
|
|
201
202
|
3D array containing the voxel values to be summarized
|
|
202
|
-
templatevoxels :
|
|
203
|
+
templatevoxels : NDArray
|
|
203
204
|
3D array containing integer labels defining regions of interest
|
|
204
205
|
debug : bool, optional
|
|
205
206
|
Flag to enable debug output (default is False)
|
|
@@ -208,7 +209,7 @@ def summarize3Dbylabel(inputvoxels: Any, templatevoxels: Any, debug: bool = Fals
|
|
|
208
209
|
-------
|
|
209
210
|
tuple
|
|
210
211
|
A tuple containing:
|
|
211
|
-
- outputvoxels :
|
|
212
|
+
- outputvoxels : NDArray
|
|
212
213
|
3D array with each labeled region replaced by its mean value
|
|
213
214
|
- regionstats : list
|
|
214
215
|
List of lists containing [mean, std, median] statistics for each region
|
|
@@ -531,7 +531,7 @@ def showarbcorr(args: Any) -> None:
|
|
|
531
531
|
print("trimmed Correlator lengths (x, y):", len(xcorr_x_trim), len(thexcorr_trim))
|
|
532
532
|
|
|
533
533
|
print(f"{len(filtereddata1)=}, {len(filtereddata2)=}")
|
|
534
|
-
thepxcorr = pearsonr(filtereddata1, filtereddata2)
|
|
534
|
+
thepxcorr = pearsonr(filtereddata1, filtereddata2).statistic
|
|
535
535
|
|
|
536
536
|
# initialize the correlation fitter
|
|
537
537
|
thexsimfuncfitter = tide_simFuncClasses.SimilarityFunctionFitter(
|
|
@@ -597,7 +597,7 @@ def showarbcorr(args: Any) -> None:
|
|
|
597
597
|
else:
|
|
598
598
|
# report the pearson correlation
|
|
599
599
|
if showpearson:
|
|
600
|
-
print("Pearson_R:\t", thepxcorr
|
|
600
|
+
print("Pearson_R:\t", thepxcorr)
|
|
601
601
|
print("")
|
|
602
602
|
if args.label is not None:
|
|
603
603
|
print(args.label, ":\t", -maxdelay)
|
|
@@ -204,7 +204,7 @@ def _get_parser() -> Any:
|
|
|
204
204
|
default=False,
|
|
205
205
|
)
|
|
206
206
|
|
|
207
|
-
pf.addpermutationopts(
|
|
207
|
+
pf.addpermutationopts(parser, numreps=0)
|
|
208
208
|
|
|
209
209
|
# similarity function options
|
|
210
210
|
similarityopts = parser.add_argument_group("Similarity function options")
|
|
@@ -927,7 +927,7 @@ def showxcorrx(args: Any) -> None:
|
|
|
927
927
|
tide_io.writenpvecs(corrlist_pear, "corrlist_pear.txt")
|
|
928
928
|
|
|
929
929
|
if args.debug:
|
|
930
|
-
print(thepxcorr)
|
|
930
|
+
print(thepxcorr.statistic, thepxcorr.pvalue)
|
|
931
931
|
|
|
932
932
|
if args.similaritymetric == "mutualinfo":
|
|
933
933
|
print(f"{tcname1}[0] = {tcname2}[{-maxdelaymi} seconds]")
|
|
@@ -961,7 +961,7 @@ def showxcorrx(args: Any) -> None:
|
|
|
961
961
|
"xcorr_maxdelay",
|
|
962
962
|
]
|
|
963
963
|
thedataitems = [
|
|
964
|
-
str(thepxcorr
|
|
964
|
+
str(thepxcorr.statistic),
|
|
965
965
|
str(pearpcts_fit[0]),
|
|
966
966
|
str(R),
|
|
967
967
|
str(pcts_fit[0]),
|
|
@@ -970,8 +970,8 @@ def showxcorrx(args: Any) -> None:
|
|
|
970
970
|
else:
|
|
971
971
|
thelabelitems = ["pearson_R", "pearson_p", "xcorr_R", "xcorr_maxdelay"]
|
|
972
972
|
thedataitems = [
|
|
973
|
-
str(thepxcorr
|
|
974
|
-
str(thepxcorr
|
|
973
|
+
str(thepxcorr.statistic),
|
|
974
|
+
str(thepxcorr.pvalue),
|
|
975
975
|
str(R),
|
|
976
976
|
str(-maxdelay),
|
|
977
977
|
]
|
|
@@ -990,7 +990,7 @@ def showxcorrx(args: Any) -> None:
|
|
|
990
990
|
"""else:
|
|
991
991
|
# report the pearson correlation
|
|
992
992
|
if showpearson:
|
|
993
|
-
print("Pearson_R:\t", thepxcorr
|
|
993
|
+
print("Pearson_R:\t", thepxcorr.statistic)
|
|
994
994
|
if args.numestreps > 0:
|
|
995
995
|
for idx, percentile in enumerate(thepercentiles):
|
|
996
996
|
print(
|
rapidtide/workflows/simdata.py
CHANGED
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
#
|
|
18
18
|
#
|
|
19
19
|
import argparse
|
|
20
|
-
|
|
21
|
-
from typing import Any,
|
|
20
|
+
import sys
|
|
21
|
+
from typing import Any, Optional, Tuple
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
import numpy as np
|
|
24
24
|
from numpy.typing import NDArray
|
|
25
25
|
|
|
26
26
|
import rapidtide.filter as tide_filt
|
|
@@ -206,7 +206,7 @@ def _get_parser() -> Any:
|
|
|
206
206
|
|
|
207
207
|
def prepareband(
|
|
208
208
|
simdatadims: Any,
|
|
209
|
-
pctfile:
|
|
209
|
+
pctfile: str,
|
|
210
210
|
sigfracfile: Any,
|
|
211
211
|
lagfile: Any,
|
|
212
212
|
regressorfile: Any,
|
|
@@ -228,7 +228,7 @@ def prepareband(
|
|
|
228
228
|
----------
|
|
229
229
|
simdatadims : Any
|
|
230
230
|
Spatial dimensions of the fMRI data.
|
|
231
|
-
pctfile :
|
|
231
|
+
pctfile : str
|
|
232
232
|
Path to the NIfTI file containing percentile data. If None, `sigfracfile` is used.
|
|
233
233
|
sigfracfile : Any
|
|
234
234
|
Path to the NIfTI file containing signal fraction data. Used if `pctfile` is None.
|
|
@@ -355,28 +355,28 @@ def prepareband(
|
|
|
355
355
|
|
|
356
356
|
|
|
357
357
|
def fmrisignal(
|
|
358
|
-
Fs:
|
|
359
|
-
times:
|
|
360
|
-
meanvalue:
|
|
358
|
+
Fs: float,
|
|
359
|
+
times: NDArray,
|
|
360
|
+
meanvalue: float,
|
|
361
361
|
dolfo: bool = False,
|
|
362
|
-
lfowave: Optional[
|
|
363
|
-
lfomag: Optional[
|
|
362
|
+
lfowave: Optional[object] = None,
|
|
363
|
+
lfomag: Optional[NDArray] = None,
|
|
364
364
|
lfodelay: Optional[Any] = None,
|
|
365
365
|
lfonoise: float = 0.0,
|
|
366
|
-
lfofilter: Optional[
|
|
366
|
+
lfofilter: Optional[object] = None,
|
|
367
367
|
doresp: bool = False,
|
|
368
|
-
respwave: Optional[
|
|
369
|
-
respmag: Optional[
|
|
370
|
-
respdelay: Optional[
|
|
368
|
+
respwave: Optional[object] = None,
|
|
369
|
+
respmag: Optional[NDArray] = None,
|
|
370
|
+
respdelay: Optional[NDArray] = None,
|
|
371
371
|
respnoise: float = 0.0,
|
|
372
|
-
respfilter: Optional[
|
|
372
|
+
respfilter: Optional[object] = None,
|
|
373
373
|
docardiac: bool = False,
|
|
374
|
-
cardiacwave: Optional[
|
|
375
|
-
cardiacmag: Optional[
|
|
376
|
-
cardiacdelay: Optional[
|
|
374
|
+
cardiacwave: Optional[object] = None,
|
|
375
|
+
cardiacmag: Optional[NDArray] = None,
|
|
376
|
+
cardiacdelay: Optional[NDArray] = None,
|
|
377
377
|
cardiacnoise: float = 0.0,
|
|
378
|
-
cardiacfilter: Optional[
|
|
379
|
-
) ->
|
|
378
|
+
cardiacfilter: Optional[object] = None,
|
|
379
|
+
) -> NDArray:
|
|
380
380
|
"""
|
|
381
381
|
Generate an fMRI signal by combining multiple physiological waveforms.
|
|
382
382
|
|
|
@@ -387,15 +387,15 @@ def fmrisignal(
|
|
|
387
387
|
|
|
388
388
|
Parameters
|
|
389
389
|
----------
|
|
390
|
-
Fs :
|
|
390
|
+
Fs : float
|
|
391
391
|
Sampling frequency of the signal.
|
|
392
|
-
times :
|
|
392
|
+
times : NDArray
|
|
393
393
|
Time vector for the signal.
|
|
394
|
-
meanvalue :
|
|
394
|
+
meanvalue : float
|
|
395
395
|
Base mean signal value.
|
|
396
396
|
dolfo : bool, optional
|
|
397
397
|
Whether to include low-frequency oscillation (LFO) component. Default is False.
|
|
398
|
-
lfowave : Optional[
|
|
398
|
+
lfowave : Optional[object], optional
|
|
399
399
|
Waveform object for LFO signal. Default is None.
|
|
400
400
|
lfomag : Optional[Any], optional
|
|
401
401
|
Magnitude of LFO signal. Default is None.
|
|
@@ -403,11 +403,11 @@ def fmrisignal(
|
|
|
403
403
|
Delay for LFO signal. Default is None.
|
|
404
404
|
lfonoise : float, optional
|
|
405
405
|
Noise level for LFO signal. Default is 0.0.
|
|
406
|
-
lfofilter : Optional[
|
|
406
|
+
lfofilter : Optional[object], optional
|
|
407
407
|
Filter object for LFO noise. Default is None.
|
|
408
408
|
doresp : bool, optional
|
|
409
409
|
Whether to include respiratory signal component. Default is False.
|
|
410
|
-
respwave : Optional[
|
|
410
|
+
respwave : Optional[object], optional
|
|
411
411
|
Waveform object for respiratory signal. Default is None.
|
|
412
412
|
respmag : Optional[Any], optional
|
|
413
413
|
Magnitude of respiratory signal. Default is None.
|
|
@@ -415,11 +415,11 @@ def fmrisignal(
|
|
|
415
415
|
Delay for respiratory signal. Default is None.
|
|
416
416
|
respnoise : float, optional
|
|
417
417
|
Noise level for respiratory signal. Default is 0.0.
|
|
418
|
-
respfilter : Optional[
|
|
418
|
+
respfilter : Optional[object], optional
|
|
419
419
|
Filter object for respiratory noise. Default is None.
|
|
420
420
|
docardiac : bool, optional
|
|
421
421
|
Whether to include cardiac signal component. Default is False.
|
|
422
|
-
cardiacwave : Optional[
|
|
422
|
+
cardiacwave : Optional[object], optional
|
|
423
423
|
Waveform object for cardiac signal. Default is None.
|
|
424
424
|
cardiacmag : Optional[Any], optional
|
|
425
425
|
Magnitude of cardiac signal. Default is None.
|
|
@@ -427,7 +427,7 @@ def fmrisignal(
|
|
|
427
427
|
Delay for cardiac signal. Default is None.
|
|
428
428
|
cardiacnoise : float, optional
|
|
429
429
|
Noise level for cardiac signal. Default is 0.0.
|
|
430
|
-
cardiacfilter : Optional[
|
|
430
|
+
cardiacfilter : Optional[object], optional
|
|
431
431
|
Filter object for cardiac noise. Default is None.
|
|
432
432
|
|
|
433
433
|
Returns
|
|
@@ -444,7 +444,6 @@ def fmrisignal(
|
|
|
444
444
|
|
|
445
445
|
Examples
|
|
446
446
|
--------
|
|
447
|
-
>>> import numpy as np
|
|
448
447
|
>>> Fs = 100
|
|
449
448
|
>>> times = np.linspace(0, 10, 1000)
|
|
450
449
|
>>> meanvalue = 1.0
|
|
@@ -468,7 +467,8 @@ def fmrisignal(
|
|
|
468
467
|
cardiacmag * cardiacwave.yfromx(times - cardiacdelay)
|
|
469
468
|
+ cardiacnoise * cardiacfilter.apply(Fs, np.random.standard_normal(len(times)))
|
|
470
469
|
)
|
|
471
|
-
|
|
470
|
+
thesignal += meanvalue
|
|
471
|
+
return thesignal
|
|
472
472
|
|
|
473
473
|
|
|
474
474
|
def simdata(args: Any) -> None:
|
rapidtide/workflows/spatialmi.py
CHANGED
rapidtide/workflows/tidepool.py
CHANGED
|
@@ -3672,7 +3672,9 @@ def updateLUT() -> None:
|
|
|
3672
3672
|
timecourse_ax.plot(timeaxis, selected, clear=True)"""
|
|
3673
3673
|
|
|
3674
3674
|
|
|
3675
|
-
def mapwithLUT(
|
|
3675
|
+
def mapwithLUT(
|
|
3676
|
+
theimage: NDArray, themask: NDArray, theLUT: Any, dispmin: Any, dispmax: Any
|
|
3677
|
+
) -> None:
|
|
3676
3678
|
"""
|
|
3677
3679
|
Map image data using a lookup table with optional masking.
|
|
3678
3680
|
|
|
@@ -3681,9 +3683,9 @@ def mapwithLUT(theimage: Any, themask: Any, theLUT: Any, dispmin: Any, dispmax:
|
|
|
3681
3683
|
|
|
3682
3684
|
Parameters
|
|
3683
3685
|
----------
|
|
3684
|
-
theimage :
|
|
3686
|
+
theimage : NDArray
|
|
3685
3687
|
Input image data to be mapped
|
|
3686
|
-
themask :
|
|
3688
|
+
themask : NDArray
|
|
3687
3689
|
Mask array where values less than 1 will be set to 0 in the output
|
|
3688
3690
|
theLUT : array-like
|
|
3689
3691
|
Lookup table array used for mapping
|
|
@@ -3694,7 +3696,7 @@ def mapwithLUT(theimage: Any, themask: Any, theLUT: Any, dispmin: Any, dispmax:
|
|
|
3694
3696
|
|
|
3695
3697
|
Returns
|
|
3696
3698
|
-------
|
|
3697
|
-
|
|
3699
|
+
NDArray
|
|
3698
3700
|
Mapped data with shape matching input image, where values are
|
|
3699
3701
|
mapped using the lookup table and masked according to themask parameter
|
|
3700
3702
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rapidtide
|
|
3
|
-
Version: 3.1
|
|
3
|
+
Version: 3.1.1
|
|
4
4
|
Summary: Tools for performing correlation analysis on fMRI data.
|
|
5
5
|
Author: Taylor Salo, Daniel M. Drucker, Ph.D., Jeffrey N Stout, Yaroslav O. Halchenko, Derek Monroe
|
|
6
6
|
Author-email: "Blaise deB. Frederick" <blaise.frederick@gmail.com>
|
|
@@ -20,29 +20,30 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
-
Requires-Python: >=3.
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
24
|
Description-Content-Type: text/x-rst
|
|
25
25
|
License-File: LICENSE
|
|
26
26
|
Requires-Dist: numpy
|
|
27
|
-
Requires-Dist: scipy
|
|
27
|
+
Requires-Dist: scipy
|
|
28
28
|
Requires-Dist: pandas
|
|
29
29
|
Requires-Dist: pyarrow
|
|
30
30
|
Requires-Dist: scikit-image
|
|
31
31
|
Requires-Dist: scikit-learn
|
|
32
32
|
Requires-Dist: nibabel
|
|
33
33
|
Requires-Dist: nilearn
|
|
34
|
-
Requires-Dist: matplotlib
|
|
35
|
-
Requires-Dist: pyqtgraph
|
|
34
|
+
Requires-Dist: matplotlib
|
|
35
|
+
Requires-Dist: pyqtgraph
|
|
36
36
|
Requires-Dist: pyqt6-sip
|
|
37
37
|
Requires-Dist: pyqt6
|
|
38
38
|
Requires-Dist: requests
|
|
39
39
|
Requires-Dist: statsmodels
|
|
40
40
|
Requires-Dist: pywavelets
|
|
41
|
-
Requires-Dist: tensorflow>=2.18.0
|
|
42
|
-
Requires-Dist: tf-keras>=2.18.0
|
|
43
41
|
Requires-Dist: torch
|
|
44
42
|
Requires-Dist: tqdm
|
|
45
43
|
Requires-Dist: versioneer
|
|
44
|
+
Provides-Extra: tf
|
|
45
|
+
Requires-Dist: tensorflow>=2.18.0; extra == "tf"
|
|
46
|
+
Requires-Dist: tf-keras>=2.18.0; extra == "tf"
|
|
46
47
|
Provides-Extra: test
|
|
47
48
|
Requires-Dist: codecov; extra == "test"
|
|
48
49
|
Requires-Dist: coverage; extra == "test"
|