rapidtide 3.0.11__py3-none-any.whl → 3.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. rapidtide/Colortables.py +492 -27
  2. rapidtide/OrthoImageItem.py +1049 -46
  3. rapidtide/RapidtideDataset.py +1533 -86
  4. rapidtide/_version.py +3 -3
  5. rapidtide/calccoherence.py +196 -29
  6. rapidtide/calcnullsimfunc.py +188 -40
  7. rapidtide/calcsimfunc.py +242 -42
  8. rapidtide/correlate.py +1203 -383
  9. rapidtide/data/examples/src/testLD +56 -0
  10. rapidtide/data/examples/src/testalign +1 -1
  11. rapidtide/data/examples/src/testdelayvar +0 -1
  12. rapidtide/data/examples/src/testfmri +53 -3
  13. rapidtide/data/examples/src/testglmfilt +5 -5
  14. rapidtide/data/examples/src/testhappy +29 -7
  15. rapidtide/data/examples/src/testppgproc +17 -0
  16. rapidtide/data/examples/src/testrolloff +11 -0
  17. rapidtide/data/models/model_cnn_pytorch/best_model.pth +0 -0
  18. rapidtide/data/models/model_cnn_pytorch/loss.png +0 -0
  19. rapidtide/data/models/model_cnn_pytorch/loss.txt +1 -0
  20. rapidtide/data/models/model_cnn_pytorch/model.pth +0 -0
  21. rapidtide/data/models/model_cnn_pytorch/model_meta.json +68 -0
  22. rapidtide/decorators.py +91 -0
  23. rapidtide/dlfilter.py +2226 -110
  24. rapidtide/dlfiltertorch.py +4842 -0
  25. rapidtide/externaltools.py +327 -12
  26. rapidtide/fMRIData_class.py +79 -40
  27. rapidtide/filter.py +1899 -810
  28. rapidtide/fit.py +2011 -581
  29. rapidtide/genericmultiproc.py +93 -18
  30. rapidtide/happy_supportfuncs.py +2047 -172
  31. rapidtide/helper_classes.py +584 -43
  32. rapidtide/io.py +2370 -372
  33. rapidtide/linfitfiltpass.py +346 -99
  34. rapidtide/makelaggedtcs.py +210 -24
  35. rapidtide/maskutil.py +448 -62
  36. rapidtide/miscmath.py +827 -121
  37. rapidtide/multiproc.py +210 -22
  38. rapidtide/patchmatch.py +242 -42
  39. rapidtide/peakeval.py +31 -31
  40. rapidtide/ppgproc.py +2203 -0
  41. rapidtide/qualitycheck.py +352 -39
  42. rapidtide/refinedelay.py +431 -57
  43. rapidtide/refineregressor.py +494 -189
  44. rapidtide/resample.py +671 -185
  45. rapidtide/scripts/applyppgproc.py +28 -0
  46. rapidtide/scripts/showxcorr_legacy.py +7 -7
  47. rapidtide/scripts/stupidramtricks.py +15 -17
  48. rapidtide/simFuncClasses.py +1052 -77
  49. rapidtide/simfuncfit.py +269 -69
  50. rapidtide/stats.py +540 -238
  51. rapidtide/tests/happycomp +9 -0
  52. rapidtide/tests/test_cleanregressor.py +1 -2
  53. rapidtide/tests/test_dlfiltertorch.py +627 -0
  54. rapidtide/tests/test_findmaxlag.py +24 -8
  55. rapidtide/tests/test_fullrunhappy_v1.py +0 -2
  56. rapidtide/tests/test_fullrunhappy_v2.py +0 -2
  57. rapidtide/tests/test_fullrunhappy_v3.py +11 -4
  58. rapidtide/tests/test_fullrunhappy_v4.py +10 -2
  59. rapidtide/tests/test_fullrunrapidtide_v7.py +1 -1
  60. rapidtide/tests/test_getparsers.py +11 -3
  61. rapidtide/tests/test_refinedelay.py +0 -1
  62. rapidtide/tests/test_simroundtrip.py +16 -8
  63. rapidtide/tests/test_stcorrelate.py +3 -1
  64. rapidtide/tests/utils.py +9 -8
  65. rapidtide/tidepoolTemplate.py +142 -38
  66. rapidtide/tidepoolTemplate_alt.py +165 -44
  67. rapidtide/tidepoolTemplate_big.py +189 -52
  68. rapidtide/util.py +1217 -118
  69. rapidtide/voxelData.py +684 -37
  70. rapidtide/wiener.py +136 -23
  71. rapidtide/wiener2.py +113 -7
  72. rapidtide/workflows/adjustoffset.py +105 -3
  73. rapidtide/workflows/aligntcs.py +85 -2
  74. rapidtide/workflows/applydlfilter.py +87 -10
  75. rapidtide/workflows/applyppgproc.py +540 -0
  76. rapidtide/workflows/atlasaverage.py +210 -47
  77. rapidtide/workflows/atlastool.py +100 -3
  78. rapidtide/workflows/calcSimFuncMap.py +288 -69
  79. rapidtide/workflows/calctexticc.py +201 -9
  80. rapidtide/workflows/ccorrica.py +101 -6
  81. rapidtide/workflows/cleanregressor.py +165 -31
  82. rapidtide/workflows/delayvar.py +171 -23
  83. rapidtide/workflows/diffrois.py +81 -3
  84. rapidtide/workflows/endtidalproc.py +144 -4
  85. rapidtide/workflows/fdica.py +195 -15
  86. rapidtide/workflows/filtnifti.py +70 -3
  87. rapidtide/workflows/filttc.py +74 -3
  88. rapidtide/workflows/fitSimFuncMap.py +202 -51
  89. rapidtide/workflows/fixtr.py +73 -3
  90. rapidtide/workflows/gmscalc.py +113 -3
  91. rapidtide/workflows/happy.py +801 -199
  92. rapidtide/workflows/happy2std.py +144 -12
  93. rapidtide/workflows/happy_parser.py +163 -23
  94. rapidtide/workflows/histnifti.py +118 -2
  95. rapidtide/workflows/histtc.py +84 -3
  96. rapidtide/workflows/linfitfilt.py +117 -4
  97. rapidtide/workflows/localflow.py +328 -28
  98. rapidtide/workflows/mergequality.py +79 -3
  99. rapidtide/workflows/niftidecomp.py +322 -18
  100. rapidtide/workflows/niftistats.py +174 -4
  101. rapidtide/workflows/pairproc.py +98 -4
  102. rapidtide/workflows/pairwisemergenifti.py +85 -2
  103. rapidtide/workflows/parser_funcs.py +1421 -40
  104. rapidtide/workflows/physiofreq.py +137 -11
  105. rapidtide/workflows/pixelcomp.py +207 -5
  106. rapidtide/workflows/plethquality.py +103 -21
  107. rapidtide/workflows/polyfitim.py +151 -11
  108. rapidtide/workflows/proj2flow.py +75 -2
  109. rapidtide/workflows/rankimage.py +111 -4
  110. rapidtide/workflows/rapidtide.py +368 -76
  111. rapidtide/workflows/rapidtide2std.py +98 -2
  112. rapidtide/workflows/rapidtide_parser.py +109 -9
  113. rapidtide/workflows/refineDelayMap.py +144 -33
  114. rapidtide/workflows/refineRegressor.py +675 -96
  115. rapidtide/workflows/regressfrommaps.py +161 -37
  116. rapidtide/workflows/resamplenifti.py +85 -3
  117. rapidtide/workflows/resampletc.py +91 -3
  118. rapidtide/workflows/retrolagtcs.py +99 -9
  119. rapidtide/workflows/retroregress.py +176 -26
  120. rapidtide/workflows/roisummarize.py +174 -5
  121. rapidtide/workflows/runqualitycheck.py +71 -3
  122. rapidtide/workflows/showarbcorr.py +149 -6
  123. rapidtide/workflows/showhist.py +86 -2
  124. rapidtide/workflows/showstxcorr.py +160 -3
  125. rapidtide/workflows/showtc.py +159 -3
  126. rapidtide/workflows/showxcorrx.py +190 -10
  127. rapidtide/workflows/showxy.py +185 -15
  128. rapidtide/workflows/simdata.py +264 -38
  129. rapidtide/workflows/spatialfit.py +77 -2
  130. rapidtide/workflows/spatialmi.py +250 -27
  131. rapidtide/workflows/spectrogram.py +305 -32
  132. rapidtide/workflows/synthASL.py +154 -3
  133. rapidtide/workflows/tcfrom2col.py +76 -2
  134. rapidtide/workflows/tcfrom3col.py +74 -2
  135. rapidtide/workflows/tidepool.py +2971 -130
  136. rapidtide/workflows/utils.py +19 -14
  137. rapidtide/workflows/utils_doc.py +293 -0
  138. rapidtide/workflows/variabilityizer.py +116 -3
  139. {rapidtide-3.0.11.dist-info → rapidtide-3.1.1.dist-info}/METADATA +10 -8
  140. {rapidtide-3.0.11.dist-info → rapidtide-3.1.1.dist-info}/RECORD +144 -128
  141. {rapidtide-3.0.11.dist-info → rapidtide-3.1.1.dist-info}/entry_points.txt +1 -0
  142. {rapidtide-3.0.11.dist-info → rapidtide-3.1.1.dist-info}/WHEEL +0 -0
  143. {rapidtide-3.0.11.dist-info → rapidtide-3.1.1.dist-info}/licenses/LICENSE +0 -0
  144. {rapidtide-3.0.11.dist-info → rapidtide-3.1.1.dist-info}/top_level.txt +0 -0
rapidtide/qualitycheck.py CHANGED
@@ -16,8 +16,11 @@
16
16
  # limitations under the License.
17
17
  #
18
18
  #
19
+ from typing import Any
20
+
19
21
  import matplotlib.pyplot as plt
20
22
  import numpy as np
23
+ from numpy.typing import NDArray
21
24
  from scipy.ndimage import binary_erosion
22
25
 
23
26
  import rapidtide.filter as tide_filt
@@ -25,16 +28,159 @@ import rapidtide.stats as tide_stats
25
28
  from rapidtide.RapidtideDataset import RapidtideDataset
26
29
 
27
30
 
28
- def prepmask(inputmask):
31
+ def prepmask(inputmask: NDArray) -> NDArray:
32
+ """
33
+ Apply binary erosion to the input mask.
34
+
35
+ Parameters
36
+ ----------
37
+ inputmask : NDArray
38
+ Input binary mask array to be eroded.
39
+
40
+ Returns
41
+ -------
42
+ NDArray
43
+ Eroded binary mask array with features reduced by one pixel in all directions.
44
+
45
+ Notes
46
+ -----
47
+ This function uses binary erosion to shrink the boundaries of foreground objects
48
+ in the input mask. The erosion operation removes pixels from the boundaries of
49
+ objects, effectively reducing their size by one pixel in all directions.
50
+
51
+ Examples
52
+ --------
53
+ >>> import numpy as np
54
+ >>> from scipy.ndimage import binary_erosion
55
+ >>> mask = np.array([[1, 1, 1], [1, 0, 1], [1, 1, 1]])
56
+ >>> eroded = prepmask(mask)
57
+ >>> print(eroded)
58
+ [[0 0 0]
59
+ [0 0 0]
60
+ [0 0 0]]
61
+ """
29
62
  erodedmask = binary_erosion(inputmask)
30
63
  return erodedmask
31
64
 
32
65
 
33
- def getmasksize(themask):
66
+ def getmasksize(themask: NDArray) -> int:
67
+ """
68
+ Calculate the number of non-zero elements in a mask array.
69
+
70
+ This function counts the number of elements in the input array that are greater than zero,
71
+ effectively measuring the size of the active region in a binary mask.
72
+
73
+ Parameters
74
+ ----------
75
+ themask : ndarray
76
+ Input array representing a mask, where positive values indicate active regions
77
+ and zero/negative values indicate inactive regions.
78
+
79
+ Returns
80
+ -------
81
+ int
82
+ The number of elements in the mask that are greater than zero.
83
+
84
+ Notes
85
+ -----
86
+ The function uses `np.where()` to find indices where the mask is greater than zero,
87
+ then `np.ravel()` to flatten the resulting array, and finally `len()` to count the elements.
88
+
89
+ Examples
90
+ --------
91
+ >>> import numpy as np
92
+ >>> mask = np.array([[1, 0, 1], [0, 1, 1]])
93
+ >>> getmasksize(mask)
94
+ 4
95
+
96
+ >>> mask = np.array([0, 0, 0, 0])
97
+ >>> getmasksize(mask)
98
+ 0
99
+
100
+ >>> mask = np.array([1, 2, 3, 4])
101
+ >>> getmasksize(mask)
102
+ 4
103
+ """
34
104
  return len(np.ravel(themask[np.where(themask > 0)]))
35
105
 
36
106
 
37
- def checkregressors(theregressors, numpasses, filterlimits, debug=False):
107
+ def checkregressors(
108
+ theregressors: dict[str, Any], numpasses: int, filterlimits: list[float], debug: bool = False
109
+ ) -> dict[str, float]:
110
+ """
111
+ Calculate and return statistical metrics for the first and last regressors in a sequence.
112
+
113
+ This function extracts the first and last regressors from a dictionary of regressors,
114
+ applies spectral filtering based on provided limits, and computes various statistical
115
+ measures such as kurtosis, skewness, and spectral flatness for both regressors.
116
+
117
+ Parameters
118
+ ----------
119
+ theregressors : dict[str, Any]
120
+ Dictionary containing regressor objects indexed by pass number (e.g., "pass1", "pass2").
121
+ Each regressor is expected to have attributes like `specaxis`, `specdata`, `kurtosis`,
122
+ `kurtosis_z`, `kurtosis_p`, `skewness`, `skewness_z`, `skewness_p`.
123
+ numpasses : int
124
+ Total number of passes; used to identify the last regressor in the dictionary.
125
+ filterlimits : list[float]
126
+ A list of two floats specifying the lower and upper spectral limits for filtering.
127
+ The function uses these to slice the spectral data.
128
+ debug : bool, optional
129
+ If True, prints debug information including filter limits, indices, and spectral data.
130
+ Default is False.
131
+
132
+ Returns
133
+ -------
134
+ dict[str, float]
135
+ A dictionary containing the following keys for both the first and last regressors:
136
+ - `{label}_kurtosis`
137
+ - `{label}_kurtosis_z`
138
+ - `{label}_kurtosis_p`
139
+ - `{label}_skewness`
140
+ - `{label}_skewness_z`
141
+ - `{label}_skewness_p`
142
+ - `{label}_spectralflatness`
143
+ Where `{label}` is either "first" or "last".
144
+
145
+ Notes
146
+ -----
147
+ The function uses `numpy.argmax` and `numpy.argmin` to determine the indices of the
148
+ spectral axis that correspond to the provided filter limits. It then slices the
149
+ spectral data using these indices to compute the spectral flatness.
150
+
151
+ Examples
152
+ --------
153
+ >>> import numpy as np
154
+ >>> regressors = {
155
+ ... "pass1": MockRegressor(
156
+ ... specaxis=np.linspace(0, 10, 100),
157
+ ... specdata=np.random.rand(100),
158
+ ... kurtosis=1.0,
159
+ ... kurtosis_z=0.5,
160
+ ... kurtosis_p=0.1,
161
+ ... skewness=0.0,
162
+ ... skewness_z=0.0,
163
+ ... skewness_p=0.5
164
+ ... ),
165
+ ... "pass2": MockRegressor(
166
+ ... specaxis=np.linspace(0, 10, 100),
167
+ ... specdata=np.random.rand(100),
168
+ ... kurtosis=1.2,
169
+ ... kurtosis_z=0.6,
170
+ ... kurtosis_p=0.05,
171
+ ... skewness=0.1,
172
+ ... skewness_z=0.1,
173
+ ... skewness_p=0.4
174
+ ... )
175
+ ... }
176
+ >>> result = checkregressors(regressors, 2, [2.0, 8.0])
177
+ >>> print(result)
178
+ {'first_kurtosis': 1.0, 'first_kurtosis_z': 0.5, 'first_kurtosis_p': 0.1,
179
+ 'first_skewness': 0.0, 'first_skewness_z': 0.0, 'first_skewness_p': 0.5,
180
+ 'first_spectralflatness': 0.5, 'last_kurtosis': 1.2, 'last_kurtosis_z': 0.6,
181
+ 'last_kurtosis_p': 0.05, 'last_skewness': 0.1, 'last_skewness_z': 0.1,
182
+ 'last_skewness_p': 0.4, 'last_spectralflatness': 0.45}
183
+ """
38
184
  regressormetrics = {}
39
185
  firstregressor = theregressors["pass1"]
40
186
  lastregressor = theregressors[f"pass{numpasses}"]
@@ -59,18 +205,71 @@ def checkregressors(theregressors, numpasses, filterlimits, debug=False):
59
205
 
60
206
 
61
207
  def gethistmetrics(
62
- themap,
63
- themask,
64
- thedict,
65
- thehistlabel=None,
66
- histlen=101,
67
- rangemin=-1.0,
68
- rangemax=1.0,
69
- nozero=False,
70
- savehist=False,
71
- ignorefirstpoint=False,
72
- debug=False,
73
- ):
208
+ themap: NDArray,
209
+ themask: NDArray,
210
+ thedict: dict[str, Any],
211
+ thehistlabel: str | None = None,
212
+ histlen: int = 101,
213
+ rangemin: float = -1.0,
214
+ rangemax: float = 1.0,
215
+ nozero: bool = False,
216
+ savehist: bool = False,
217
+ ignorefirstpoint: bool = False,
218
+ debug: bool = False,
219
+ ) -> None:
220
+ """
221
+ Compute histogram-based metrics for masked data and store results in a dictionary.
222
+
223
+ This function applies a mask to the input data, computes various statistical
224
+ measures including percentiles, moments (skewness, kurtosis), and histogram
225
+ properties, and stores the results in the provided dictionary.
226
+
227
+ Parameters
228
+ ----------
229
+ themap : NDArray
230
+ The input data array from which metrics are computed.
231
+ themask : NDArray
232
+ A boolean or numeric mask array used to select valid data points.
233
+ thedict : dict[str, Any]
234
+ Dictionary to store computed metrics. Keys will be updated with statistical
235
+ values such as percentiles, widths, skewness, kurtosis, and histogram properties.
236
+ thehistlabel : str, optional
237
+ Label for the histogram plot if `debug` is enabled. Default is None.
238
+ histlen : int, optional
239
+ Number of bins for the histogram. Default is 101.
240
+ rangemin : float, optional
241
+ Minimum value of the histogram range. Default is -1.0.
242
+ rangemax : float, optional
243
+ Maximum value of the histogram range. Default is 1.0.
244
+ nozero : bool, optional
245
+ If True, exclude zero values from the computation. Default is False.
246
+ savehist : bool, optional
247
+ If True, save histogram bin centers and values to `thedict`. Default is False.
248
+ ignorefirstpoint : bool, optional
249
+ If True, ignore the first point when computing the histogram. Default is False.
250
+ debug : bool, optional
251
+ If True, print debug information and display histogram plot. Default is False.
252
+
253
+ Returns
254
+ -------
255
+ None
256
+ Results are stored in the input dictionary `thedict`.
257
+
258
+ Notes
259
+ -----
260
+ The function modifies the input dictionary `thedict` in place by adding or updating
261
+ keys with computed statistics. If the mask is empty or no valid data remains after
262
+ filtering, all keys are set to `None` or 0.
263
+
264
+ Examples
265
+ --------
266
+ >>> import numpy as np
267
+ >>> data = np.random.rand(100, 100)
268
+ >>> mask = np.ones((100, 100))
269
+ >>> stats_dict = {}
270
+ >>> gethistmetrics(data, mask, stats_dict, debug=True)
271
+ >>> print(stats_dict['pct50'])
272
+ """
74
273
  # mask and flatten the data
75
274
  maskisempty = False
76
275
  if len(np.where(themask > 0)) == 0:
@@ -155,16 +354,66 @@ def gethistmetrics(
155
354
 
156
355
 
157
356
  def checkmap(
158
- themap,
159
- themask,
160
- histlen=101,
161
- rangemin=0.0,
162
- rangemax=1.0,
163
- histlabel="similarity metric histogram",
164
- ignorefirstpoint=False,
165
- savehist=False,
166
- debug=False,
167
- ):
357
+ themap: NDArray,
358
+ themask: NDArray,
359
+ histlen: int = 101,
360
+ rangemin: float = 0.0,
361
+ rangemax: float = 1.0,
362
+ histlabel: str = "similarity metric histogram",
363
+ ignorefirstpoint: bool = False,
364
+ savehist: bool = False,
365
+ debug: bool = False,
366
+ ) -> dict[str, Any]:
367
+ """
368
+ Compute histogram metrics for a similarity map using a mask.
369
+
370
+ This function calculates various statistical metrics from the histogram of
371
+ similarity values in `themap` where `themask` is non-zero. The metrics include
372
+ mean, standard deviation, minimum, maximum, and histogram data.
373
+
374
+ Parameters
375
+ ----------
376
+ themap : NDArray
377
+ Array containing similarity values to analyze.
378
+ themask : NDArray
379
+ Binary mask array where non-zero values indicate regions of interest.
380
+ histlen : int, optional
381
+ Number of bins in the histogram (default is 101).
382
+ rangemin : float, optional
383
+ Minimum value for histogram range (default is 0.0).
384
+ rangemax : float, optional
385
+ Maximum value for histogram range (default is 1.0).
386
+ histlabel : str, optional
387
+ Label for the histogram (default is "similarity metric histogram").
388
+ ignorefirstpoint : bool, optional
389
+ Whether to ignore the first point in the histogram calculation (default is False).
390
+ savehist : bool, optional
391
+ Whether to save the histogram data (default is False).
392
+ debug : bool, optional
393
+ Whether to enable debug output (default is False).
394
+
395
+ Returns
396
+ -------
397
+ dict[str, Any]
398
+ Dictionary containing histogram metrics including mean, std, min, max,
399
+ and histogram data. The exact keys depend on the implementation of
400
+ `gethistmetrics` function.
401
+
402
+ Notes
403
+ -----
404
+ This function serves as a wrapper around `gethistmetrics` and returns the
405
+ computed metrics directly. The histogram is computed only for regions where
406
+ `themask` is non-zero.
407
+
408
+ Examples
409
+ --------
410
+ >>> import numpy as np
411
+ >>> map_data = np.random.rand(100, 100)
412
+ >>> mask_data = np.ones((100, 100))
413
+ >>> metrics = checkmap(map_data, mask_data)
414
+ >>> print(metrics.keys())
415
+ dict_keys(['mean', 'std', 'min', 'max', 'hist'])
416
+ """
168
417
  themetrics = {}
169
418
 
170
419
  gethistmetrics(
@@ -184,20 +433,84 @@ def checkmap(
184
433
 
185
434
 
186
435
  def qualitycheck(
187
- datafileroot,
188
- graymaskspec=None,
189
- whitemaskspec=None,
190
- anatname=None,
191
- geommaskname=None,
192
- userise=False,
193
- usecorrout=False,
194
- useatlas=False,
195
- forcetr=False,
196
- forceoffset=False,
197
- offsettime=0.0,
198
- verbose=False,
199
- debug=False,
200
- ):
436
+ datafileroot: str,
437
+ graymaskspec: str | None = None,
438
+ whitemaskspec: str | None = None,
439
+ anatname: str | None = None,
440
+ geommaskname: str | None = None,
441
+ userise: bool = False,
442
+ usecorrout: bool = False,
443
+ useatlas: bool = False,
444
+ forcetr: bool = False,
445
+ forceoffset: bool = False,
446
+ offsettime: float = 0.0,
447
+ verbose: bool = False,
448
+ debug: bool = False,
449
+ ) -> dict[str, Any]:
450
+ """
451
+ Perform quality checks on a dataset by analyzing masks, regressors, and map statistics.
452
+
453
+ This function loads a dataset using `RapidtideDataset` and performs a series of quality
454
+ assessments on various overlays (e.g., lag times, strengths, MTT) and regressors. It
455
+ computes statistics for different masks and map regions, including histogram data and
456
+ relative sizes. Optional gray and white matter masks can be used to isolate analysis
457
+ within those regions.
458
+
459
+ Parameters
460
+ ----------
461
+ datafileroot : str
462
+ Root name of the data files to be processed.
463
+ graymaskspec : str, optional
464
+ Path to the gray matter mask specification file.
465
+ whitemaskspec : str, optional
466
+ Path to the white matter mask specification file.
467
+ anatname : str, optional
468
+ Name of the anatomical image to use.
469
+ geommaskname : str, optional
470
+ Name of the geometric mask to use.
471
+ userise : bool, default=False
472
+ Whether to use RISE (reconstruction of instantaneous signal estimates).
473
+ usecorrout : bool, default=False
474
+ Whether to use corrected output.
475
+ useatlas : bool, default=False
476
+ Whether to use atlas-based registration.
477
+ forcetr : bool, default=False
478
+ Force TR (repetition time) to be set.
479
+ forceoffset : bool, default=False
480
+ Force offset to be set.
481
+ offsettime : float, default=0.0
482
+ Time offset to apply.
483
+ verbose : bool, default=False
484
+ Enable verbose output.
485
+ debug : bool, default=False
486
+ Enable debug output.
487
+
488
+ Returns
489
+ -------
490
+ dict[str, Any]
491
+ A dictionary containing quality check results, including:
492
+ - ``passes``: Number of passes in the dataset.
493
+ - ``filterlimits``: Regressor filter limits.
494
+ - ``simcalclimits``: Regressor similarity calculation limits.
495
+ - ``mask``: Dictionary of mask-related statistics.
496
+ - ``regressor``: Regressor quality check results.
497
+ - ``lag``, ``laggrad``, ``strength``, ``MTT``: Statistics for respective maps.
498
+ - Optional gray/white matter-specific results if masks are provided.
499
+
500
+ Notes
501
+ -----
502
+ This function relies on several helper functions and classes such as `RapidtideDataset`,
503
+ `prepmask`, `checkregressors`, and `checkmap`. It uses the `numpy` library for array
504
+ operations and `matplotlib` for histogram plotting (when enabled).
505
+
506
+ Examples
507
+ --------
508
+ >>> output = qualitycheck("sub-01", graymaskspec="gray_mask.nii.gz")
509
+ >>> print(output["passes"])
510
+ 3
511
+ >>> print(output["mask"]["refinemaskrelsize"])
512
+ 0.75
513
+ """
201
514
  # read in the dataset
202
515
  thedataset = RapidtideDataset(
203
516
  "main",