rapidtide 3.0.8__py3-none-any.whl → 3.0.10__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 +15 -6
- rapidtide/RapidtideDataset.py +22 -7
- rapidtide/_version.py +3 -3
- rapidtide/data/examples/src/testfmri +26 -20
- rapidtide/data/examples/src/testhappy +0 -1
- rapidtide/filter.py +60 -111
- rapidtide/fit.py +501 -108
- rapidtide/io.py +19 -8
- rapidtide/linfitfiltpass.py +44 -25
- rapidtide/refinedelay.py +2 -2
- rapidtide/refineregressor.py +1 -1
- rapidtide/resample.py +8 -8
- rapidtide/simFuncClasses.py +13 -7
- rapidtide/tests/.coveragerc +17 -11
- rapidtide/tests/test_delayestimation.py +1 -1
- rapidtide/tests/test_findmaxlag.py +31 -16
- rapidtide/tests/test_fullrunrapidtide_v8.py +66 -0
- rapidtide/tests/test_padvec.py +19 -1
- rapidtide/tests/test_simroundtrip.py +124 -0
- rapidtide/tidepoolTemplate.py +37 -37
- rapidtide/tidepoolTemplate_alt.py +40 -40
- rapidtide/tidepoolTemplate_big.py +56 -56
- rapidtide/workflows/calcSimFuncMap.py +271 -0
- rapidtide/workflows/delayvar.py +1 -1
- rapidtide/workflows/fitSimFuncMap.py +427 -0
- rapidtide/workflows/happy.py +2 -2
- rapidtide/workflows/parser_funcs.py +1 -1
- rapidtide/workflows/rapidtide.py +197 -48
- rapidtide/workflows/rapidtide_parser.py +23 -2
- rapidtide/workflows/regressfrommaps.py +7 -7
- rapidtide/workflows/tidepool.py +51 -15
- {rapidtide-3.0.8.dist-info → rapidtide-3.0.10.dist-info}/METADATA +3 -3
- {rapidtide-3.0.8.dist-info → rapidtide-3.0.10.dist-info}/RECORD +37 -34
- rapidtide/workflows/estimateDelayMap.py +0 -536
- {rapidtide-3.0.8.dist-info → rapidtide-3.0.10.dist-info}/WHEEL +0 -0
- {rapidtide-3.0.8.dist-info → rapidtide-3.0.10.dist-info}/entry_points.txt +0 -0
- {rapidtide-3.0.8.dist-info → rapidtide-3.0.10.dist-info}/licenses/LICENSE +0 -0
- {rapidtide-3.0.8.dist-info → rapidtide-3.0.10.dist-info}/top_level.txt +0 -0
rapidtide/workflows/rapidtide.py
CHANGED
|
@@ -45,8 +45,9 @@ import rapidtide.stats as tide_stats
|
|
|
45
45
|
import rapidtide.util as tide_util
|
|
46
46
|
import rapidtide.voxelData as tide_voxelData
|
|
47
47
|
import rapidtide.wiener as tide_wiener
|
|
48
|
+
import rapidtide.workflows.calcSimFuncMap as tide_calcSimFuncMap
|
|
48
49
|
import rapidtide.workflows.cleanregressor as tide_cleanregressor
|
|
49
|
-
import rapidtide.workflows.
|
|
50
|
+
import rapidtide.workflows.fitSimFuncMap as tide_fitSimFuncMap
|
|
50
51
|
import rapidtide.workflows.refineDelayMap as tide_refineDelayMap
|
|
51
52
|
import rapidtide.workflows.refineRegressor as tide_refineRegressor
|
|
52
53
|
import rapidtide.workflows.regressfrommaps as tide_regressfrommaps
|
|
@@ -113,6 +114,10 @@ def echocancel(thetimecourse, echooffset, thetimestep, outputname, padtimepoints
|
|
|
113
114
|
)
|
|
114
115
|
return outputtimecourse, echofit, echoR2
|
|
115
116
|
|
|
117
|
+
def setpassoptions(passdict, optiondict):
|
|
118
|
+
for key, value in passdict.items():
|
|
119
|
+
optiondict[key] = value
|
|
120
|
+
|
|
116
121
|
|
|
117
122
|
def rapidtide_main(argparsingfunc):
|
|
118
123
|
optiondict, theprefilter = argparsingfunc
|
|
@@ -572,7 +577,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
572
577
|
savename = f"{outputname}_desc-processed_mask"
|
|
573
578
|
tide_io.savetonifti(corrmask.reshape(xsize, ysize, numslices), theheader, savename)
|
|
574
579
|
|
|
575
|
-
LGR.verbose(f"image threshval = {threshval}")
|
|
580
|
+
LGR.verbose(f"image threshval = {threshval:.2f}")
|
|
576
581
|
validvoxels = np.where(corrmask > 0)[0]
|
|
577
582
|
if optiondict["debug"]:
|
|
578
583
|
print(f"{validvoxels.shape=}")
|
|
@@ -967,7 +972,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
967
972
|
)
|
|
968
973
|
LGR.verbose("Input vector")
|
|
969
974
|
LGR.verbose(f"length: {len(inputvec)}")
|
|
970
|
-
LGR.verbose(f"input freq: {inputfreq}")
|
|
975
|
+
LGR.verbose(f"input freq: {inputfreq:.2f}")
|
|
971
976
|
LGR.verbose(f"input start time: {inputstarttime:.3f}")
|
|
972
977
|
|
|
973
978
|
if not optiondict["useinitregressorref"]:
|
|
@@ -1345,6 +1350,29 @@ def rapidtide_main(argparsingfunc):
|
|
|
1345
1350
|
append=False,
|
|
1346
1351
|
)
|
|
1347
1352
|
|
|
1353
|
+
# prepare for fast resampling
|
|
1354
|
+
optiondict["fastresamplerpadtime"] = (
|
|
1355
|
+
max((-optiondict["lagmin"], optiondict["lagmax"]))
|
|
1356
|
+
+ 30.0
|
|
1357
|
+
+ np.abs(optiondict["offsettime"])
|
|
1358
|
+
)
|
|
1359
|
+
numpadtrs = int(optiondict["fastresamplerpadtime"] // fmritr)
|
|
1360
|
+
optiondict["fastresamplerpadtime"] = fmritr * numpadtrs
|
|
1361
|
+
LGR.info(f"setting up fast resampling with padtime = {optiondict['fastresamplerpadtime']}")
|
|
1362
|
+
|
|
1363
|
+
genlagtc = tide_resample.FastResampler(
|
|
1364
|
+
reference_x, reference_y, padtime=optiondict["fastresamplerpadtime"]
|
|
1365
|
+
)
|
|
1366
|
+
genlagtc.save(f"{outputname}_desc-lagtcgenerator_timeseries")
|
|
1367
|
+
if optiondict["debug"]:
|
|
1368
|
+
genlagtc.info()
|
|
1369
|
+
totalpadlen = validtimepoints + 2 * numpadtrs
|
|
1370
|
+
paddedinitial_fmri_x = (
|
|
1371
|
+
np.linspace(0.0, totalpadlen * fmritr, num=totalpadlen, endpoint=False)
|
|
1372
|
+
+ skiptime
|
|
1373
|
+
- fmritr * numpadtrs
|
|
1374
|
+
)
|
|
1375
|
+
|
|
1348
1376
|
# allocate all the data arrays
|
|
1349
1377
|
tide_util.logmem("before main array allocation")
|
|
1350
1378
|
internalspaceshape = numspatiallocs
|
|
@@ -1359,7 +1387,30 @@ def rapidtide_main(argparsingfunc):
|
|
|
1359
1387
|
outmaparray = np.zeros(internalspaceshape, dtype=rt_floattype)
|
|
1360
1388
|
tide_util.logmem("after main array allocation")
|
|
1361
1389
|
|
|
1362
|
-
|
|
1390
|
+
if optiondict["similaritymetric"] == "riptide":
|
|
1391
|
+
riptideregressorset, riptidedelays = tide_calcSimFuncMap.makeRIPTiDeRegressors(
|
|
1392
|
+
initial_fmri_x,
|
|
1393
|
+
optiondict["lagmin"],
|
|
1394
|
+
optiondict["lagmax"],
|
|
1395
|
+
genlagtc,
|
|
1396
|
+
LGR,
|
|
1397
|
+
targetstep=optiondict["riptidestep"],
|
|
1398
|
+
edgepad=0,
|
|
1399
|
+
showprogressbar=optiondict["showprogressbar"],
|
|
1400
|
+
chunksize=optiondict["mp_chunksize"],
|
|
1401
|
+
nprocs=optiondict["nprocs"],
|
|
1402
|
+
alwaysmultiproc=optiondict["alwaysmultiproc"],
|
|
1403
|
+
rt_floatset=rt_floatset,
|
|
1404
|
+
rt_floattype=rt_floattype,
|
|
1405
|
+
debug=optiondict["debug"],
|
|
1406
|
+
)
|
|
1407
|
+
numriptideregressors = riptideregressorset.shape[0]
|
|
1408
|
+
corroutlen = numriptideregressors
|
|
1409
|
+
else:
|
|
1410
|
+
riptideregressorset = None
|
|
1411
|
+
riptidedelays = None
|
|
1412
|
+
corroutlen = np.shape(trimmedcorrscale)[0]
|
|
1413
|
+
|
|
1363
1414
|
if theinputdata.filetype == "text":
|
|
1364
1415
|
nativecorrshape = (xsize, corroutlen)
|
|
1365
1416
|
else:
|
|
@@ -1372,6 +1423,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
1372
1423
|
LGR.debug(
|
|
1373
1424
|
f"allocating memory for correlation arrays {internalcorrshape} {internalvalidcorrshape}"
|
|
1374
1425
|
)
|
|
1426
|
+
|
|
1375
1427
|
corrout, corrout_shm = tide_util.allocarray(
|
|
1376
1428
|
internalvalidcorrshape,
|
|
1377
1429
|
rt_floatset,
|
|
@@ -1427,29 +1479,6 @@ def rapidtide_main(argparsingfunc):
|
|
|
1427
1479
|
else:
|
|
1428
1480
|
theinitialdelay = None
|
|
1429
1481
|
|
|
1430
|
-
# prepare for fast resampling
|
|
1431
|
-
optiondict["fastresamplerpadtime"] = (
|
|
1432
|
-
max((-optiondict["lagmin"], optiondict["lagmax"]))
|
|
1433
|
-
+ 30.0
|
|
1434
|
-
+ np.abs(optiondict["offsettime"])
|
|
1435
|
-
)
|
|
1436
|
-
numpadtrs = int(optiondict["fastresamplerpadtime"] // fmritr)
|
|
1437
|
-
optiondict["fastresamplerpadtime"] = fmritr * numpadtrs
|
|
1438
|
-
LGR.info(f"setting up fast resampling with padtime = {optiondict['fastresamplerpadtime']}")
|
|
1439
|
-
|
|
1440
|
-
genlagtc = tide_resample.FastResampler(
|
|
1441
|
-
reference_x, reference_y, padtime=optiondict["fastresamplerpadtime"]
|
|
1442
|
-
)
|
|
1443
|
-
genlagtc.save(f"{outputname}_desc-lagtcgenerator_timeseries")
|
|
1444
|
-
if optiondict["debug"]:
|
|
1445
|
-
genlagtc.info()
|
|
1446
|
-
totalpadlen = validtimepoints + 2 * numpadtrs
|
|
1447
|
-
paddedinitial_fmri_x = (
|
|
1448
|
-
np.linspace(0.0, totalpadlen * fmritr, num=totalpadlen, endpoint=False)
|
|
1449
|
-
+ skiptime
|
|
1450
|
-
- fmritr * numpadtrs
|
|
1451
|
-
)
|
|
1452
|
-
|
|
1453
1482
|
if theinputdata.filetype == "text":
|
|
1454
1483
|
nativefmrishape = (xsize, np.shape(initial_fmri_x)[0])
|
|
1455
1484
|
elif theinputdata.filetype == "cifti":
|
|
@@ -1465,7 +1494,12 @@ def rapidtide_main(argparsingfunc):
|
|
|
1465
1494
|
)
|
|
1466
1495
|
|
|
1467
1496
|
# now do the arrays for delay refinement
|
|
1468
|
-
if
|
|
1497
|
+
if (
|
|
1498
|
+
optiondict["dolinfitfilt"]
|
|
1499
|
+
or optiondict["docvrmap"]
|
|
1500
|
+
or optiondict["refinedelay"]
|
|
1501
|
+
or (optiondict["similaritymetric"] == "riptide")
|
|
1502
|
+
):
|
|
1469
1503
|
if optiondict["refinedelay"]:
|
|
1470
1504
|
derivaxissize = np.max([2, optiondict["regressderivs"] + 1])
|
|
1471
1505
|
else:
|
|
@@ -1526,6 +1560,13 @@ def rapidtide_main(argparsingfunc):
|
|
|
1526
1560
|
thesize, theunit = tide_util.format_bytes(optiondict["totalRefineDelaybytes"])
|
|
1527
1561
|
print(f"allocated {thesize:.3f} {theunit} {ramlocation} for delay refinement")
|
|
1528
1562
|
tide_util.logmem("after derivative delay/sLFO filter array allocation")
|
|
1563
|
+
else:
|
|
1564
|
+
sLFOfitmean = None
|
|
1565
|
+
rvalue = None
|
|
1566
|
+
r2value = None
|
|
1567
|
+
fitNorm = None
|
|
1568
|
+
fitcoeff = None
|
|
1569
|
+
lagtc = None
|
|
1529
1570
|
|
|
1530
1571
|
# prepare for regressor refinement, if we're doing it
|
|
1531
1572
|
if (
|
|
@@ -1686,6 +1727,19 @@ def rapidtide_main(argparsingfunc):
|
|
|
1686
1727
|
optiondict["currentstage"] = "preprocessingdone"
|
|
1687
1728
|
tide_io.writedicttojson(optiondict, f"{outputname}_desc-runoptions_info.json")
|
|
1688
1729
|
|
|
1730
|
+
# set up the pass options array
|
|
1731
|
+
optiondict["passoptions"] = []
|
|
1732
|
+
"""optiondict["passoptions"].append(
|
|
1733
|
+
{
|
|
1734
|
+
"similaritymetric": "riptide"
|
|
1735
|
+
}
|
|
1736
|
+
)
|
|
1737
|
+
optiondict["passoptions"].append(
|
|
1738
|
+
{
|
|
1739
|
+
"similaritymetric": optiondict["similaritymetric"]
|
|
1740
|
+
}
|
|
1741
|
+
)"""
|
|
1742
|
+
|
|
1689
1743
|
####################################################
|
|
1690
1744
|
# Start the iterative fit and refinement
|
|
1691
1745
|
####################################################
|
|
@@ -1698,6 +1752,10 @@ def rapidtide_main(argparsingfunc):
|
|
|
1698
1752
|
LGR.info("\n\n*********************")
|
|
1699
1753
|
LGR.info(f"Pass number {thepass}")
|
|
1700
1754
|
|
|
1755
|
+
# fetch the pass options
|
|
1756
|
+
if len(optiondict["passoptions"]) >= thepass:
|
|
1757
|
+
setpassoptions(optiondict["passoptions"][thepass - 1], optiondict)
|
|
1758
|
+
|
|
1701
1759
|
referencetc = tide_math.corrnormalize(
|
|
1702
1760
|
resampref_y[osvalidsimcalcstart : osvalidsimcalcend + 1],
|
|
1703
1761
|
detrendorder=optiondict["detrendorder"],
|
|
@@ -1756,13 +1814,6 @@ def rapidtide_main(argparsingfunc):
|
|
|
1756
1814
|
LGR.info(f"\n\nSignificance estimation, pass {thepass}")
|
|
1757
1815
|
if optiondict["checkpoint"]:
|
|
1758
1816
|
# bidsify
|
|
1759
|
-
"""tide_io.writebidstsv(
|
|
1760
|
-
f"{outputname}_desc-movingregressor_timeseries",
|
|
1761
|
-
tide_math.stdnormalize(resampnonosref_y),
|
|
1762
|
-
1.0 / fmritr,
|
|
1763
|
-
columns=["pass1"],
|
|
1764
|
-
append=False,
|
|
1765
|
-
)"""
|
|
1766
1817
|
tide_io.writenpvecs(
|
|
1767
1818
|
cleaned_referencetc,
|
|
1768
1819
|
f"{outputname}_cleanedreference_pass" + str(thepass) + ".txt",
|
|
@@ -1903,8 +1954,9 @@ def rapidtide_main(argparsingfunc):
|
|
|
1903
1954
|
optiondict["currentstage"] = f"precorrelation_pass{thepass}"
|
|
1904
1955
|
tide_io.writedicttojson(optiondict, f"{outputname}_desc-runoptions_info.json")
|
|
1905
1956
|
|
|
1906
|
-
#
|
|
1907
|
-
|
|
1957
|
+
# Step 1a - do the initial delay estimation
|
|
1958
|
+
similaritytype = tide_calcSimFuncMap.calcSimFunc(
|
|
1959
|
+
numvalidspatiallocs,
|
|
1908
1960
|
fmri_data_valid,
|
|
1909
1961
|
validsimcalcstart,
|
|
1910
1962
|
validsimcalcend,
|
|
@@ -1916,12 +1968,81 @@ def rapidtide_main(argparsingfunc):
|
|
|
1916
1968
|
theMutualInformationator,
|
|
1917
1969
|
cleaned_referencetc,
|
|
1918
1970
|
corrout,
|
|
1971
|
+
riptideregressorset,
|
|
1972
|
+
riptidedelays,
|
|
1973
|
+
sLFOfitmean,
|
|
1974
|
+
r2value,
|
|
1975
|
+
fitcoeff,
|
|
1976
|
+
fitNorm,
|
|
1919
1977
|
meanval,
|
|
1920
1978
|
corrscale,
|
|
1921
1979
|
outputname,
|
|
1922
1980
|
outcorrarray,
|
|
1923
1981
|
validvoxels,
|
|
1924
1982
|
nativecorrshape,
|
|
1983
|
+
theinputdata,
|
|
1984
|
+
theheader,
|
|
1985
|
+
lagmininpts,
|
|
1986
|
+
lagmaxinpts,
|
|
1987
|
+
thepass,
|
|
1988
|
+
optiondict,
|
|
1989
|
+
LGR,
|
|
1990
|
+
TimingLGR,
|
|
1991
|
+
similaritymetric=optiondict["similaritymetric"],
|
|
1992
|
+
simcalcoffset=optiondict["simcalcoffset"],
|
|
1993
|
+
echocancel=optiondict["echocancel"],
|
|
1994
|
+
checkpoint=optiondict["checkpoint"],
|
|
1995
|
+
mklthreads=optiondict["mklthreads"],
|
|
1996
|
+
nprocs=optiondict["nprocs_calcsimilarity"],
|
|
1997
|
+
alwaysmultiproc=optiondict["alwaysmultiproc"],
|
|
1998
|
+
oversampfactor=optiondict["oversampfactor"],
|
|
1999
|
+
interptype=optiondict["interptype"],
|
|
2000
|
+
showprogressbar=optiondict["showprogressbar"],
|
|
2001
|
+
chunksize=optiondict["mp_chunksize"],
|
|
2002
|
+
rt_floatset=rt_floatset,
|
|
2003
|
+
rt_floattype=rt_floattype,
|
|
2004
|
+
threaddebug=optiondict["threaddebug"],
|
|
2005
|
+
debug=optiondict["focaldebug"],
|
|
2006
|
+
)
|
|
2007
|
+
if optiondict["similaritymetric"] == "riptide":
|
|
2008
|
+
optiondict["despeckle_passes"] = 0
|
|
2009
|
+
fitcorrscale = riptidedelays
|
|
2010
|
+
else:
|
|
2011
|
+
fitcorrscale = trimmedcorrscale
|
|
2012
|
+
|
|
2013
|
+
if optiondict["saveintermediatemaps"]:
|
|
2014
|
+
theheader = theinputdata.copyheader(numtimepoints=1)
|
|
2015
|
+
bidspasssuffix = f"_intermediatedata-pass{thepass}"
|
|
2016
|
+
maplist = [
|
|
2017
|
+
(lagtimes, "maxtimecoarse", "map", "second", "Lag time in seconds"),
|
|
2018
|
+
(lagstrengths, "maxcorrcoarse", "map", None, "Maximum correlation strength"),
|
|
2019
|
+
]
|
|
2020
|
+
tide_io.savemaplist(
|
|
2021
|
+
f"{outputname}{bidspasssuffix}",
|
|
2022
|
+
maplist,
|
|
2023
|
+
validvoxels,
|
|
2024
|
+
nativespaceshape,
|
|
2025
|
+
theheader,
|
|
2026
|
+
bidsbasedict,
|
|
2027
|
+
filetype=theinputdata.filetype,
|
|
2028
|
+
rt_floattype=rt_floattype,
|
|
2029
|
+
cifti_hdr=theinputdata.cifti_hdr,
|
|
2030
|
+
)
|
|
2031
|
+
|
|
2032
|
+
# Step 2a - fit the delay function
|
|
2033
|
+
internaldespeckleincludemask = tide_fitSimFuncMap.fitSimFunc(
|
|
2034
|
+
fmri_data_valid,
|
|
2035
|
+
validsimcalcstart,
|
|
2036
|
+
validsimcalcend,
|
|
2037
|
+
osvalidsimcalcstart,
|
|
2038
|
+
osvalidsimcalcend,
|
|
2039
|
+
initial_fmri_x,
|
|
2040
|
+
os_fmri_x,
|
|
2041
|
+
theMutualInformationator,
|
|
2042
|
+
cleaned_referencetc,
|
|
2043
|
+
corrout,
|
|
2044
|
+
outputname,
|
|
2045
|
+
validvoxels,
|
|
1925
2046
|
nativespaceshape,
|
|
1926
2047
|
bidsbasedict,
|
|
1927
2048
|
numspatiallocs,
|
|
@@ -1941,17 +2062,18 @@ def rapidtide_main(argparsingfunc):
|
|
|
1941
2062
|
lagsigma,
|
|
1942
2063
|
failreason,
|
|
1943
2064
|
outmaparray,
|
|
1944
|
-
|
|
1945
|
-
|
|
2065
|
+
fitcorrscale,
|
|
2066
|
+
similaritytype,
|
|
1946
2067
|
thepass,
|
|
1947
2068
|
optiondict,
|
|
1948
2069
|
LGR,
|
|
1949
2070
|
TimingLGR,
|
|
2071
|
+
simplefit=(optiondict["similaritymetric"] == "riptide"),
|
|
1950
2072
|
rt_floatset=np.float64,
|
|
1951
2073
|
rt_floattype="float64",
|
|
1952
2074
|
)
|
|
1953
2075
|
|
|
1954
|
-
# refine delay
|
|
2076
|
+
# Step 2b - refine delay (optional)
|
|
1955
2077
|
if optiondict["refinedelayeachpass"]:
|
|
1956
2078
|
if optiondict["delayoffsetgausssigma"] < 0.0 and theinputdata.filetype != "text":
|
|
1957
2079
|
# set gausssigma automatically
|
|
@@ -2006,7 +2128,26 @@ def rapidtide_main(argparsingfunc):
|
|
|
2006
2128
|
)
|
|
2007
2129
|
lagtimes[:] = lagtimes + delayoffset
|
|
2008
2130
|
|
|
2009
|
-
|
|
2131
|
+
if optiondict["saveintermediatemaps"]:
|
|
2132
|
+
theheader = theinputdata.copyheader(numtimepoints=1)
|
|
2133
|
+
bidspasssuffix = f"_intermediatedata-pass{thepass}"
|
|
2134
|
+
maplist = [
|
|
2135
|
+
(lagtimes, "maxtimerefined", "map", "second", "Lag time in seconds"),
|
|
2136
|
+
(lagstrengths, "maxcorrrefined", "map", None, "Maximum correlation strength"),
|
|
2137
|
+
]
|
|
2138
|
+
tide_io.savemaplist(
|
|
2139
|
+
f"{outputname}{bidspasssuffix}",
|
|
2140
|
+
maplist,
|
|
2141
|
+
validvoxels,
|
|
2142
|
+
nativespaceshape,
|
|
2143
|
+
theheader,
|
|
2144
|
+
bidsbasedict,
|
|
2145
|
+
filetype=theinputdata.filetype,
|
|
2146
|
+
rt_floattype=rt_floattype,
|
|
2147
|
+
cifti_hdr=theinputdata.cifti_hdr,
|
|
2148
|
+
)
|
|
2149
|
+
|
|
2150
|
+
# Step 2b - make a rank order map
|
|
2010
2151
|
timepercentile = (
|
|
2011
2152
|
100.0 * (rankdata(lagtimes, method="dense") - 1) / (numvalidspatiallocs - 1)
|
|
2012
2153
|
)
|
|
@@ -2499,7 +2640,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
2499
2640
|
nprocs_makelaggedtcs=optiondict["nprocs_makelaggedtcs"],
|
|
2500
2641
|
nprocs_regressionfilt=optiondict["nprocs_regressionfilt"],
|
|
2501
2642
|
regressderivs=optiondict["regressderivs"],
|
|
2502
|
-
|
|
2643
|
+
chunksize=optiondict["mp_chunksize"],
|
|
2503
2644
|
showprogressbar=optiondict["showprogressbar"],
|
|
2504
2645
|
alwaysmultiproc=optiondict["alwaysmultiproc"],
|
|
2505
2646
|
debug=optiondict["debug"],
|
|
@@ -2987,7 +3128,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
2987
3128
|
nprocs_makelaggedtcs=optiondict["nprocs_makelaggedtcs"],
|
|
2988
3129
|
nprocs_regressionfilt=optiondict["nprocs_regressionfilt"],
|
|
2989
3130
|
regressderivs=optiondict["regressderivs"],
|
|
2990
|
-
|
|
3131
|
+
chunksize=optiondict["mp_chunksize"],
|
|
2991
3132
|
showprogressbar=optiondict["showprogressbar"],
|
|
2992
3133
|
alwaysmultiproc=optiondict["alwaysmultiproc"],
|
|
2993
3134
|
debug=optiondict["debug"],
|
|
@@ -3147,11 +3288,19 @@ def rapidtide_main(argparsingfunc):
|
|
|
3147
3288
|
del fitmask
|
|
3148
3289
|
|
|
3149
3290
|
# now do the 4D maps of the similarity function and friends
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3291
|
+
if optiondict["similaritymetric"] == "riptide":
|
|
3292
|
+
theheader = theinputdata.copyheader(
|
|
3293
|
+
numtimepoints=np.shape(outcorrarray)[1],
|
|
3294
|
+
tr=riptidedelays[1] - riptidedelays[0],
|
|
3295
|
+
toffset=(riptidedelays[0]),
|
|
3296
|
+
)
|
|
3297
|
+
else:
|
|
3298
|
+
theheader = theinputdata.copyheader(
|
|
3299
|
+
numtimepoints=np.shape(outcorrarray)[1],
|
|
3300
|
+
tr=corrtr,
|
|
3301
|
+
toffset=(corrscale[corrorigin - lagmininpts]),
|
|
3302
|
+
)
|
|
3303
|
+
|
|
3155
3304
|
if (
|
|
3156
3305
|
optiondict["savecorrout"]
|
|
3157
3306
|
or (optiondict["outputlevel"] != "min")
|
|
@@ -96,6 +96,9 @@ DEFAULT_OUTPUTLEVEL = "normal"
|
|
|
96
96
|
|
|
97
97
|
DEFAULT_SLFONOISEAMP_WINDOWSIZE = 40.0
|
|
98
98
|
|
|
99
|
+
DEFAULT_COARSEDELAY_TYPE = "simfunc"
|
|
100
|
+
DEFAULT_RIPTIDESTEP = 2.0
|
|
101
|
+
|
|
99
102
|
DEFAULT_PATCHTHRESH = 3.0
|
|
100
103
|
DEFAULT_REFINEDELAYMINDELAY = -5.0
|
|
101
104
|
DEFAULT_REFINEDELAYMAXDELAY = 5.0
|
|
@@ -779,10 +782,10 @@ def _get_parser():
|
|
|
779
782
|
dest="similaritymetric",
|
|
780
783
|
action="store",
|
|
781
784
|
type=str,
|
|
782
|
-
choices=["correlation", "mutualinfo", "hybrid"],
|
|
785
|
+
choices=["correlation", "mutualinfo", "hybrid", "riptide"],
|
|
783
786
|
help=(
|
|
784
787
|
"Similarity metric for finding delay values. "
|
|
785
|
-
'Choices are "correlation", "mutualinfo", and "
|
|
788
|
+
'Choices are "correlation", "mutualinfo", "hybrid", and "riptide". '
|
|
786
789
|
f"Default is {DEFAULT_SIMILARITYMETRIC}."
|
|
787
790
|
),
|
|
788
791
|
default=DEFAULT_SIMILARITYMETRIC,
|
|
@@ -1442,6 +1445,17 @@ def _get_parser():
|
|
|
1442
1445
|
experimental = parser.add_argument_group(
|
|
1443
1446
|
"Experimental options (not fully tested, or not tested at all, may not work). Beware!"
|
|
1444
1447
|
)
|
|
1448
|
+
output.add_argument(
|
|
1449
|
+
"--riptidestep", # was -h
|
|
1450
|
+
dest="riptidestep",
|
|
1451
|
+
action="store",
|
|
1452
|
+
type=lambda x: pf.is_float(parser, x, maxval=5.0),
|
|
1453
|
+
metavar="STEP",
|
|
1454
|
+
help=(
|
|
1455
|
+
f"Timestep between RIPTiDe regressors, in seconds. Default is {DEFAULT_RIPTIDESTEP}."
|
|
1456
|
+
),
|
|
1457
|
+
default=DEFAULT_RIPTIDESTEP,
|
|
1458
|
+
)
|
|
1445
1459
|
experimental.add_argument(
|
|
1446
1460
|
"--refinedelayeachpass",
|
|
1447
1461
|
dest="refinedelayeachpass",
|
|
@@ -2206,6 +2220,13 @@ def process_args(inputargs=None):
|
|
|
2206
2220
|
print(f"illegal output level {args['outputlevel']}")
|
|
2207
2221
|
sys.exit()
|
|
2208
2222
|
|
|
2223
|
+
# make the pass options dictionary
|
|
2224
|
+
args["passoptions"] = [
|
|
2225
|
+
{"similaritymetric": "riptide",},
|
|
2226
|
+
{"similaritymetric": "correlation", },
|
|
2227
|
+
{"similaritymetric": "correlation", },
|
|
2228
|
+
]
|
|
2229
|
+
|
|
2209
2230
|
# dispersion calculation
|
|
2210
2231
|
args["dispersioncalc_lower"] = args["lagmin"]
|
|
2211
2232
|
args["dispersioncalc_upper"] = args["lagmax"]
|
|
@@ -49,11 +49,11 @@ def regressfrommaps(
|
|
|
49
49
|
nprocs_makelaggedtcs=1,
|
|
50
50
|
nprocs_regressionfilt=1,
|
|
51
51
|
regressderivs=0,
|
|
52
|
-
|
|
52
|
+
chunksize=50000,
|
|
53
53
|
showprogressbar=True,
|
|
54
54
|
alwaysmultiproc=False,
|
|
55
55
|
saveEVsandquit=False,
|
|
56
|
-
|
|
56
|
+
coefficientsonly=False,
|
|
57
57
|
debug=False,
|
|
58
58
|
):
|
|
59
59
|
if debug:
|
|
@@ -61,7 +61,7 @@ def regressfrommaps(
|
|
|
61
61
|
print(f"\t{nprocs_makelaggedtcs=}")
|
|
62
62
|
print(f"\t{nprocs_regressionfilt=}")
|
|
63
63
|
print(f"\t{regressderivs=}")
|
|
64
|
-
print(f"\t{
|
|
64
|
+
print(f"\t{chunksize=}")
|
|
65
65
|
print(f"\t{showprogressbar=}")
|
|
66
66
|
print(f"\t{alwaysmultiproc=}")
|
|
67
67
|
print(f"\t{mode=}")
|
|
@@ -88,7 +88,7 @@ def regressfrommaps(
|
|
|
88
88
|
nprocs=nprocs_makelaggedtcs,
|
|
89
89
|
alwaysmultiproc=alwaysmultiproc,
|
|
90
90
|
showprogressbar=showprogressbar,
|
|
91
|
-
chunksize=
|
|
91
|
+
chunksize=chunksize,
|
|
92
92
|
rt_floatset=rt_floatset,
|
|
93
93
|
rt_floattype=rt_floattype,
|
|
94
94
|
debug=debug,
|
|
@@ -146,12 +146,12 @@ def regressfrommaps(
|
|
|
146
146
|
fitNorm,
|
|
147
147
|
movingsignal,
|
|
148
148
|
filtereddata,
|
|
149
|
-
|
|
149
|
+
coefficientsonly=coefficientsonly,
|
|
150
150
|
nprocs=nprocs_regressionfilt,
|
|
151
151
|
alwaysmultiproc=alwaysmultiproc,
|
|
152
152
|
showprogressbar=showprogressbar,
|
|
153
153
|
verbose=(LGR is not None),
|
|
154
|
-
|
|
154
|
+
chunksize=chunksize,
|
|
155
155
|
rt_floatset=rt_floatset,
|
|
156
156
|
rt_floattype=rt_floattype,
|
|
157
157
|
debug=debug,
|
|
@@ -162,7 +162,7 @@ def regressfrommaps(
|
|
|
162
162
|
fitcoeff *= 100.0
|
|
163
163
|
|
|
164
164
|
# determine what was removed
|
|
165
|
-
if not
|
|
165
|
+
if not coefficientsonly:
|
|
166
166
|
removeddata = fmri_data_valid - filtereddata
|
|
167
167
|
noiseremoved = np.var(removeddata, axis=0)
|
|
168
168
|
if saveminimumsLFOfiltfiles:
|
rapidtide/workflows/tidepool.py
CHANGED
|
@@ -39,12 +39,17 @@ from rapidtide.simFuncClasses import SimilarityFunctionFitter
|
|
|
39
39
|
from rapidtide.workflows.atlasaverage import summarizevoxels
|
|
40
40
|
|
|
41
41
|
try:
|
|
42
|
-
from
|
|
42
|
+
from PySide6.QtCore import __version__
|
|
43
43
|
except ImportError:
|
|
44
|
-
|
|
44
|
+
try:
|
|
45
|
+
from PyQt6.QtCore import QT_VERSION_STR
|
|
46
|
+
except ImportError:
|
|
47
|
+
pyqtbinding = "pyqt5"
|
|
48
|
+
else:
|
|
49
|
+
pyqtbinding = "pyqt6"
|
|
45
50
|
else:
|
|
46
|
-
|
|
47
|
-
print(f"using {
|
|
51
|
+
pyqtbinding = "pyside6"
|
|
52
|
+
print(f"using {pyqtbinding=}")
|
|
48
53
|
|
|
49
54
|
os.environ["QT_MAC_WANTS_LAYER"] = "1"
|
|
50
55
|
|
|
@@ -184,10 +189,14 @@ def updateFileMenu():
|
|
|
184
189
|
global fileMenu, sel_open
|
|
185
190
|
global sel_files
|
|
186
191
|
|
|
187
|
-
if
|
|
192
|
+
if pyqtbinding == "pyqt5":
|
|
188
193
|
qactionfunc = QtWidgets.QAction
|
|
189
|
-
|
|
194
|
+
elif pyqtbinding == "pyqt6":
|
|
190
195
|
qactionfunc = QtGui.QAction
|
|
196
|
+
elif pyqtbinding == "pyside6":
|
|
197
|
+
qactionfunc = QtGui.QAction
|
|
198
|
+
else:
|
|
199
|
+
print("unsupported")
|
|
191
200
|
|
|
192
201
|
# scrub file menu
|
|
193
202
|
if sel_files is not None:
|
|
@@ -214,10 +223,14 @@ def datasetPicker():
|
|
|
214
223
|
global verbosity
|
|
215
224
|
|
|
216
225
|
mydialog = QtWidgets.QFileDialog()
|
|
217
|
-
if
|
|
226
|
+
if pyqtbinding == "pyqt5":
|
|
218
227
|
options = mydialog.Options()
|
|
219
|
-
|
|
228
|
+
elif pyqtbinding == "pyqt6":
|
|
220
229
|
options = mydialog.options()
|
|
230
|
+
elif pyqtbinding == "pyside6":
|
|
231
|
+
options = mydialog.options()
|
|
232
|
+
else:
|
|
233
|
+
print("unsupported")
|
|
221
234
|
lagfilename = mydialog.getOpenFileName(
|
|
222
235
|
options=options,
|
|
223
236
|
filter="Lag time files (*_lagtimes.nii.gz *_desc-maxtime_map.nii.gz)",
|
|
@@ -591,8 +604,14 @@ class xyztlocation(QtWidgets.QWidget):
|
|
|
591
604
|
|
|
592
605
|
|
|
593
606
|
def logStatus(thetextbox, thetext):
|
|
594
|
-
if
|
|
607
|
+
if pyqtbinding == "pyqt5":
|
|
595
608
|
thetextbox.moveCursor(QtGui.QTextCursor.End)
|
|
609
|
+
elif pyqtbinding == "pyqt6":
|
|
610
|
+
pass
|
|
611
|
+
elif pyqtbinding == "pyside6":
|
|
612
|
+
pass
|
|
613
|
+
else:
|
|
614
|
+
print("unsupported")
|
|
596
615
|
thetextbox.insertPlainText(thetext + "\n")
|
|
597
616
|
sb = thetextbox.verticalScrollBar()
|
|
598
617
|
sb.setValue(sb.maximum())
|
|
@@ -1773,20 +1792,29 @@ def tidepool(args):
|
|
|
1773
1792
|
uiinitialized = False
|
|
1774
1793
|
sel_files = None
|
|
1775
1794
|
|
|
1776
|
-
if
|
|
1795
|
+
if pyqtbinding == "pyqt5":
|
|
1777
1796
|
if args.uistyle == "normal":
|
|
1778
1797
|
import rapidtide.tidepoolTemplate_alt as uiTemplate
|
|
1779
1798
|
elif args.uistyle == "big":
|
|
1780
1799
|
import rapidtide.tidepoolTemplate_big as uiTemplate
|
|
1781
1800
|
else:
|
|
1782
1801
|
import rapidtide.tidepoolTemplate as uiTemplate
|
|
1783
|
-
|
|
1802
|
+
elif pyqtbinding == "pyqt6":
|
|
1784
1803
|
if args.uistyle == "normal":
|
|
1785
1804
|
import rapidtide.tidepoolTemplate_alt_qt6 as uiTemplate
|
|
1786
1805
|
elif args.uistyle == "big":
|
|
1787
1806
|
import rapidtide.tidepoolTemplate_big_qt6 as uiTemplate
|
|
1788
1807
|
else:
|
|
1789
1808
|
import rapidtide.tidepoolTemplate_qt6 as uiTemplate
|
|
1809
|
+
elif pyqtbinding == "pyside6":
|
|
1810
|
+
if args.uistyle == "normal":
|
|
1811
|
+
import rapidtide.tidepoolTemplate_alt_qt6 as uiTemplate
|
|
1812
|
+
elif args.uistyle == "big":
|
|
1813
|
+
import rapidtide.tidepoolTemplate_big_qt6 as uiTemplate
|
|
1814
|
+
else:
|
|
1815
|
+
import rapidtide.tidepoolTemplate_qt6 as uiTemplate
|
|
1816
|
+
else:
|
|
1817
|
+
print("unsupported")
|
|
1790
1818
|
|
|
1791
1819
|
verbosity = args.verbose
|
|
1792
1820
|
print(f"verbosity: {verbosity}")
|
|
@@ -1839,10 +1867,14 @@ def tidepool(args):
|
|
|
1839
1867
|
print("creating menu bar")
|
|
1840
1868
|
menuBar = win.menuBar()
|
|
1841
1869
|
fileMenu = menuBar.addMenu("File")
|
|
1842
|
-
if
|
|
1870
|
+
if pyqtbinding == "pyqt5":
|
|
1843
1871
|
qactionfunc = QtWidgets.QAction
|
|
1844
|
-
|
|
1872
|
+
elif pyqtbinding == "pyqt6":
|
|
1845
1873
|
qactionfunc = QtGui.QAction
|
|
1874
|
+
elif pyqtbinding == "pyside6":
|
|
1875
|
+
qactionfunc = QtGui.QAction
|
|
1876
|
+
else:
|
|
1877
|
+
print("unsupported")
|
|
1846
1878
|
sel_open = qactionfunc("Add dataset...", win)
|
|
1847
1879
|
sel_open.triggered.connect(datasetPicker)
|
|
1848
1880
|
fileMenu.addAction(sel_open)
|
|
@@ -2196,10 +2228,14 @@ def tidepool(args):
|
|
|
2196
2228
|
|
|
2197
2229
|
# define things for the popup mask menu
|
|
2198
2230
|
popMaskMenu = QtWidgets.QMenu(win)
|
|
2199
|
-
if
|
|
2231
|
+
if pyqtbinding == "pyqt5":
|
|
2200
2232
|
qactionfunc = QtWidgets.QAction
|
|
2201
|
-
|
|
2233
|
+
elif pyqtbinding == "pyqt6":
|
|
2202
2234
|
qactionfunc = QtGui.QAction
|
|
2235
|
+
elif pyqtbinding == "pyside6":
|
|
2236
|
+
qactionfunc = QtGui.QAction
|
|
2237
|
+
else:
|
|
2238
|
+
print("unsupported")
|
|
2203
2239
|
sel_nomask = qactionfunc("No mask", win)
|
|
2204
2240
|
sel_lagmask = qactionfunc("Valid fit", win)
|
|
2205
2241
|
sel_brainmask = qactionfunc("Externally provided brain mask", win)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rapidtide
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.10
|
|
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>
|
|
@@ -38,8 +38,8 @@ Requires-Dist: pyqt6
|
|
|
38
38
|
Requires-Dist: requests
|
|
39
39
|
Requires-Dist: statsmodels
|
|
40
40
|
Requires-Dist: pywavelets
|
|
41
|
-
Requires-Dist: tensorflow>=2.
|
|
42
|
-
Requires-Dist: tf-keras
|
|
41
|
+
Requires-Dist: tensorflow>=2.18.0
|
|
42
|
+
Requires-Dist: tf-keras>=2.18.0
|
|
43
43
|
Requires-Dist: tqdm
|
|
44
44
|
Requires-Dist: versioneer
|
|
45
45
|
Provides-Extra: tests
|