rapidtide 3.0a12__py3-none-any.whl → 3.0a13__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.
- cloud/gmscalc-HCPYA +1 -1
- cloud/rapidtide-HCPYA +3 -3
- rapidtide/Colortables.py +10 -10
- rapidtide/DerivativeDelay.py +211 -0
- rapidtide/{Refiner.py → RegressorRefiner.py} +1 -1
- rapidtide/__init__.py +2 -1
- rapidtide/_version.py +1 -1
- rapidtide/data/examples/src/test_mlregressallt.py +32 -17
- rapidtide/data/examples/src/testalign +1 -1
- rapidtide/data/examples/src/testboth +1 -1
- rapidtide/data/examples/src/testcifti +11 -0
- rapidtide/data/examples/src/testdelayvar +13 -0
- rapidtide/data/examples/src/testfmri +1 -0
- rapidtide/data/examples/src/testglmfilt +8 -6
- rapidtide/data/examples/src/testhappy +1 -1
- rapidtide/data/examples/src/testnewrefine +11 -11
- rapidtide/data/examples/src/testnoiseamp +2 -2
- rapidtide/data/examples/src/testretro +16 -7
- rapidtide/data/examples/src/testretrolagtcs +1 -1
- rapidtide/dlfilter.py +0 -1
- rapidtide/fit.py +41 -9
- rapidtide/happy_supportfuncs.py +5 -0
- rapidtide/io.py +13 -2
- rapidtide/{glmpass.py → linfitfiltpass.py} +21 -19
- rapidtide/refinedelay.py +96 -58
- rapidtide/resample.py +3 -0
- rapidtide/scripts/{retroglm.py → delayvar.py} +2 -2
- rapidtide/scripts/{glmfilt.py → linfitfilt.py} +2 -2
- rapidtide/scripts/retroregress.py +28 -0
- rapidtide/scripts/stupidramtricks.py +9 -7
- rapidtide/simfuncfit.py +1 -1
- rapidtide/tests/cleanposttest +21 -0
- rapidtide/tests/test_delayestimation.py +3 -3
- rapidtide/tests/test_fastresampler.py +1 -2
- rapidtide/tests/test_fullrunhappy_v1.py +1 -1
- rapidtide/tests/test_fullrunhappy_v2.py +1 -1
- rapidtide/tests/test_fullrunrapidtide_v1.py +2 -2
- rapidtide/tests/test_fullrunrapidtide_v3.py +1 -1
- rapidtide/tests/test_fullrunrapidtide_v5.py +1 -1
- rapidtide/tests/test_fullrunrapidtide_v6.py +11 -11
- rapidtide/tests/{test_glmpass.py → test_linfitfiltpass.py} +9 -9
- rapidtide/tests/test_motionregress.py +3 -3
- rapidtide/tests/test_refinedelay.py +12 -12
- rapidtide/tidepoolTemplate_alt_qt6.py +172 -45
- rapidtide/tidepoolTemplate_big_qt6.py +196 -53
- rapidtide/tidepoolTemplate_qt6.py +150 -39
- rapidtide/workflows/delayvar.py +1048 -0
- rapidtide/workflows/happy.py +37 -11
- rapidtide/workflows/happy_parser.py +4 -4
- rapidtide/workflows/{glmfilt.py → linfitfilt.py} +4 -4
- rapidtide/workflows/rapidtide.py +235 -171
- rapidtide/workflows/rapidtide_parser.py +103 -86
- rapidtide/workflows/{glmfrommaps.py → regressfrommaps.py} +28 -26
- rapidtide/workflows/retrolagtcs.py +12 -12
- rapidtide/workflows/{retroglm.py → retroregress.py} +158 -141
- {rapidtide-3.0a12.dist-info → rapidtide-3.0a13.dist-info}/METADATA +3 -2
- {rapidtide-3.0a12.dist-info → rapidtide-3.0a13.dist-info}/RECORD +61 -56
- {rapidtide-3.0a12.dist-info → rapidtide-3.0a13.dist-info}/WHEEL +1 -1
- {rapidtide-3.0a12.dist-info → rapidtide-3.0a13.dist-info}/entry_points.txt +3 -2
- rapidtide/data/examples/src/testoutputsize +0 -45
- {rapidtide-3.0a12.dist-info → rapidtide-3.0a13.dist-info/licenses}/LICENSE +0 -0
- {rapidtide-3.0a12.dist-info → rapidtide-3.0a13.dist-info}/top_level.txt +0 -0
rapidtide/workflows/rapidtide.py
CHANGED
|
@@ -37,22 +37,22 @@ import rapidtide.calcsimfunc as tide_calcsimfunc
|
|
|
37
37
|
import rapidtide.correlate as tide_corr
|
|
38
38
|
import rapidtide.filter as tide_filt
|
|
39
39
|
import rapidtide.fit as tide_fit
|
|
40
|
-
import rapidtide.glmpass as tide_glmpass
|
|
41
40
|
import rapidtide.helper_classes as tide_classes
|
|
42
41
|
import rapidtide.io as tide_io
|
|
42
|
+
import rapidtide.linfitfiltpass as tide_linfitfiltpass
|
|
43
43
|
import rapidtide.maskutil as tide_mask
|
|
44
44
|
import rapidtide.miscmath as tide_math
|
|
45
45
|
import rapidtide.multiproc as tide_multiproc
|
|
46
46
|
import rapidtide.patchmatch as tide_patch
|
|
47
47
|
import rapidtide.peakeval as tide_peakeval
|
|
48
48
|
import rapidtide.refinedelay as tide_refinedelay
|
|
49
|
-
import rapidtide.
|
|
49
|
+
import rapidtide.RegressorRefiner as tide_regrefiner
|
|
50
50
|
import rapidtide.resample as tide_resample
|
|
51
51
|
import rapidtide.simfuncfit as tide_simfuncfit
|
|
52
52
|
import rapidtide.stats as tide_stats
|
|
53
53
|
import rapidtide.util as tide_util
|
|
54
54
|
import rapidtide.wiener as tide_wiener
|
|
55
|
-
import rapidtide.workflows.
|
|
55
|
+
import rapidtide.workflows.regressfrommaps as tide_regressfrommaps
|
|
56
56
|
from rapidtide.tests.utils import mse
|
|
57
57
|
|
|
58
58
|
from .utils import setup_logger
|
|
@@ -382,10 +382,10 @@ def rapidtide_main(argparsingfunc):
|
|
|
382
382
|
else:
|
|
383
383
|
optiondict["nprocs_makelaggedtcs"] = optiondict["nprocs"]
|
|
384
384
|
|
|
385
|
-
if optiondict["
|
|
386
|
-
optiondict["
|
|
385
|
+
if optiondict["singleproc_regressionfilt"]:
|
|
386
|
+
optiondict["nprocs_regressionfilt"] = 1
|
|
387
387
|
else:
|
|
388
|
-
optiondict["
|
|
388
|
+
optiondict["nprocs_regressionfilt"] = optiondict["nprocs"]
|
|
389
389
|
|
|
390
390
|
# set the number of MKL threads to use
|
|
391
391
|
if mklexists:
|
|
@@ -889,7 +889,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
889
889
|
mergedregressorlabels,
|
|
890
890
|
fmri_data_valid,
|
|
891
891
|
confoundr2,
|
|
892
|
-
) =
|
|
892
|
+
) = tide_linfitfiltpass.confoundregress(
|
|
893
893
|
mergedregressors,
|
|
894
894
|
mergedregressorlabels,
|
|
895
895
|
fmri_data_valid,
|
|
@@ -961,7 +961,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
961
961
|
)
|
|
962
962
|
if optiondict["memprofile"]:
|
|
963
963
|
memcheckpoint("...done")
|
|
964
|
-
tide_util.logmem("after confound
|
|
964
|
+
tide_util.logmem("after confound sLFO filter")
|
|
965
965
|
|
|
966
966
|
if optiondict["saveconfoundfiltered"]:
|
|
967
967
|
if not optiondict["textio"]:
|
|
@@ -1736,7 +1736,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
1736
1736
|
or optiondict["convergencethresh"] is not None
|
|
1737
1737
|
):
|
|
1738
1738
|
# we will be doing regressor refinement, so set that up
|
|
1739
|
-
theRegressorRefiner =
|
|
1739
|
+
theRegressorRefiner = tide_regrefiner.RegressorRefiner(
|
|
1740
1740
|
internalvalidfmrishape,
|
|
1741
1741
|
internalvalidpaddedfmrishape,
|
|
1742
1742
|
optiondict["pid"],
|
|
@@ -1948,7 +1948,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
1948
1948
|
)
|
|
1949
1949
|
|
|
1950
1950
|
# regress out
|
|
1951
|
-
resampref_y, datatoremove, R, dummy = tide_fit.
|
|
1951
|
+
resampref_y, datatoremove, R, dummy = tide_fit.linfitfilt(
|
|
1952
1952
|
resampref_y, shiftednoise, debug=True
|
|
1953
1953
|
)
|
|
1954
1954
|
|
|
@@ -3155,20 +3155,20 @@ def rapidtide_main(argparsingfunc):
|
|
|
3155
3155
|
tide_util.cleanup_shm(wpeak_shm)
|
|
3156
3156
|
|
|
3157
3157
|
####################################################
|
|
3158
|
-
#
|
|
3158
|
+
# Linear regression filtering start
|
|
3159
3159
|
####################################################
|
|
3160
|
-
# Post refinement step 1 -
|
|
3160
|
+
# Post refinement step 1 - regression fitting, either to remove moving signal, or to calculate delayed CVR
|
|
3161
3161
|
# write out the current version of the run options
|
|
3162
|
-
optiondict["currentstage"] = "
|
|
3162
|
+
optiondict["currentstage"] = "presLFOfit"
|
|
3163
3163
|
tide_io.writedicttojson(optiondict, f"{outputname}_desc-runoptions_info.json")
|
|
3164
|
-
if optiondict["
|
|
3165
|
-
if optiondict["
|
|
3164
|
+
if optiondict["dolinfitfilt"] or optiondict["docvrmap"] or optiondict["refinedelay"]:
|
|
3165
|
+
if optiondict["dolinfitfilt"]:
|
|
3166
3166
|
if optiondict["refinedelay"]:
|
|
3167
|
-
TimingLGR.info("Setting up for delay refinement and
|
|
3168
|
-
LGR.info("\n\nDelay refinement and
|
|
3167
|
+
TimingLGR.info("Setting up for delay refinement and sLFO filtering")
|
|
3168
|
+
LGR.info("\n\nDelay refinement and sLFO filtering setup")
|
|
3169
3169
|
else:
|
|
3170
|
-
TimingLGR.info("Setting up for
|
|
3171
|
-
LGR.info("\n\
|
|
3170
|
+
TimingLGR.info("Setting up for sLFO filtering")
|
|
3171
|
+
LGR.info("\n\nsLFO filtering setup")
|
|
3172
3172
|
elif optiondict["docvrmap"]:
|
|
3173
3173
|
if optiondict["refinedelay"]:
|
|
3174
3174
|
TimingLGR.info("Setting up for delay refinement and CVR map generation")
|
|
@@ -3181,14 +3181,16 @@ def rapidtide_main(argparsingfunc):
|
|
|
3181
3181
|
LGR.info("\n\nDelay refinement setup")
|
|
3182
3182
|
if (
|
|
3183
3183
|
(optiondict["gausssigma"] > 0.0)
|
|
3184
|
-
or (optiondict["
|
|
3184
|
+
or (optiondict["denoisesourcefile"] is not None)
|
|
3185
3185
|
or optiondict["docvrmap"]
|
|
3186
3186
|
):
|
|
3187
|
-
if optiondict["
|
|
3188
|
-
LGR.info(
|
|
3189
|
-
|
|
3187
|
+
if optiondict["denoisesourcefile"] is not None:
|
|
3188
|
+
LGR.info(
|
|
3189
|
+
f"reading in {optiondict['denoisesourcefile']} for sLFO filter, please wait"
|
|
3190
|
+
)
|
|
3191
|
+
sourcename = optiondict["denoisesourcefile"]
|
|
3190
3192
|
else:
|
|
3191
|
-
LGR.info(f"rereading {fmrifilename} for
|
|
3193
|
+
LGR.info(f"rereading {fmrifilename} for sLFO filter, please wait")
|
|
3192
3194
|
sourcename = fmrifilename
|
|
3193
3195
|
if fileiscifti:
|
|
3194
3196
|
LGR.info("input file is CIFTI")
|
|
@@ -3235,28 +3237,30 @@ def rapidtide_main(argparsingfunc):
|
|
|
3235
3237
|
numpy2shared_func = addmemprofiling(
|
|
3236
3238
|
tide_util.numpy2shared,
|
|
3237
3239
|
optiondict["memprofile"],
|
|
3238
|
-
"before movetoshared (
|
|
3240
|
+
"before movetoshared (sLFO filter)",
|
|
3239
3241
|
)
|
|
3240
3242
|
fmri_data_valid, fmri_data_valid_shm = numpy2shared_func(
|
|
3241
|
-
fmri_data_valid,
|
|
3243
|
+
fmri_data_valid,
|
|
3244
|
+
rt_floatset,
|
|
3245
|
+
name=f"fmri_data_valid_regressionfilt_{optiondict['pid']}",
|
|
3242
3246
|
)
|
|
3243
3247
|
TimingLGR.info("End moving fmri_data to shared memory")
|
|
3244
3248
|
del nim_data
|
|
3245
3249
|
|
|
3246
|
-
# now allocate the arrays needed for
|
|
3250
|
+
# now allocate the arrays needed for sLFO filtering
|
|
3247
3251
|
if optiondict["refinedelay"]:
|
|
3248
3252
|
derivaxissize = np.max(
|
|
3249
|
-
[optiondict["
|
|
3253
|
+
[optiondict["refineregressderivs"] + 1, optiondict["regressderivs"] + 1]
|
|
3250
3254
|
)
|
|
3251
3255
|
else:
|
|
3252
|
-
derivaxissize = optiondict["
|
|
3256
|
+
derivaxissize = optiondict["regressderivs"] + 1
|
|
3253
3257
|
internalvalidspaceshapederivs = (
|
|
3254
3258
|
internalvalidspaceshape,
|
|
3255
3259
|
derivaxissize,
|
|
3256
3260
|
)
|
|
3257
3261
|
if optiondict["sharedmem"]:
|
|
3258
|
-
|
|
3259
|
-
internalvalidspaceshape, rt_outfloatset, name=f"
|
|
3262
|
+
sLFOfitmean, sLFOfitmean_shm = tide_util.allocshared(
|
|
3263
|
+
internalvalidspaceshape, rt_outfloatset, name=f"sLFOfitmean_{optiondict['pid']}"
|
|
3260
3264
|
)
|
|
3261
3265
|
rvalue, rvalue_shm = tide_util.allocshared(
|
|
3262
3266
|
internalvalidspaceshape, rt_outfloatset, name=f"rvalue_{optiondict['pid']}"
|
|
@@ -3281,7 +3285,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
3281
3285
|
)
|
|
3282
3286
|
ramlocation = "in shared memory"
|
|
3283
3287
|
else:
|
|
3284
|
-
|
|
3288
|
+
sLFOfitmean = np.zeros(internalvalidspaceshape, dtype=rt_outfloattype)
|
|
3285
3289
|
rvalue = np.zeros(internalvalidspaceshape, dtype=rt_outfloattype)
|
|
3286
3290
|
r2value = np.zeros(internalvalidspaceshape, dtype=rt_outfloattype)
|
|
3287
3291
|
fitNorm = np.zeros(internalvalidspaceshapederivs, dtype=rt_outfloattype)
|
|
@@ -3291,8 +3295,8 @@ def rapidtide_main(argparsingfunc):
|
|
|
3291
3295
|
filtereddata = np.zeros(internalvalidfmrishape, dtype=rt_outfloattype)
|
|
3292
3296
|
ramlocation = "locally"
|
|
3293
3297
|
|
|
3294
|
-
optiondict["
|
|
3295
|
-
|
|
3298
|
+
optiondict["totalsLFOfilterbytes"] = (
|
|
3299
|
+
sLFOfitmean.nbytes
|
|
3296
3300
|
+ rvalue.nbytes
|
|
3297
3301
|
+ r2value.nbytes
|
|
3298
3302
|
+ fitNorm.nbytes
|
|
@@ -3301,25 +3305,25 @@ def rapidtide_main(argparsingfunc):
|
|
|
3301
3305
|
+ lagtc.nbytes
|
|
3302
3306
|
+ filtereddata.nbytes
|
|
3303
3307
|
)
|
|
3304
|
-
thesize, theunit = tide_util.format_bytes(optiondict["
|
|
3305
|
-
print(f"allocated {thesize:.3f} {theunit} {ramlocation} for
|
|
3308
|
+
thesize, theunit = tide_util.format_bytes(optiondict["totalsLFOfilterbytes"])
|
|
3309
|
+
print(f"allocated {thesize:.3f} {theunit} {ramlocation} for sLFO filter/delay refinement")
|
|
3306
3310
|
|
|
3307
3311
|
if optiondict["memprofile"]:
|
|
3308
|
-
if optiondict["
|
|
3309
|
-
memcheckpoint("about to start
|
|
3312
|
+
if optiondict["dolinfitfilt"]:
|
|
3313
|
+
memcheckpoint("about to start sLFO noise removal...")
|
|
3310
3314
|
else:
|
|
3311
3315
|
memcheckpoint("about to start CVR magnitude estimation...")
|
|
3312
|
-
tide_util.logmem("before
|
|
3316
|
+
tide_util.logmem("before sLFO filter")
|
|
3313
3317
|
|
|
3314
|
-
if optiondict["
|
|
3318
|
+
if optiondict["dolinfitfilt"]:
|
|
3315
3319
|
mode = "glm"
|
|
3316
|
-
optiondict["
|
|
3320
|
+
optiondict["regressfiltthreshval"] = threshval
|
|
3317
3321
|
else:
|
|
3318
3322
|
# set the threshval to zero
|
|
3319
3323
|
mode = "cvrmap"
|
|
3320
|
-
optiondict["
|
|
3324
|
+
optiondict["regressfiltthreshval"] = 0.0
|
|
3321
3325
|
if optiondict["debug"]:
|
|
3322
|
-
# dump the fmri input file going to
|
|
3326
|
+
# dump the fmri input file going to sLFO filter
|
|
3323
3327
|
if not optiondict["textio"]:
|
|
3324
3328
|
theheader = copy.deepcopy(nim_hdr)
|
|
3325
3329
|
if fileiscifti:
|
|
@@ -3340,7 +3344,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
3340
3344
|
"datatofilter",
|
|
3341
3345
|
"bold",
|
|
3342
3346
|
None,
|
|
3343
|
-
"fMRI data that will be subjected to
|
|
3347
|
+
"fMRI data that will be subjected to sLFO filtering",
|
|
3344
3348
|
),
|
|
3345
3349
|
]
|
|
3346
3350
|
tide_io.savemaplist(
|
|
@@ -3356,7 +3360,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
3356
3360
|
cifti_hdr=cifti_hdr,
|
|
3357
3361
|
)
|
|
3358
3362
|
|
|
3359
|
-
# refine the delay value prior to calculating the
|
|
3363
|
+
# refine the delay value prior to calculating the sLFO filter
|
|
3360
3364
|
if optiondict["refinedelay"]:
|
|
3361
3365
|
TimingLGR.info("Delay refinement start")
|
|
3362
3366
|
LGR.info("\n\nDelay refinement")
|
|
@@ -3364,7 +3368,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
3364
3368
|
# set gausssigma automatically
|
|
3365
3369
|
optiondict["delayoffsetgausssigma"] = np.mean([xdim, ydim, slicethickness]) / 2.0
|
|
3366
3370
|
|
|
3367
|
-
|
|
3371
|
+
regressderivratios, regressrvalues = tide_refinedelay.getderivratios(
|
|
3368
3372
|
fmri_data_valid,
|
|
3369
3373
|
validvoxels,
|
|
3370
3374
|
initial_fmri_x,
|
|
@@ -3374,25 +3378,25 @@ def rapidtide_main(argparsingfunc):
|
|
|
3374
3378
|
mode,
|
|
3375
3379
|
outputname,
|
|
3376
3380
|
oversamptr,
|
|
3377
|
-
|
|
3381
|
+
sLFOfitmean,
|
|
3378
3382
|
rvalue,
|
|
3379
3383
|
r2value,
|
|
3380
|
-
fitNorm[:, : (optiondict["
|
|
3381
|
-
fitcoeff[:, : (optiondict["
|
|
3384
|
+
fitNorm[:, : (optiondict["refineregressderivs"] + 1)],
|
|
3385
|
+
fitcoeff[:, : (optiondict["refineregressderivs"] + 1)],
|
|
3382
3386
|
movingsignal,
|
|
3383
3387
|
lagtc,
|
|
3384
3388
|
filtereddata,
|
|
3385
3389
|
LGR,
|
|
3386
3390
|
TimingLGR,
|
|
3387
3391
|
optiondict,
|
|
3388
|
-
|
|
3392
|
+
regressderivs=optiondict["refineregressderivs"],
|
|
3389
3393
|
debug=optiondict["debug"],
|
|
3390
3394
|
)
|
|
3391
3395
|
|
|
3392
|
-
if optiondict["
|
|
3393
|
-
|
|
3396
|
+
if optiondict["refineregressderivs"] == 1:
|
|
3397
|
+
medfiltregressderivratios, filteredregressderivratios, delayoffsetMAD = (
|
|
3394
3398
|
tide_refinedelay.filterderivratios(
|
|
3395
|
-
|
|
3399
|
+
regressderivratios,
|
|
3396
3400
|
nativespaceshape,
|
|
3397
3401
|
validvoxels,
|
|
3398
3402
|
(xdim, ydim, slicethickness),
|
|
@@ -3406,7 +3410,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
3406
3410
|
)
|
|
3407
3411
|
optiondict["delayoffsetMAD"] = delayoffsetMAD
|
|
3408
3412
|
|
|
3409
|
-
# find the mapping of
|
|
3413
|
+
# find the mapping of derivative ratios to delays
|
|
3410
3414
|
tide_refinedelay.trainratiotooffset(
|
|
3411
3415
|
genlagtc,
|
|
3412
3416
|
initial_fmri_x,
|
|
@@ -3419,25 +3423,27 @@ def rapidtide_main(argparsingfunc):
|
|
|
3419
3423
|
)
|
|
3420
3424
|
|
|
3421
3425
|
# now calculate the delay offsets
|
|
3422
|
-
delayoffset = np.zeros_like(
|
|
3426
|
+
delayoffset = np.zeros_like(filteredregressderivratios)
|
|
3423
3427
|
if optiondict["debug"]:
|
|
3424
|
-
print(
|
|
3425
|
-
|
|
3426
|
-
|
|
3428
|
+
print(
|
|
3429
|
+
f"calculating delayoffsets for {filteredregressderivratios.shape[0]} voxels"
|
|
3430
|
+
)
|
|
3431
|
+
for i in range(filteredregressderivratios.shape[0]):
|
|
3432
|
+
delayoffset[i] = tide_refinedelay.ratiotodelay(filteredregressderivratios[i])
|
|
3427
3433
|
else:
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
delayoffsetMAD = np.zeros(optiondict["
|
|
3431
|
-
for i in range(
|
|
3434
|
+
medfiltregressderivratios = np.zeros_like(regressderivratios)
|
|
3435
|
+
filteredregressderivratios = np.zeros_like(regressderivratios)
|
|
3436
|
+
delayoffsetMAD = np.zeros(optiondict["refineregressderivs"], dtype=float)
|
|
3437
|
+
for i in range(optiondict["refineregressderivs"]):
|
|
3432
3438
|
(
|
|
3433
|
-
|
|
3434
|
-
|
|
3439
|
+
medfiltregressderivratios[i, :],
|
|
3440
|
+
filteredregressderivratios[i, :],
|
|
3435
3441
|
delayoffsetMAD[i],
|
|
3436
3442
|
) = tide_refinedelay.filterderivratios(
|
|
3437
|
-
|
|
3443
|
+
regressderivratios[i, :],
|
|
3438
3444
|
(xsize, ysize, numslices),
|
|
3439
3445
|
validvoxels,
|
|
3440
|
-
(xdim, ydim,
|
|
3446
|
+
(xdim, ydim, slicethickness),
|
|
3441
3447
|
gausssigma=optiondict["delayoffsetgausssigma"],
|
|
3442
3448
|
patchthresh=optiondict["delaypatchthresh"],
|
|
3443
3449
|
fileiscifti=False,
|
|
@@ -3448,24 +3454,26 @@ def rapidtide_main(argparsingfunc):
|
|
|
3448
3454
|
optiondict[f"delayoffsetMAD_{i + 1}"] = delayoffsetMAD[i]
|
|
3449
3455
|
|
|
3450
3456
|
# now calculate the delay offsets
|
|
3451
|
-
delayoffset = np.zeros_like(
|
|
3457
|
+
delayoffset = np.zeros_like(filteredregressderivratios[0, :])
|
|
3452
3458
|
if optiondict["debug"]:
|
|
3453
|
-
print(
|
|
3454
|
-
|
|
3459
|
+
print(
|
|
3460
|
+
f"calculating delayoffsets for {filteredregressderivratios.shape[1]} voxels"
|
|
3461
|
+
)
|
|
3462
|
+
for i in range(filteredregressderivratios.shape[1]):
|
|
3455
3463
|
delayoffset[i] = tide_refinedelay.coffstodelay(
|
|
3456
|
-
|
|
3464
|
+
filteredregressderivratios[:, i],
|
|
3457
3465
|
mindelay=optiondict["mindelay"],
|
|
3458
3466
|
maxdelay=optiondict["maxdelay"],
|
|
3459
3467
|
)
|
|
3460
3468
|
|
|
3461
3469
|
namesuffix = "_desc-delayoffset_hist"
|
|
3462
|
-
if optiondict["
|
|
3470
|
+
if optiondict["dolinfitfilt"]:
|
|
3463
3471
|
tide_stats.makeandsavehistogram(
|
|
3464
3472
|
delayoffset[np.where(fitmask > 0)],
|
|
3465
3473
|
optiondict["histlen"],
|
|
3466
3474
|
1,
|
|
3467
3475
|
outputname + namesuffix,
|
|
3468
|
-
displaytitle="Histogram of delay offsets calculated from
|
|
3476
|
+
displaytitle="Histogram of delay offsets calculated from regression coefficients",
|
|
3469
3477
|
dictvarname="delayoffsethist",
|
|
3470
3478
|
thedict=optiondict,
|
|
3471
3479
|
)
|
|
@@ -3475,11 +3483,11 @@ def rapidtide_main(argparsingfunc):
|
|
|
3475
3483
|
# Delay refinement end
|
|
3476
3484
|
####################################################
|
|
3477
3485
|
|
|
3478
|
-
# now calculate the
|
|
3479
|
-
if optiondict["
|
|
3480
|
-
if optiondict["
|
|
3481
|
-
TimingLGR.info("
|
|
3482
|
-
LGR.info("\n\
|
|
3486
|
+
# now calculate the sLFO filter or CVR map
|
|
3487
|
+
if optiondict["dolinfitfilt"] or optiondict["docvrmap"]:
|
|
3488
|
+
if optiondict["dolinfitfilt"]:
|
|
3489
|
+
TimingLGR.info("sLFO filtering start")
|
|
3490
|
+
LGR.info("\n\nsLFO filtering")
|
|
3483
3491
|
else:
|
|
3484
3492
|
TimingLGR.info("CVR map generation")
|
|
3485
3493
|
LGR.info("\n\nCVR mapping")
|
|
@@ -3488,46 +3496,48 @@ def rapidtide_main(argparsingfunc):
|
|
|
3488
3496
|
# initialrawvariance = tide_math.imagevariance(fmri_data_valid, None, 1.0 / fmritr)
|
|
3489
3497
|
initialvariance = tide_math.imagevariance(fmri_data_valid, theprefilter, 1.0 / fmritr)
|
|
3490
3498
|
|
|
3491
|
-
# now calculate the
|
|
3499
|
+
# now calculate the sLFO filter
|
|
3492
3500
|
if optiondict["refinedelay"] and optiondict["filterwithrefineddelay"]:
|
|
3493
3501
|
lagstouse = lagtimesrefined
|
|
3494
3502
|
else:
|
|
3495
3503
|
lagstouse = lagtimes
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3504
|
+
voxelsprocessed_regressionfilt, regressorset, evset = (
|
|
3505
|
+
tide_regressfrommaps.regressfrommaps(
|
|
3506
|
+
fmri_data_valid,
|
|
3507
|
+
validvoxels,
|
|
3508
|
+
initial_fmri_x,
|
|
3509
|
+
lagstouse,
|
|
3510
|
+
fitmask,
|
|
3511
|
+
genlagtc,
|
|
3512
|
+
mode,
|
|
3513
|
+
outputname,
|
|
3514
|
+
oversamptr,
|
|
3515
|
+
sLFOfitmean,
|
|
3516
|
+
rvalue,
|
|
3517
|
+
r2value,
|
|
3518
|
+
fitNorm[:, : optiondict["regressderivs"] + 1],
|
|
3519
|
+
fitcoeff[:, : optiondict["regressderivs"] + 1],
|
|
3520
|
+
movingsignal,
|
|
3521
|
+
lagtc,
|
|
3522
|
+
filtereddata,
|
|
3523
|
+
LGR,
|
|
3524
|
+
TimingLGR,
|
|
3525
|
+
optiondict["regressfiltthreshval"],
|
|
3526
|
+
optiondict["saveminimumsLFOfiltfiles"],
|
|
3527
|
+
nprocs_makelaggedtcs=optiondict["nprocs_makelaggedtcs"],
|
|
3528
|
+
nprocs_regressionfilt=optiondict["nprocs_regressionfilt"],
|
|
3529
|
+
regressderivs=optiondict["regressderivs"],
|
|
3530
|
+
mp_chunksize=optiondict["mp_chunksize"],
|
|
3531
|
+
showprogressbar=optiondict["showprogressbar"],
|
|
3532
|
+
alwaysmultiproc=optiondict["alwaysmultiproc"],
|
|
3533
|
+
memprofile=optiondict["memprofile"],
|
|
3534
|
+
debug=optiondict["debug"],
|
|
3535
|
+
)
|
|
3526
3536
|
)
|
|
3527
3537
|
|
|
3528
3538
|
evcolnames = ["base"]
|
|
3529
|
-
if optiondict["
|
|
3530
|
-
for i in range(1, optiondict["
|
|
3539
|
+
if optiondict["regressderivs"] > 0:
|
|
3540
|
+
for i in range(1, optiondict["regressderivs"] + 1):
|
|
3531
3541
|
evcolnames.append(f"deriv_{str(i)}")
|
|
3532
3542
|
|
|
3533
3543
|
tide_io.writebidstsv(
|
|
@@ -3535,7 +3545,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
3535
3545
|
np.transpose(evset),
|
|
3536
3546
|
1.0 / fmritr,
|
|
3537
3547
|
columns=evcolnames,
|
|
3538
|
-
extraheaderinfo={"Description": "
|
|
3548
|
+
extraheaderinfo={"Description": "sLFO filter regressor set"},
|
|
3539
3549
|
append=False,
|
|
3540
3550
|
)
|
|
3541
3551
|
|
|
@@ -3547,30 +3557,20 @@ def rapidtide_main(argparsingfunc):
|
|
|
3547
3557
|
varchange = initialvariance * 0.0
|
|
3548
3558
|
varchange[divlocs] = 100.0 * (finalvariance[divlocs] / initialvariance[divlocs] - 1.0)
|
|
3549
3559
|
|
|
3550
|
-
"""divlocs = np.where(finalrawvariance > 0.0)
|
|
3551
|
-
rawvarchange = initialrawvariance * 0.0
|
|
3552
|
-
rawvarchange[divlocs] = 100.0 * (
|
|
3553
|
-
finalrawvariance[divlocs] / initialvariance[divlocs] - 1.0
|
|
3554
|
-
)"""
|
|
3555
|
-
|
|
3556
|
-
del fmri_data_valid
|
|
3557
|
-
if optiondict["sharedmem"]:
|
|
3558
|
-
tide_util.cleanup_shm(fmri_data_valid_shm)
|
|
3559
|
-
|
|
3560
3560
|
LGR.info("End filtering operation")
|
|
3561
3561
|
TimingLGR.info(
|
|
3562
|
-
"
|
|
3562
|
+
"sLFO filtering end",
|
|
3563
3563
|
{
|
|
3564
|
-
"message2":
|
|
3564
|
+
"message2": voxelsprocessed_regressionfilt,
|
|
3565
3565
|
"message3": "voxels",
|
|
3566
3566
|
},
|
|
3567
3567
|
)
|
|
3568
3568
|
if optiondict["memprofile"]:
|
|
3569
3569
|
memcheckpoint("...done")
|
|
3570
|
-
tide_util.logmem("after
|
|
3570
|
+
tide_util.logmem("after sLFO filter")
|
|
3571
3571
|
LGR.info("")
|
|
3572
3572
|
####################################################
|
|
3573
|
-
#
|
|
3573
|
+
# sLFO filtering end
|
|
3574
3574
|
####################################################
|
|
3575
3575
|
|
|
3576
3576
|
# Post refinement step 2 - make and save interesting histograms
|
|
@@ -3608,24 +3608,24 @@ def rapidtide_main(argparsingfunc):
|
|
|
3608
3608
|
thedict=optiondict,
|
|
3609
3609
|
)
|
|
3610
3610
|
namesuffix = "_desc-lfofilterR2_hist"
|
|
3611
|
-
if optiondict["
|
|
3611
|
+
if optiondict["dolinfitfilt"]:
|
|
3612
3612
|
tide_stats.makeandsavehistogram(
|
|
3613
3613
|
r2value[np.where(fitmask > 0)],
|
|
3614
3614
|
optiondict["histlen"],
|
|
3615
3615
|
1,
|
|
3616
3616
|
outputname + namesuffix,
|
|
3617
|
-
displaytitle="Histogram of
|
|
3617
|
+
displaytitle="Histogram of sLFO filter R2 values",
|
|
3618
3618
|
dictvarname="R2hist",
|
|
3619
3619
|
thedict=optiondict,
|
|
3620
3620
|
)
|
|
3621
3621
|
namesuffix = "_desc-lfofilterInbandVarianceChange_hist"
|
|
3622
|
-
if optiondict["
|
|
3622
|
+
if optiondict["dolinfitfilt"]:
|
|
3623
3623
|
tide_stats.makeandsavehistogram(
|
|
3624
3624
|
varchange[np.where(fitmask > 0)],
|
|
3625
3625
|
optiondict["histlen"],
|
|
3626
3626
|
1,
|
|
3627
3627
|
outputname + namesuffix,
|
|
3628
|
-
displaytitle="Histogram of percent of inband variance removed by
|
|
3628
|
+
displaytitle="Histogram of percent of inband variance removed by sLFO filter",
|
|
3629
3629
|
dictvarname="varchangehist",
|
|
3630
3630
|
thedict=optiondict,
|
|
3631
3631
|
)
|
|
@@ -3714,56 +3714,55 @@ def rapidtide_main(argparsingfunc):
|
|
|
3714
3714
|
"second",
|
|
3715
3715
|
"Lag time in seconds, refined",
|
|
3716
3716
|
),
|
|
3717
|
-
(np.fabs(rvalue), "maxcorralt", "map", None, "R value of the GLM fit, with sign"),
|
|
3718
3717
|
]
|
|
3719
3718
|
if (optiondict["outputlevel"] != "min") and (optiondict["outputlevel"] != "less"):
|
|
3720
|
-
if optiondict["
|
|
3721
|
-
for i in range(optiondict["
|
|
3719
|
+
if optiondict["refineregressderivs"] > 1:
|
|
3720
|
+
for i in range(optiondict["refineregressderivs"]):
|
|
3722
3721
|
savelist += [
|
|
3723
3722
|
(
|
|
3724
|
-
|
|
3725
|
-
f"
|
|
3723
|
+
regressderivratios[i, :],
|
|
3724
|
+
f"regressderivratios_{i}",
|
|
3726
3725
|
"map",
|
|
3727
3726
|
None,
|
|
3728
3727
|
f"Ratio of derivative {i + 1} of delayed sLFO to the delayed sLFO",
|
|
3729
3728
|
),
|
|
3730
3729
|
(
|
|
3731
|
-
|
|
3732
|
-
f"
|
|
3730
|
+
medfiltregressderivratios[i, :],
|
|
3731
|
+
f"medfiltregressderivratios_{i}",
|
|
3733
3732
|
"map",
|
|
3734
3733
|
None,
|
|
3735
|
-
f"Median filtered version of the
|
|
3734
|
+
f"Median filtered version of the regressderivratios_{i} map",
|
|
3736
3735
|
),
|
|
3737
3736
|
(
|
|
3738
|
-
|
|
3739
|
-
f"
|
|
3737
|
+
filteredregressderivratios[i, :],
|
|
3738
|
+
f"filteredregressderivratios_{i}",
|
|
3740
3739
|
"map",
|
|
3741
3740
|
None,
|
|
3742
|
-
f"
|
|
3741
|
+
f"regressderivratios_{i}, with outliers patched using median filtered data",
|
|
3743
3742
|
),
|
|
3744
3743
|
]
|
|
3745
3744
|
else:
|
|
3746
3745
|
savelist += [
|
|
3747
3746
|
(
|
|
3748
|
-
|
|
3749
|
-
"
|
|
3747
|
+
regressderivratios,
|
|
3748
|
+
"regressderivratios",
|
|
3750
3749
|
"map",
|
|
3751
3750
|
None,
|
|
3752
3751
|
"Ratio of the first derivative of delayed sLFO to the delayed sLFO",
|
|
3753
3752
|
),
|
|
3754
3753
|
(
|
|
3755
|
-
|
|
3756
|
-
"
|
|
3754
|
+
medfiltregressderivratios,
|
|
3755
|
+
"medfiltregressderivratios",
|
|
3757
3756
|
"map",
|
|
3758
3757
|
None,
|
|
3759
|
-
"Median filtered version of the
|
|
3758
|
+
"Median filtered version of the regressderivratios map",
|
|
3760
3759
|
),
|
|
3761
3760
|
(
|
|
3762
|
-
|
|
3763
|
-
"
|
|
3761
|
+
filteredregressderivratios,
|
|
3762
|
+
"filteredregressderivratios",
|
|
3764
3763
|
"map",
|
|
3765
3764
|
None,
|
|
3766
|
-
"
|
|
3765
|
+
"regressderivratios, with outliers patched using median filtered data",
|
|
3767
3766
|
),
|
|
3768
3767
|
]
|
|
3769
3768
|
if optiondict["calccoherence"]:
|
|
@@ -3803,8 +3802,8 @@ def rapidtide_main(argparsingfunc):
|
|
|
3803
3802
|
tide_util.cleanup_shm(coherencepeakfreq_shm)
|
|
3804
3803
|
|
|
3805
3804
|
# write the optional 3D maps that need to be remapped
|
|
3806
|
-
if optiondict["
|
|
3807
|
-
if optiondict["
|
|
3805
|
+
if optiondict["dolinfitfilt"] or optiondict["docvrmap"]:
|
|
3806
|
+
if optiondict["dolinfitfilt"]:
|
|
3808
3807
|
maplist = [
|
|
3809
3808
|
(
|
|
3810
3809
|
initialvariance,
|
|
@@ -3828,22 +3827,22 @@ def rapidtide_main(argparsingfunc):
|
|
|
3828
3827
|
"Change in inband variance after filtering, in percent",
|
|
3829
3828
|
),
|
|
3830
3829
|
]
|
|
3831
|
-
if optiondict["
|
|
3830
|
+
if optiondict["saveminimumsLFOfiltfiles"]:
|
|
3832
3831
|
maplist += [
|
|
3833
3832
|
(
|
|
3834
3833
|
r2value,
|
|
3835
3834
|
"lfofilterR2",
|
|
3836
3835
|
"map",
|
|
3837
3836
|
None,
|
|
3838
|
-
"Squared R value of the
|
|
3837
|
+
"Squared R value of the sLFO fit (proportion of variance explained)",
|
|
3839
3838
|
),
|
|
3840
3839
|
]
|
|
3841
|
-
if optiondict["
|
|
3840
|
+
if optiondict["savenormalsLFOfiltfiles"]:
|
|
3842
3841
|
maplist += [
|
|
3843
|
-
(
|
|
3844
|
-
(
|
|
3842
|
+
(rvalue, "lfofilterR", "map", None, "R value of the sLFO fit"),
|
|
3843
|
+
(sLFOfitmean, "lfofilterMean", "map", None, "Intercept from sLFO fit"),
|
|
3845
3844
|
]
|
|
3846
|
-
if optiondict["
|
|
3845
|
+
if optiondict["regressderivs"] > 0:
|
|
3847
3846
|
maplist += [
|
|
3848
3847
|
(fitcoeff[:, 0], "lfofilterCoeff", "map", None, "Fit coefficient"),
|
|
3849
3848
|
(
|
|
@@ -3854,7 +3853,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
3854
3853
|
"Normalized fit coefficient",
|
|
3855
3854
|
),
|
|
3856
3855
|
]
|
|
3857
|
-
for thederiv in range(1, optiondict["
|
|
3856
|
+
for thederiv in range(1, optiondict["regressderivs"] + 1):
|
|
3858
3857
|
maplist += [
|
|
3859
3858
|
(
|
|
3860
3859
|
fitcoeff[:, thederiv],
|
|
@@ -3874,14 +3873,14 @@ def rapidtide_main(argparsingfunc):
|
|
|
3874
3873
|
else:
|
|
3875
3874
|
maplist += [
|
|
3876
3875
|
(
|
|
3877
|
-
fitcoeff[:, : optiondict["
|
|
3876
|
+
fitcoeff[:, : optiondict["regressderivs"] + 1],
|
|
3878
3877
|
"lfofilterCoeff",
|
|
3879
3878
|
"map",
|
|
3880
3879
|
None,
|
|
3881
3880
|
"Fit coefficient",
|
|
3882
3881
|
),
|
|
3883
3882
|
(
|
|
3884
|
-
fitNorm[:, : optiondict["
|
|
3883
|
+
fitNorm[:, : optiondict["regressderivs"] + 1],
|
|
3885
3884
|
"lfofilterNorm",
|
|
3886
3885
|
"map",
|
|
3887
3886
|
None,
|
|
@@ -3912,15 +3911,15 @@ def rapidtide_main(argparsingfunc):
|
|
|
3912
3911
|
"Percentage of inband variance attributable to CVR regressor",
|
|
3913
3912
|
),
|
|
3914
3913
|
]
|
|
3915
|
-
if optiondict["
|
|
3914
|
+
if optiondict["savenormalsLFOfiltfiles"]:
|
|
3916
3915
|
maplist = [
|
|
3917
|
-
(rvalue, "CVRR", "map", None, "R value of the
|
|
3916
|
+
(rvalue, "CVRR", "map", None, "R value of the sLFO fit"),
|
|
3918
3917
|
(
|
|
3919
3918
|
r2value,
|
|
3920
3919
|
"CVRR2",
|
|
3921
3920
|
"map",
|
|
3922
3921
|
None,
|
|
3923
|
-
"Squared R value of the
|
|
3922
|
+
"Squared R value of the sLFO fit (proportion of variance explained)",
|
|
3924
3923
|
),
|
|
3925
3924
|
(
|
|
3926
3925
|
fitcoeff,
|
|
@@ -3943,7 +3942,70 @@ def rapidtide_main(argparsingfunc):
|
|
|
3943
3942
|
rt_floattype=rt_floattype,
|
|
3944
3943
|
cifti_hdr=cifti_hdr,
|
|
3945
3944
|
)
|
|
3946
|
-
|
|
3945
|
+
|
|
3946
|
+
if optiondict["refinedelay"] and False:
|
|
3947
|
+
# filter the fmri data to the lfo band
|
|
3948
|
+
print("filtering fmri_data to sLFO band")
|
|
3949
|
+
for i in range(fmri_data_valid.shape[0]):
|
|
3950
|
+
fmri_data_valid[i, :] = theprefilter.apply(
|
|
3951
|
+
optiondict["fmrifreq"], fmri_data_valid[i, :]
|
|
3952
|
+
)
|
|
3953
|
+
|
|
3954
|
+
print("rerunning sLFO fit to get filtered R value")
|
|
3955
|
+
dummy, dummy, dummy = tide_regressfrommaps.regressfrommaps(
|
|
3956
|
+
fmri_data_valid,
|
|
3957
|
+
validvoxels,
|
|
3958
|
+
initial_fmri_x,
|
|
3959
|
+
lagstouse,
|
|
3960
|
+
fitmask,
|
|
3961
|
+
genlagtc,
|
|
3962
|
+
mode,
|
|
3963
|
+
outputname,
|
|
3964
|
+
oversamptr,
|
|
3965
|
+
sLFOfitmean,
|
|
3966
|
+
rvalue,
|
|
3967
|
+
r2value,
|
|
3968
|
+
fitNorm[:, : optiondict["regressderivs"] + 1],
|
|
3969
|
+
fitcoeff[:, : optiondict["regressderivs"] + 1],
|
|
3970
|
+
movingsignal,
|
|
3971
|
+
lagtc,
|
|
3972
|
+
filtereddata,
|
|
3973
|
+
LGR,
|
|
3974
|
+
TimingLGR,
|
|
3975
|
+
optiondict["regressfiltthreshval"],
|
|
3976
|
+
optiondict["saveminimumsLFOfiltfiles"],
|
|
3977
|
+
nprocs_makelaggedtcs=optiondict["nprocs_makelaggedtcs"],
|
|
3978
|
+
nprocs_regressionfilt=optiondict["nprocs_regressionfilt"],
|
|
3979
|
+
regressderivs=optiondict["regressderivs"],
|
|
3980
|
+
mp_chunksize=optiondict["mp_chunksize"],
|
|
3981
|
+
showprogressbar=optiondict["showprogressbar"],
|
|
3982
|
+
alwaysmultiproc=optiondict["alwaysmultiproc"],
|
|
3983
|
+
memprofile=optiondict["memprofile"],
|
|
3984
|
+
debug=optiondict["debug"],
|
|
3985
|
+
)
|
|
3986
|
+
|
|
3987
|
+
maplist = [
|
|
3988
|
+
(rvalue, "maxcorralt", "map", None, "R value of the inband sLFO fit, with sign"),
|
|
3989
|
+
]
|
|
3990
|
+
|
|
3991
|
+
tide_io.savemaplist(
|
|
3992
|
+
outputname,
|
|
3993
|
+
maplist,
|
|
3994
|
+
validvoxels,
|
|
3995
|
+
nativespaceshape,
|
|
3996
|
+
theheader,
|
|
3997
|
+
bidsbasedict,
|
|
3998
|
+
textio=optiondict["textio"],
|
|
3999
|
+
fileiscifti=fileiscifti,
|
|
4000
|
+
rt_floattype=rt_floattype,
|
|
4001
|
+
cifti_hdr=cifti_hdr,
|
|
4002
|
+
)
|
|
4003
|
+
|
|
4004
|
+
del fmri_data_valid
|
|
4005
|
+
if optiondict["sharedmem"]:
|
|
4006
|
+
tide_util.cleanup_shm(fmri_data_valid_shm)
|
|
4007
|
+
|
|
4008
|
+
del sLFOfitmean
|
|
3947
4009
|
del rvalue
|
|
3948
4010
|
del r2value
|
|
3949
4011
|
del fitcoeff
|
|
@@ -3952,7 +4014,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
3952
4014
|
del finalvariance
|
|
3953
4015
|
del varchange
|
|
3954
4016
|
if optiondict["sharedmem"]:
|
|
3955
|
-
tide_util.cleanup_shm(
|
|
4017
|
+
tide_util.cleanup_shm(sLFOfitmean_shm)
|
|
3956
4018
|
tide_util.cleanup_shm(rvalue_shm)
|
|
3957
4019
|
tide_util.cleanup_shm(r2value_shm)
|
|
3958
4020
|
tide_util.cleanup_shm(fitcoeff_shm)
|
|
@@ -4133,8 +4195,10 @@ def rapidtide_main(argparsingfunc):
|
|
|
4133
4195
|
cifti_hdr = None
|
|
4134
4196
|
|
|
4135
4197
|
maplist = []
|
|
4136
|
-
if optiondict["
|
|
4137
|
-
|
|
4198
|
+
if optiondict["saveallsLFOfiltfiles"] and (
|
|
4199
|
+
optiondict["dolinfitfilt"] or optiondict["docvrmap"]
|
|
4200
|
+
):
|
|
4201
|
+
if optiondict["regressderivs"] > 0:
|
|
4138
4202
|
maplist += [
|
|
4139
4203
|
(
|
|
4140
4204
|
regressorset[:, :, 0],
|
|
@@ -4144,7 +4208,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
4144
4208
|
"Shifted sLFO regressor to filter",
|
|
4145
4209
|
),
|
|
4146
4210
|
]
|
|
4147
|
-
for thederiv in range(1, optiondict["
|
|
4211
|
+
for thederiv in range(1, optiondict["regressderivs"] + 1):
|
|
4148
4212
|
maplist += [
|
|
4149
4213
|
(
|
|
4150
4214
|
regressorset[:, :, thederiv],
|
|
@@ -4159,7 +4223,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
4159
4223
|
(regressorset, "lfofilterEV", "bold", None, "Shifted sLFO regressor to filter"),
|
|
4160
4224
|
]
|
|
4161
4225
|
|
|
4162
|
-
if optiondict["passes"] > 1:
|
|
4226
|
+
if (optiondict["passes"] > 1) or optiondict["dofinalrefine"]:
|
|
4163
4227
|
if optiondict["savelagregressors"]:
|
|
4164
4228
|
maplist += [
|
|
4165
4229
|
(
|
|
@@ -4171,8 +4235,8 @@ def rapidtide_main(argparsingfunc):
|
|
|
4171
4235
|
),
|
|
4172
4236
|
]
|
|
4173
4237
|
|
|
4174
|
-
if optiondict["
|
|
4175
|
-
if optiondict["
|
|
4238
|
+
if optiondict["dolinfitfilt"]:
|
|
4239
|
+
if optiondict["saveminimumsLFOfiltfiles"]:
|
|
4176
4240
|
maplist += [
|
|
4177
4241
|
(
|
|
4178
4242
|
filtereddata,
|
|
@@ -4232,7 +4296,7 @@ def rapidtide_main(argparsingfunc):
|
|
|
4232
4296
|
# clean up
|
|
4233
4297
|
if optiondict["passes"] > 1:
|
|
4234
4298
|
theRegressorRefiner.cleanup()
|
|
4235
|
-
if optiondict["
|
|
4299
|
+
if optiondict["dolinfitfilt"]:
|
|
4236
4300
|
del lagtc
|
|
4237
4301
|
del filtereddata
|
|
4238
4302
|
del movingsignal
|