rapidtide 3.0a13__py3-none-any.whl → 3.0a15__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rapidtide/Colortables.py +1 -1
- rapidtide/DerivativeDelay.py +4 -2
- rapidtide/OrthoImageItem.py +1 -1
- rapidtide/RapidtideDataset.py +3 -1
- rapidtide/RegressorRefiner.py +1 -1
- rapidtide/calcandfitcorrpairs.py +1 -1
- rapidtide/calccoherence.py +1 -1
- rapidtide/calcnullsimfunc.py +1 -1
- rapidtide/calcsimfunc.py +1 -1
- rapidtide/correlate.py +1 -1
- rapidtide/data/examples/src/test_findmaxlag.py +1 -1
- rapidtide/data/examples/src/testdelayvar +2 -1
- rapidtide/data/examples/src/testfmri +3 -2
- rapidtide/data/examples/src/testfuncs +1 -1
- rapidtide/data/examples/src/testhappy +12 -1
- rapidtide/data/examples/src/testmodels +33 -0
- rapidtide/data/models/model_cnn_w064_l13_fn20_fl08/loss.png +0 -0
- rapidtide/data/models/model_cnn_w064_l13_fn20_fl08/loss.txt +1 -0
- rapidtide/data/models/model_cnn_w064_l13_fn20_fl08/model.keras +0 -0
- rapidtide/data/models/model_cnn_w064_l13_fn20_fl08/model_meta.json +167 -0
- rapidtide/data/models/model_revised_tf2/model.keras +0 -0
- rapidtide/data/models/{model_serdar → model_revised_tf2}/model_meta.json +1 -1
- rapidtide/data/models/model_serdar2_tf2/model.keras +0 -0
- rapidtide/data/models/{model_serdar2 → model_serdar2_tf2}/model_meta.json +1 -1
- rapidtide/data/models/model_serdar_tf2/model.keras +0 -0
- rapidtide/data/models/{model_revised → model_serdar_tf2}/model_meta.json +1 -1
- rapidtide/dlfilter.py +325 -241
- rapidtide/externaltools.py +1 -1
- rapidtide/fMRIData_class.py +1 -1
- rapidtide/filter.py +1 -8
- rapidtide/fit.py +1 -8
- rapidtide/happy_supportfuncs.py +30 -1
- rapidtide/helper_classes.py +1 -1
- rapidtide/io.py +1 -1
- rapidtide/linfitfiltpass.py +3 -1
- rapidtide/makelaggedtcs.py +9 -6
- rapidtide/maskutil.py +1 -1
- rapidtide/miscmath.py +1 -8
- rapidtide/multiproc.py +9 -12
- rapidtide/patchmatch.py +1 -1
- rapidtide/peakeval.py +1 -1
- rapidtide/qualitycheck.py +1 -1
- rapidtide/refinedelay.py +174 -89
- rapidtide/refineregressor.py +1 -1
- rapidtide/resample.py +1 -1
- rapidtide/scripts/adjustoffset.py +1 -1
- rapidtide/scripts/aligntcs.py +1 -1
- rapidtide/scripts/applydlfilter.py +1 -1
- rapidtide/scripts/atlasaverage.py +1 -1
- rapidtide/scripts/atlastool.py +1 -1
- rapidtide/scripts/calcicc.py +1 -1
- rapidtide/scripts/calctexticc.py +1 -1
- rapidtide/scripts/calcttest.py +1 -1
- rapidtide/scripts/ccorrica.py +1 -1
- rapidtide/scripts/delayvar.py +2 -2
- rapidtide/scripts/diffrois.py +1 -1
- rapidtide/scripts/endtidalproc.py +1 -1
- rapidtide/scripts/fdica.py +1 -1
- rapidtide/scripts/filtnifti.py +1 -1
- rapidtide/scripts/filttc.py +1 -1
- rapidtide/scripts/fingerprint.py +1 -1
- rapidtide/scripts/fixtr.py +1 -1
- rapidtide/scripts/gmscalc.py +1 -1
- rapidtide/scripts/happy.py +1 -1
- rapidtide/scripts/happy2std.py +1 -1
- rapidtide/scripts/happywarp.py +1 -1
- rapidtide/scripts/histnifti.py +1 -1
- rapidtide/scripts/histtc.py +1 -1
- rapidtide/scripts/linfitfilt.py +1 -1
- rapidtide/scripts/localflow.py +1 -1
- rapidtide/scripts/mergequality.py +1 -1
- rapidtide/scripts/pairproc.py +1 -1
- rapidtide/scripts/pairwisemergenifti.py +1 -1
- rapidtide/scripts/physiofreq.py +1 -1
- rapidtide/scripts/pixelcomp.py +1 -1
- rapidtide/scripts/plethquality.py +1 -1
- rapidtide/scripts/polyfitim.py +1 -1
- rapidtide/scripts/proj2flow.py +1 -1
- rapidtide/scripts/rankimage.py +1 -1
- rapidtide/scripts/rapidtide.py +1 -1
- rapidtide/scripts/rapidtide2std.py +1 -1
- rapidtide/scripts/resamplenifti.py +1 -1
- rapidtide/scripts/resampletc.py +1 -1
- rapidtide/scripts/retrolagtcs.py +1 -1
- rapidtide/scripts/retroregress.py +1 -1
- rapidtide/scripts/roisummarize.py +1 -1
- rapidtide/scripts/runqualitycheck.py +1 -1
- rapidtide/scripts/showarbcorr.py +1 -1
- rapidtide/scripts/showhist.py +1 -1
- rapidtide/scripts/showstxcorr.py +1 -1
- rapidtide/scripts/showtc.py +1 -1
- rapidtide/scripts/showxcorr_legacy.py +1 -1
- rapidtide/scripts/showxcorrx.py +1 -1
- rapidtide/scripts/showxy.py +1 -1
- rapidtide/scripts/simdata.py +1 -1
- rapidtide/scripts/spatialdecomp.py +1 -1
- rapidtide/scripts/spatialfit.py +1 -1
- rapidtide/scripts/spatialmi.py +1 -1
- rapidtide/scripts/spectrogram.py +1 -1
- rapidtide/scripts/stupidramtricks.py +1 -1
- rapidtide/scripts/synthASL.py +1 -1
- rapidtide/scripts/tcfrom2col.py +1 -1
- rapidtide/scripts/tcfrom3col.py +1 -1
- rapidtide/scripts/temporaldecomp.py +1 -1
- rapidtide/scripts/testhrv.py +1 -1
- rapidtide/scripts/threeD.py +1 -1
- rapidtide/scripts/tidepool.py +1 -1
- rapidtide/scripts/variabilityizer.py +1 -1
- rapidtide/simfuncfit.py +1 -1
- rapidtide/stats.py +1 -8
- rapidtide/tests/cleanposttest +1 -1
- rapidtide/tests/resethappytargets +1 -1
- rapidtide/tests/resetrapidtidetargets +1 -1
- rapidtide/tests/resettargets +1 -1
- rapidtide/tests/runlocaltest +1 -1
- rapidtide/tests/showkernels +1 -1
- rapidtide/tests/test_aliasedcorrelate.py +1 -1
- rapidtide/tests/test_aligntcs.py +1 -1
- rapidtide/tests/test_calcicc.py +1 -1
- rapidtide/tests/test_congrid.py +1 -1
- rapidtide/tests/test_correlate.py +1 -1
- rapidtide/tests/test_corrpass.py +1 -1
- rapidtide/tests/test_delayestimation.py +1 -1
- rapidtide/tests/test_doresample.py +1 -1
- rapidtide/tests/test_fastresampler.py +1 -1
- rapidtide/tests/test_findmaxlag.py +1 -1
- rapidtide/tests/test_fullrunhappy_v1.py +15 -7
- rapidtide/tests/test_fullrunhappy_v2.py +18 -10
- rapidtide/tests/test_fullrunhappy_v3.py +18 -10
- rapidtide/tests/test_fullrunhappy_v4.py +18 -10
- rapidtide/tests/test_fullrunhappy_v5.py +15 -9
- rapidtide/tests/test_fullrunrapidtide_v1.py +19 -11
- rapidtide/tests/test_fullrunrapidtide_v2.py +24 -14
- rapidtide/tests/test_fullrunrapidtide_v3.py +15 -7
- rapidtide/tests/test_fullrunrapidtide_v4.py +15 -8
- rapidtide/tests/test_fullrunrapidtide_v5.py +13 -5
- rapidtide/tests/test_fullrunrapidtide_v6.py +24 -16
- rapidtide/tests/test_io.py +1 -1
- rapidtide/tests/test_linfitfiltpass.py +1 -1
- rapidtide/tests/test_mi.py +1 -1
- rapidtide/tests/test_miscmath.py +1 -1
- rapidtide/tests/test_motionregress.py +1 -1
- rapidtide/tests/test_nullcorr.py +1 -1
- rapidtide/tests/test_padvec.py +1 -1
- rapidtide/tests/test_phaseanalysis.py +1 -1
- rapidtide/tests/test_rapidtideparser.py +1 -1
- rapidtide/tests/test_refinedelay.py +4 -3
- rapidtide/tests/test_runmisc.py +1 -1
- rapidtide/tests/test_sharedmem.py +1 -1
- rapidtide/tests/test_simulate.py +1 -1
- rapidtide/tests/test_stcorrelate.py +1 -1
- rapidtide/tests/test_timeshift.py +1 -1
- rapidtide/tests/test_valtoindex.py +1 -1
- rapidtide/tests/test_zRapidtideDataset.py +1 -1
- rapidtide/tests/utils.py +1 -1
- rapidtide/transformerdlfilter.py +2 -4
- rapidtide/util.py +37 -14
- rapidtide/voxelData.py +278 -0
- rapidtide/wiener.py +1 -1
- rapidtide/wiener2.py +1 -1
- rapidtide/workflows/adjustoffset.py +1 -1
- rapidtide/workflows/aligntcs.py +1 -1
- rapidtide/workflows/applydlfilter.py +20 -65
- rapidtide/workflows/atlasaverage.py +41 -13
- rapidtide/workflows/atlastool.py +1 -1
- rapidtide/workflows/calctexticc.py +1 -1
- rapidtide/workflows/ccorrica.py +1 -1
- rapidtide/workflows/cleanregressor.py +243 -0
- rapidtide/workflows/delayestimation.py +488 -0
- rapidtide/workflows/delayvar.py +122 -34
- rapidtide/workflows/diffrois.py +1 -1
- rapidtide/workflows/endtidalproc.py +1 -1
- rapidtide/workflows/fdica.py +1 -1
- rapidtide/workflows/filtnifti.py +1 -1
- rapidtide/workflows/filttc.py +1 -1
- rapidtide/workflows/fixtr.py +1 -1
- rapidtide/workflows/gmscalc.py +1 -1
- rapidtide/workflows/happy.py +49 -3
- rapidtide/workflows/happy2std.py +1 -1
- rapidtide/workflows/happy_parser.py +30 -6
- rapidtide/workflows/histnifti.py +1 -1
- rapidtide/workflows/histtc.py +1 -1
- rapidtide/workflows/linfitfilt.py +1 -1
- rapidtide/workflows/localflow.py +1 -1
- rapidtide/workflows/mergequality.py +1 -1
- rapidtide/workflows/niftidecomp.py +1 -1
- rapidtide/workflows/niftistats.py +1 -1
- rapidtide/workflows/pairproc.py +1 -1
- rapidtide/workflows/pairwisemergenifti.py +1 -1
- rapidtide/workflows/parser_funcs.py +1 -1
- rapidtide/workflows/physiofreq.py +1 -1
- rapidtide/workflows/pixelcomp.py +1 -1
- rapidtide/workflows/plethquality.py +1 -1
- rapidtide/workflows/polyfitim.py +1 -1
- rapidtide/workflows/proj2flow.py +1 -1
- rapidtide/workflows/rankimage.py +1 -1
- rapidtide/workflows/rapidtide.py +174 -686
- rapidtide/workflows/rapidtide2std.py +1 -1
- rapidtide/workflows/rapidtide_parser.py +14 -113
- rapidtide/workflows/regressfrommaps.py +6 -48
- rapidtide/workflows/resamplenifti.py +1 -1
- rapidtide/workflows/resampletc.py +1 -1
- rapidtide/workflows/retrolagtcs.py +2 -1
- rapidtide/workflows/retroregress.py +26 -2
- rapidtide/workflows/roisummarize.py +1 -1
- rapidtide/workflows/runqualitycheck.py +1 -1
- rapidtide/workflows/showarbcorr.py +1 -1
- rapidtide/workflows/showhist.py +1 -1
- rapidtide/workflows/showstxcorr.py +1 -1
- rapidtide/workflows/showtc.py +1 -1
- rapidtide/workflows/showxcorrx.py +1 -1
- rapidtide/workflows/showxy.py +1 -1
- rapidtide/workflows/simdata.py +1 -1
- rapidtide/workflows/spatialfit.py +1 -1
- rapidtide/workflows/spatialmi.py +1 -1
- rapidtide/workflows/spectrogram.py +1 -1
- rapidtide/workflows/synthASL.py +1 -1
- rapidtide/workflows/tcfrom2col.py +1 -1
- rapidtide/workflows/tcfrom3col.py +1 -1
- rapidtide/workflows/tidepool.py +2 -1
- rapidtide/workflows/utils.py +1 -1
- rapidtide/workflows/variabilityizer.py +1 -1
- {rapidtide-3.0a13.dist-info → rapidtide-3.0a15.dist-info}/METADATA +1 -1
- rapidtide-3.0a15.dist-info/RECORD +353 -0
- {rapidtide-3.0a13.dist-info → rapidtide-3.0a15.dist-info}/WHEEL +1 -1
- rapidtide/data/models/model_revised/model.h5 +0 -0
- rapidtide/data/models/model_serdar/model.h5 +0 -0
- rapidtide/data/models/model_serdar2/model.h5 +0 -0
- rapidtide-3.0a13.dist-info/RECORD +0 -345
- {rapidtide-3.0a13.dist-info → rapidtide-3.0a15.dist-info}/entry_points.txt +0 -0
- {rapidtide-3.0a13.dist-info → rapidtide-3.0a15.dist-info}/licenses/LICENSE +0 -0
- {rapidtide-3.0a13.dist-info → rapidtide-3.0a15.dist-info}/top_level.txt +0 -0
rapidtide/workflows/delayvar.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
|
-
# Copyright
|
|
4
|
+
# Copyright 2025 Blaise Frederick
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
|
@@ -27,6 +27,7 @@ from pathlib import Path
|
|
|
27
27
|
import numpy as np
|
|
28
28
|
from scipy.stats import pearsonr
|
|
29
29
|
from sklearn.decomposition import PCA
|
|
30
|
+
from tf_keras.src.dtensor.integration_test_utils import train_step
|
|
30
31
|
|
|
31
32
|
import rapidtide.filter as tide_filt
|
|
32
33
|
import rapidtide.io as tide_io
|
|
@@ -61,7 +62,8 @@ DEFAULT_DELAYOFFSETSPATIALFILT = -1
|
|
|
61
62
|
DEFAULT_WINDOWSIZE = 30.0
|
|
62
63
|
DEFAULT_SYSTEMICFITTYPE = "pca"
|
|
63
64
|
DEFAULT_PCACOMPONENTS = 1
|
|
64
|
-
|
|
65
|
+
DEFAULT_LAGMIN = 0.0
|
|
66
|
+
DEFAULT_LAGMAX = 0.0
|
|
65
67
|
DEFAULT_TRAINSTEP = 0.5
|
|
66
68
|
|
|
67
69
|
|
|
@@ -146,19 +148,19 @@ def _get_parser():
|
|
|
146
148
|
default=True,
|
|
147
149
|
)
|
|
148
150
|
parser.add_argument(
|
|
149
|
-
"--
|
|
150
|
-
dest="
|
|
151
|
-
action=
|
|
151
|
+
"--trainrange",
|
|
152
|
+
dest="lag_extrema",
|
|
153
|
+
action=pf.IndicateSpecifiedAction,
|
|
154
|
+
nargs=2,
|
|
152
155
|
type=float,
|
|
153
|
-
metavar="
|
|
156
|
+
metavar=("LAGMIN", "LAGMAX"),
|
|
154
157
|
help=(
|
|
155
|
-
"
|
|
158
|
+
"Set the range of delay offset center frequencies to span LAGMIN to LAGMAX. The derivative "
|
|
156
159
|
"ratio calculation only works over a narrow range, so if the static offset is large, "
|
|
157
160
|
"you need to train the ratio calculation with a central delay close to that value. "
|
|
158
|
-
"
|
|
159
|
-
f"Default is {DEFAULT_TRAINWIDTH}"
|
|
161
|
+
f"LAGMAX. Default is {DEFAULT_LAGMIN} to {DEFAULT_LAGMAX} seconds. "
|
|
160
162
|
),
|
|
161
|
-
default=
|
|
163
|
+
default=(DEFAULT_LAGMIN, DEFAULT_LAGMAX),
|
|
162
164
|
)
|
|
163
165
|
parser.add_argument(
|
|
164
166
|
"--trainstep",
|
|
@@ -209,6 +211,13 @@ def _get_parser():
|
|
|
209
211
|
help="Use NCOMP components for PCA fit of delay offset.",
|
|
210
212
|
default=DEFAULT_PCACOMPONENTS,
|
|
211
213
|
)
|
|
214
|
+
parser.add_argument(
|
|
215
|
+
"--verbose",
|
|
216
|
+
dest="verbose",
|
|
217
|
+
action="store_true",
|
|
218
|
+
help=("Be wicked chatty."),
|
|
219
|
+
default=False,
|
|
220
|
+
)
|
|
212
221
|
parser.add_argument(
|
|
213
222
|
"--debug",
|
|
214
223
|
dest="debug",
|
|
@@ -259,6 +268,9 @@ def delayvar(args):
|
|
|
259
268
|
# get the pid of the parent process
|
|
260
269
|
args.pid = os.getpid()
|
|
261
270
|
|
|
271
|
+
args.lagmin = args.lag_extrema[0]
|
|
272
|
+
args.lagmax = args.lag_extrema[1]
|
|
273
|
+
|
|
262
274
|
# specify the output name
|
|
263
275
|
if args.alternateoutput is None:
|
|
264
276
|
outputname = args.datafileroot
|
|
@@ -502,6 +514,16 @@ def delayvar(args):
|
|
|
502
514
|
# windowed delay deviation estimation
|
|
503
515
|
lagstouse_valid = lagtimes_valid
|
|
504
516
|
|
|
517
|
+
# find the robust range of the static delays
|
|
518
|
+
(
|
|
519
|
+
pct02,
|
|
520
|
+
pct98,
|
|
521
|
+
) = tide_stats.getfracvals(lagstouse_valid, [0.02, 0.98], debug=args.debug)
|
|
522
|
+
if args.lagmin == -999:
|
|
523
|
+
args.lagmin = np.round(pct02 / args.trainstep, 0) * args.trainstep
|
|
524
|
+
if args.lagmax == -999:
|
|
525
|
+
args.lagmax = np.round(pct98 / args.trainstep, 0) * args.trainstep
|
|
526
|
+
|
|
505
527
|
print("\n\nWindowed delay estimation")
|
|
506
528
|
TimingLGR.info("Windowed delay estimation start")
|
|
507
529
|
LGR.info("\n\nWindowed delay estimation")
|
|
@@ -537,7 +559,7 @@ def delayvar(args):
|
|
|
537
559
|
thehpf.apply(genlagsamplerate, reference_y),
|
|
538
560
|
padtime=thepadtime,
|
|
539
561
|
)
|
|
540
|
-
genlagtc.save(f"{outputname}_desc-
|
|
562
|
+
genlagtc.save(f"{outputname}_desc-hpflagtcgenerator_timeseries")
|
|
541
563
|
|
|
542
564
|
# and filter the data if necessary
|
|
543
565
|
if args.hpf:
|
|
@@ -582,7 +604,7 @@ def delayvar(args):
|
|
|
582
604
|
numwins,
|
|
583
605
|
)
|
|
584
606
|
internalwinfmrishape = (numvalidspatiallocs, wintrs)
|
|
585
|
-
if args.debug
|
|
607
|
+
if args.debug:
|
|
586
608
|
print(f"window space shape = {internalwinspaceshape}")
|
|
587
609
|
print(f"internalwindowfmrishape shape = {internalwinfmrishape}")
|
|
588
610
|
|
|
@@ -591,6 +613,7 @@ def delayvar(args):
|
|
|
591
613
|
windowedmedfiltregressderivratios = np.zeros(internalwinspaceshape, dtype=float)
|
|
592
614
|
windowedfilteredregressderivratios = np.zeros(internalwinspaceshape, dtype=float)
|
|
593
615
|
windoweddelayoffset = np.zeros(internalwinspaceshape, dtype=float)
|
|
616
|
+
windowedclosestoffset = np.zeros(internalwinspaceshape, dtype=float)
|
|
594
617
|
if usesharedmem:
|
|
595
618
|
if args.debug:
|
|
596
619
|
print("allocating shared memory")
|
|
@@ -626,17 +649,30 @@ def delayvar(args):
|
|
|
626
649
|
if args.debug:
|
|
627
650
|
print(f"wintrs={wintrs}, winskip={winskip}, numtrs={numtrs}, numwins={numwins}")
|
|
628
651
|
thewindowprocoptions = therunoptions
|
|
652
|
+
if args.verbose:
|
|
653
|
+
thewindowprocoptions["showprogressbar"] = True
|
|
654
|
+
else:
|
|
655
|
+
thewindowprocoptions["showprogressbar"] = False
|
|
629
656
|
if args.focaldebug:
|
|
630
657
|
thewindowprocoptions["saveminimumsLFOfiltfiles"] = True
|
|
631
658
|
winoutputlevel = "max"
|
|
632
659
|
else:
|
|
633
660
|
thewindowprocoptions["saveminimumsLFOfiltfiles"] = False
|
|
634
661
|
winoutputlevel = "min"
|
|
662
|
+
|
|
663
|
+
# Now get the derivative ratios the individual windows
|
|
664
|
+
print("Finding derivative ratios:")
|
|
635
665
|
for thewin in range(numwins):
|
|
636
|
-
print(f"
|
|
666
|
+
print(f"\tProcessing window {thewin + 1} of {numwins}")
|
|
637
667
|
starttr = thewin * winskip
|
|
638
668
|
endtr = starttr + wintrs
|
|
639
669
|
winlabel = f"_win-{str(thewin + 1).zfill(3)}"
|
|
670
|
+
if args.verbose:
|
|
671
|
+
thisLGR = LGR
|
|
672
|
+
thisTimingLGR = TimingLGR
|
|
673
|
+
else:
|
|
674
|
+
thisLGR = None
|
|
675
|
+
thisTimingLGR = None
|
|
640
676
|
|
|
641
677
|
windowedregressderivratios[:, thewin], windowedregressrvalues[:, thewin] = (
|
|
642
678
|
tide_refinedelay.getderivratios(
|
|
@@ -657,8 +693,8 @@ def delayvar(args):
|
|
|
657
693
|
winmovingsignal,
|
|
658
694
|
winlagtc,
|
|
659
695
|
winfiltereddata,
|
|
660
|
-
|
|
661
|
-
|
|
696
|
+
thisLGR,
|
|
697
|
+
thisTimingLGR,
|
|
662
698
|
thewindowprocoptions,
|
|
663
699
|
regressderivs=1,
|
|
664
700
|
starttr=starttr,
|
|
@@ -666,7 +702,33 @@ def delayvar(args):
|
|
|
666
702
|
debug=args.debug,
|
|
667
703
|
)
|
|
668
704
|
)
|
|
705
|
+
if args.focaldebug:
|
|
706
|
+
theheader = copy.deepcopy(fmri_header)
|
|
707
|
+
theheader["dim"][4] = wintrs
|
|
708
|
+
theheader["toffset"] = winwidth / 2.0
|
|
709
|
+
maplist = [
|
|
710
|
+
(
|
|
711
|
+
winlagtc,
|
|
712
|
+
"windowedlagtcs",
|
|
713
|
+
"bold",
|
|
714
|
+
None,
|
|
715
|
+
f"Lagtcs in each {winspace} second window",
|
|
716
|
+
),
|
|
717
|
+
]
|
|
718
|
+
tide_io.savemaplist(
|
|
719
|
+
outputname + winlabel,
|
|
720
|
+
maplist,
|
|
721
|
+
validvoxels,
|
|
722
|
+
(xsize, ysize, numslices, wintrs),
|
|
723
|
+
theheader,
|
|
724
|
+
bidsbasedict,
|
|
725
|
+
debug=args.debug,
|
|
726
|
+
)
|
|
669
727
|
|
|
728
|
+
# Filter the derivative ratios
|
|
729
|
+
print("Filtering derivative ratios:")
|
|
730
|
+
for thewin in range(numwins):
|
|
731
|
+
print(f"\tProcessing window {thewin + 1} of {numwins}")
|
|
670
732
|
(
|
|
671
733
|
windowedmedfiltregressderivratios[:, thewin],
|
|
672
734
|
windowedfilteredregressderivratios[:, thewin],
|
|
@@ -681,34 +743,62 @@ def delayvar(args):
|
|
|
681
743
|
fileiscifti=False,
|
|
682
744
|
textio=False,
|
|
683
745
|
rt_floattype=rt_floattype,
|
|
746
|
+
verbose=args.verbose,
|
|
684
747
|
debug=args.debug,
|
|
685
748
|
)
|
|
686
749
|
|
|
750
|
+
# Train the ratio offsets
|
|
751
|
+
print("Training ratio offsets:")
|
|
752
|
+
for thewin in range(numwins):
|
|
753
|
+
print(f"\tProcessing window {thewin + 1} of {numwins}")
|
|
754
|
+
starttr = thewin * winskip
|
|
755
|
+
endtr = starttr + wintrs
|
|
756
|
+
winlabel = f"_win-{str(thewin + 1).zfill(3)}"
|
|
687
757
|
# find the mapping of glm ratios to delays
|
|
688
758
|
tide_refinedelay.trainratiotooffset(
|
|
689
759
|
genlagtc,
|
|
690
760
|
initial_fmri_x[starttr:endtr],
|
|
691
761
|
outputname + winlabel,
|
|
692
762
|
winoutputlevel,
|
|
693
|
-
|
|
694
|
-
|
|
763
|
+
trainlagmin=args.lagmin,
|
|
764
|
+
trainlagmax=args.lagmax,
|
|
765
|
+
trainlagstep=args.trainstep,
|
|
695
766
|
mindelay=args.mindelay,
|
|
696
767
|
maxdelay=args.maxdelay,
|
|
697
768
|
numpoints=args.numpoints,
|
|
698
|
-
|
|
769
|
+
verbose=args.verbose,
|
|
770
|
+
debug=args.focaldebug,
|
|
699
771
|
)
|
|
700
772
|
TimingLGR.info("Refinement calibration end")
|
|
701
773
|
|
|
702
|
-
|
|
774
|
+
# now calculate the delay offsets
|
|
775
|
+
print("Calculating delay offsets:")
|
|
776
|
+
for thewin in range(numwins):
|
|
777
|
+
print(f"\tProcessing window {thewin + 1} of {numwins}")
|
|
778
|
+
winlabel = f"_win-{str(thewin + 1).zfill(3)}"
|
|
703
779
|
TimingLGR.info("Calculating delay offsets")
|
|
704
|
-
if args.
|
|
780
|
+
if args.debug:
|
|
705
781
|
print(
|
|
706
782
|
f"calculating delayoffsets for {windowedfilteredregressderivratios.shape[0]} voxels"
|
|
707
783
|
)
|
|
708
784
|
for i in range(windowedfilteredregressderivratios.shape[0]):
|
|
709
|
-
windoweddelayoffset[i, thewin] =
|
|
710
|
-
|
|
785
|
+
(windoweddelayoffset[i, thewin], windowedclosestoffset[i, thewin]) = (
|
|
786
|
+
tide_refinedelay.ratiotodelay(
|
|
787
|
+
windowedfilteredregressderivratios[i, thewin],
|
|
788
|
+
offset=lagstouse_valid[i],
|
|
789
|
+
debug=args.focaldebug,
|
|
790
|
+
)
|
|
711
791
|
)
|
|
792
|
+
namesuffix = "_desc-delayoffset_hist"
|
|
793
|
+
tide_stats.makeandsavehistogram(
|
|
794
|
+
windoweddelayoffset[:, thewin],
|
|
795
|
+
therunoptions["histlen"],
|
|
796
|
+
1,
|
|
797
|
+
outputname + winlabel + namesuffix,
|
|
798
|
+
displaytitle="Histogram of delay offsets calculated from GLM",
|
|
799
|
+
dictvarname="delayoffsethist",
|
|
800
|
+
thedict=None,
|
|
801
|
+
)
|
|
712
802
|
|
|
713
803
|
# now see if there are common timecourses in the delay offsets
|
|
714
804
|
themean = np.mean(windoweddelayoffset, axis=1)
|
|
@@ -749,7 +839,7 @@ def delayvar(args):
|
|
|
749
839
|
# unscale the PCA cleaned data
|
|
750
840
|
for vox in range(0, windoweddelayoffset.shape[0]):
|
|
751
841
|
reduceddata[vox, :] = reduceddata[vox, :] * thevar[vox] + themean[vox]
|
|
752
|
-
if args.
|
|
842
|
+
if args.debug:
|
|
753
843
|
print("complex processing: reduceddata.shape =", scaledvoxels.shape)
|
|
754
844
|
# pcadata = np.mean(reduceddata, axis=0)
|
|
755
845
|
pcadata = thefit.components_[0]
|
|
@@ -850,22 +940,13 @@ def delayvar(args):
|
|
|
850
940
|
nprocs_regressionfilt=args.nprocs,
|
|
851
941
|
regressderivs=1,
|
|
852
942
|
showprogressbar=args.showprogressbar,
|
|
853
|
-
debug=args.
|
|
943
|
+
debug=args.debug,
|
|
854
944
|
)
|
|
855
945
|
|
|
856
|
-
namesuffix = f"_desc-delayoffsetwin{thewin}_hist"
|
|
857
|
-
tide_stats.makeandsavehistogram(
|
|
858
|
-
windoweddelayoffset[:, thewin],
|
|
859
|
-
therunoptions["histlen"],
|
|
860
|
-
1,
|
|
861
|
-
outputname + namesuffix,
|
|
862
|
-
displaytitle="Histogram of delay offsets calculated from GLM",
|
|
863
|
-
dictvarname="delayoffsethist",
|
|
864
|
-
thedict=None,
|
|
865
|
-
)
|
|
866
946
|
theheader = copy.deepcopy(fmri_header)
|
|
867
947
|
theheader["dim"][4] = numwins
|
|
868
948
|
theheader["pixdim"][4] = winspace
|
|
949
|
+
theheader["toffset"] = winwidth / 2.0
|
|
869
950
|
maplist = [
|
|
870
951
|
(
|
|
871
952
|
windoweddelayoffset,
|
|
@@ -874,6 +955,13 @@ def delayvar(args):
|
|
|
874
955
|
None,
|
|
875
956
|
f"Delay offsets in each {winspace} second window",
|
|
876
957
|
),
|
|
958
|
+
(
|
|
959
|
+
windowedclosestoffset,
|
|
960
|
+
"windowedclosestoffset",
|
|
961
|
+
"info",
|
|
962
|
+
None,
|
|
963
|
+
f"Closest delay offsets in each {winspace} second window",
|
|
964
|
+
),
|
|
877
965
|
(
|
|
878
966
|
np.square(windowedregressrvalues),
|
|
879
967
|
"windowedregressr2values",
|
rapidtide/workflows/diffrois.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
|
-
# Copyright 2016-
|
|
4
|
+
# Copyright 2016-2025 Blaise Frederick
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
|
-
# Copyright 2016-
|
|
4
|
+
# Copyright 2016-2025 Blaise Frederick
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
rapidtide/workflows/fdica.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
|
-
# Copyright 2016-
|
|
4
|
+
# Copyright 2016-2025 Blaise Frederick
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
rapidtide/workflows/filtnifti.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
|
-
# Copyright 2016-
|
|
4
|
+
# Copyright 2016-2025 Blaise Frederick
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
rapidtide/workflows/filttc.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
|
-
# Copyright 2016-
|
|
4
|
+
# Copyright 2016-2025 Blaise Frederick
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
rapidtide/workflows/fixtr.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
|
-
# Copyright 2016-
|
|
4
|
+
# Copyright 2016-2025 Blaise Frederick
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
rapidtide/workflows/gmscalc.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
|
-
# Copyright 2016-
|
|
4
|
+
# Copyright 2016-2025 Blaise Frederick
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
rapidtide/workflows/happy.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
|
-
# Copyright 2018-
|
|
4
|
+
# Copyright 2018-2025 Blaise Frederick
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
|
@@ -205,7 +205,6 @@ def happy_main(argparsingfunc):
|
|
|
205
205
|
tide_util.logmem("before mask creation")
|
|
206
206
|
# mask = np.uint16(masking.compute_epi_mask(nim).dataobj.reshape(numspatiallocs))
|
|
207
207
|
mask = np.uint16(tide_mask.makeepimask(nim).dataobj.reshape(numspatiallocs))
|
|
208
|
-
validvoxels = np.where(mask > 0)[0]
|
|
209
208
|
theheader = copy.deepcopy(nim_hdr)
|
|
210
209
|
theheader["dim"][4] = 1
|
|
211
210
|
timings.append(["Mask created", time.time(), None, None])
|
|
@@ -236,13 +235,14 @@ def happy_main(argparsingfunc):
|
|
|
236
235
|
# filter out motion regressors here
|
|
237
236
|
if args.motionfilename is not None:
|
|
238
237
|
timings.append(["Motion filtering start", time.time(), None, None])
|
|
239
|
-
motiondict = tide_io.readmotion(args.motionfilename, tr=tr)
|
|
238
|
+
motiondict = tide_io.readmotion(args.motionfilename, tr=tr, colspec=args.motionfilecolspec)
|
|
240
239
|
confoundregressors, confoundregressorlabels = tide_fit.calcexpandedregressors(
|
|
241
240
|
motiondict,
|
|
242
241
|
labels=["xtrans", "ytrans", "ztrans", "xrot", "yrot", "zrot"],
|
|
243
242
|
deriv=args.motfilt_deriv,
|
|
244
243
|
order=args.motfilt_order,
|
|
245
244
|
)
|
|
245
|
+
tide_util.disablemkl(args.nprocs)
|
|
246
246
|
(motionregressors, motionregressorlabels, filtereddata, confoundr2) = (
|
|
247
247
|
tide_linfitfiltpass.confoundregress(
|
|
248
248
|
confoundregressors,
|
|
@@ -253,8 +253,10 @@ def happy_main(argparsingfunc):
|
|
|
253
253
|
tcstart=args.motskip,
|
|
254
254
|
tchp=args.motionhp,
|
|
255
255
|
tclp=args.motionlp,
|
|
256
|
+
nprocs=args.nprocs,
|
|
256
257
|
)
|
|
257
258
|
)
|
|
259
|
+
tide_util.enablemkl(args.mklthreads)
|
|
258
260
|
if confoundr2 is None:
|
|
259
261
|
print("There are no nonzero confound regressors - exiting")
|
|
260
262
|
sys.exit()
|
|
@@ -273,6 +275,17 @@ def happy_main(argparsingfunc):
|
|
|
273
275
|
append=False,
|
|
274
276
|
debug=args.debug,
|
|
275
277
|
)
|
|
278
|
+
# save motionr2 map
|
|
279
|
+
theheader = copy.deepcopy(nim_hdr)
|
|
280
|
+
theheader["dim"][4] = 1
|
|
281
|
+
motionr2filename = outputroot + "_desc-motionr2_map"
|
|
282
|
+
bidsdict = bidsbasedict.copy()
|
|
283
|
+
tide_io.writedicttojson(bidsdict, motionr2filename + ".json")
|
|
284
|
+
outarray = np.zeros((xsize, ysize, numslices), dtype=float)
|
|
285
|
+
outarray.reshape(numspatiallocs)[validprojvoxels] = confoundr2
|
|
286
|
+
tide_io.savetonifti(
|
|
287
|
+
outarray.reshape((xsize, ysize, numslices)), theheader, motionr2filename
|
|
288
|
+
)
|
|
276
289
|
if args.savemotionglmfilt:
|
|
277
290
|
motionfilteredfilename = outputroot + "_desc-motionfiltered_bold"
|
|
278
291
|
bidsdict = bidsbasedict.copy()
|
|
@@ -372,6 +385,7 @@ def happy_main(argparsingfunc):
|
|
|
372
385
|
# now get an estimate of the cardiac signal
|
|
373
386
|
print("estimating cardiac signal from fmri data")
|
|
374
387
|
tide_util.logmem("before cardiacfromimage")
|
|
388
|
+
tide_util.disablemkl(args.nprocs)
|
|
375
389
|
(
|
|
376
390
|
cardfromfmri_sliceres,
|
|
377
391
|
cardfromfmri_normfac,
|
|
@@ -402,6 +416,7 @@ def happy_main(argparsingfunc):
|
|
|
402
416
|
debug=args.debug,
|
|
403
417
|
verbose=args.verbose,
|
|
404
418
|
)
|
|
419
|
+
tide_util.enablemkl(args.mklthreads)
|
|
405
420
|
timings.append(
|
|
406
421
|
[
|
|
407
422
|
"Cardiac signal generated from image data" + passstring,
|
|
@@ -602,6 +617,15 @@ def happy_main(argparsingfunc):
|
|
|
602
617
|
)
|
|
603
618
|
thedlfilter = tide_dlfilt.DeepLearningFilter(modelpath=modelpath)
|
|
604
619
|
thedlfilter.loadmodel(args.modelname)
|
|
620
|
+
updatemodels = False
|
|
621
|
+
if updatemodels:
|
|
622
|
+
updatedmodelname = f"{args.modelname}_tf2"
|
|
623
|
+
newmodeldir = os.path.join(
|
|
624
|
+
"/Users/frederic/code/rapidtide/rapidtide/data/models", updatedmodelname
|
|
625
|
+
)
|
|
626
|
+
print(f"creating {newmodeldir}")
|
|
627
|
+
tide_util.makeadir(newmodeldir)
|
|
628
|
+
thedlfilter.savemodel(altname=newmodeldir)
|
|
605
629
|
infodict["dlfiltermodel"] = args.modelname
|
|
606
630
|
normdlfilteredcard_stdres = thedlfilter.apply(normcardfromfmri_stdres)
|
|
607
631
|
dlfilteredcard_stdres = thedlfilter.apply(cardfromfmri_stdres)
|
|
@@ -966,6 +990,24 @@ def happy_main(argparsingfunc):
|
|
|
966
990
|
append=True,
|
|
967
991
|
debug=args.debug,
|
|
968
992
|
)
|
|
993
|
+
badpointlist_stdres = np.round(
|
|
994
|
+
tide_resample.arbresample(
|
|
995
|
+
badpointlist,
|
|
996
|
+
slicesamplerate,
|
|
997
|
+
args.stdfreq,
|
|
998
|
+
decimate=True,
|
|
999
|
+
debug=False,
|
|
1000
|
+
),
|
|
1001
|
+
0,
|
|
1002
|
+
)
|
|
1003
|
+
tide_io.writebidstsv(
|
|
1004
|
+
outputroot + "_desc-stdrescardfromfmri_timeseries",
|
|
1005
|
+
badpointlist_stdres,
|
|
1006
|
+
args.stdfreq,
|
|
1007
|
+
columns=["badpts"],
|
|
1008
|
+
append=True,
|
|
1009
|
+
debug=args.debug,
|
|
1010
|
+
)
|
|
969
1011
|
|
|
970
1012
|
# extract the fundamental
|
|
971
1013
|
if args.forcedhr is not None:
|
|
@@ -1755,6 +1797,7 @@ def happy_main(argparsingfunc):
|
|
|
1755
1797
|
fitNorm = np.zeros(timepoints, dtype=np.float64)
|
|
1756
1798
|
datatoremove = 0.0 * fmri_data
|
|
1757
1799
|
print("Running spatial regression on", timepoints, "timepoints")
|
|
1800
|
+
tide_util.disablemkl(args.nprocs)
|
|
1758
1801
|
tide_linfitfiltpass.linfitfiltpass(
|
|
1759
1802
|
timepoints,
|
|
1760
1803
|
fmri_data[validlocs, :],
|
|
@@ -1771,6 +1814,7 @@ def happy_main(argparsingfunc):
|
|
|
1771
1814
|
procbyvoxel=False,
|
|
1772
1815
|
nprocs=args.nprocs,
|
|
1773
1816
|
)
|
|
1817
|
+
tide_util.enablemkl(args.mklthreads)
|
|
1774
1818
|
print(datatoremove.shape, cardiacnoise.shape, fitcoffs.shape)
|
|
1775
1819
|
# datatoremove[validlocs, :] = np.multiply(cardiacnoise[validlocs, :], fitcoffs[:, None])
|
|
1776
1820
|
filtereddata = fmri_data - datatoremove
|
|
@@ -1815,6 +1859,7 @@ def happy_main(argparsingfunc):
|
|
|
1815
1859
|
fitNorm = np.zeros(numspatiallocs, dtype=np.float64)
|
|
1816
1860
|
datatoremove = 0.0 * fmri_data
|
|
1817
1861
|
print("Running temporal regression on", numvalidspatiallocs, "voxels")
|
|
1862
|
+
tide_util.disablemkl(args.nprocs)
|
|
1818
1863
|
tide_linfitfiltpass.linfitfiltpass(
|
|
1819
1864
|
numvalidspatiallocs,
|
|
1820
1865
|
fmri_data[validlocs, :],
|
|
@@ -1830,6 +1875,7 @@ def happy_main(argparsingfunc):
|
|
|
1830
1875
|
procbyvoxel=True,
|
|
1831
1876
|
nprocs=args.nprocs,
|
|
1832
1877
|
)
|
|
1878
|
+
tide_util.enablemkl(args.mklthreads)
|
|
1833
1879
|
datatoremove[validlocs, :] = np.multiply(
|
|
1834
1880
|
cardiacnoise[validlocs, :], fitcoffs[validlocs, None]
|
|
1835
1881
|
)
|
rapidtide/workflows/happy2std.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
|
-
# Copyright 2016-
|
|
4
|
+
# Copyright 2016-2025 Blaise Frederick
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
|
-
# Copyright 2019-
|
|
4
|
+
# Copyright 2019-2025 Blaise Frederick
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
|
@@ -21,9 +21,11 @@ import argparse
|
|
|
21
21
|
import numpy as np
|
|
22
22
|
|
|
23
23
|
import rapidtide.io as tide_io
|
|
24
|
+
import rapidtide.multiproc as tide_multiproc
|
|
24
25
|
import rapidtide.workflows.parser_funcs as pf
|
|
25
26
|
|
|
26
27
|
DEFAULT_ALIASEDCORRELATIONWIDTH = 5.0
|
|
28
|
+
DEFAULT_DL_MODEL = "model_revised_tf2"
|
|
27
29
|
|
|
28
30
|
|
|
29
31
|
def _get_parser():
|
|
@@ -99,10 +101,10 @@ def _get_parser():
|
|
|
99
101
|
dest="modelname",
|
|
100
102
|
metavar="MODELNAME",
|
|
101
103
|
help=(
|
|
102
|
-
"Use model MODELNAME for dl filter (default is
|
|
104
|
+
f"Use model MODELNAME for dl filter (default is {DEFAULT_DL_MODEL} - "
|
|
103
105
|
"from the revised NeuroImage paper.) "
|
|
104
106
|
),
|
|
105
|
-
default=
|
|
107
|
+
default=DEFAULT_DL_MODEL,
|
|
106
108
|
)
|
|
107
109
|
|
|
108
110
|
# Performance
|
|
@@ -120,7 +122,20 @@ def _get_parser():
|
|
|
120
122
|
),
|
|
121
123
|
default=1,
|
|
122
124
|
)
|
|
123
|
-
|
|
125
|
+
performance_opts.add_argument(
|
|
126
|
+
"--nprocs",
|
|
127
|
+
dest="nprocs",
|
|
128
|
+
action="store",
|
|
129
|
+
metavar="NPROCS",
|
|
130
|
+
type=lambda x: pf.is_int(parser, x),
|
|
131
|
+
help=(
|
|
132
|
+
"Use NPROCS CPUs to accelerate processing (defaults to 1 - more "
|
|
133
|
+
"CPUs up to the number of cores can accelerate processing a lot, but "
|
|
134
|
+
"you need to remember to ask for this many CPUs on clusters.) Entering a mulitprocessor "
|
|
135
|
+
"routine disables mklthreads (otherwise there's chaos)."
|
|
136
|
+
),
|
|
137
|
+
default=1,
|
|
138
|
+
)
|
|
124
139
|
# Preprocessing
|
|
125
140
|
preprocessing_opts = parser.add_argument_group("Preprocessing")
|
|
126
141
|
preprocessing_opts.add_argument(
|
|
@@ -143,7 +158,7 @@ def _get_parser():
|
|
|
143
158
|
)
|
|
144
159
|
preprocessing_opts.add_argument(
|
|
145
160
|
"--motionfile",
|
|
146
|
-
dest="
|
|
161
|
+
dest="motionfilespec",
|
|
147
162
|
metavar="MOTFILE",
|
|
148
163
|
help=(
|
|
149
164
|
"Read 6 columns of motion regressors out of MOTFILE file (.par or BIDS .json) "
|
|
@@ -719,7 +734,6 @@ def process_args(inputargs=None):
|
|
|
719
734
|
args.outputlevel = 1
|
|
720
735
|
args.maskthreshpct = 10.0
|
|
721
736
|
args.domadnorm = True
|
|
722
|
-
args.nprocs = 1
|
|
723
737
|
args.verbose = False
|
|
724
738
|
args.smoothlen = 101
|
|
725
739
|
args.envthresh = 0.2
|
|
@@ -738,6 +752,16 @@ def process_args(inputargs=None):
|
|
|
738
752
|
if args.disablenotch:
|
|
739
753
|
args.notchpct = None
|
|
740
754
|
|
|
755
|
+
# process motionfile information
|
|
756
|
+
if args.motionfilespec is not None:
|
|
757
|
+
(args.motionfilename, args.motionfilecolspec) = tide_io.parsefilespec(args.motionfilespec)
|
|
758
|
+
else:
|
|
759
|
+
args.motionfilename = None
|
|
760
|
+
|
|
761
|
+
# set the number of worker processes if multiprocessing
|
|
762
|
+
if args.nprocs < 1:
|
|
763
|
+
args.nprocs = tide_multiproc.maxcpus()
|
|
764
|
+
|
|
741
765
|
# process infotags
|
|
742
766
|
args = pf.postprocesstagopts(args)
|
|
743
767
|
|
rapidtide/workflows/histnifti.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
|
-
# Copyright 2016-
|
|
4
|
+
# Copyright 2016-2025 Blaise Frederick
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
rapidtide/workflows/histtc.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
|
-
# Copyright 2016-
|
|
4
|
+
# Copyright 2016-2025 Blaise Frederick
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
|
-
# Copyright 2016-
|
|
4
|
+
# Copyright 2016-2025 Blaise Frederick
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
rapidtide/workflows/localflow.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
|
-
# Copyright 2016-
|
|
4
|
+
# Copyright 2016-2025 Blaise Frederick
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
|
-
# Copyright 2024-
|
|
4
|
+
# Copyright 2024-2025 Blaise Frederick
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|