rapidtide 3.0a7__py3-none-any.whl → 3.0a9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rapidtide/OrthoImageItem.py +24 -5
- rapidtide/RapidtideDataset.py +43 -4
- rapidtide/data/examples/src/testfmri +4 -15
- rapidtide/happy_supportfuncs.py +21 -0
- rapidtide/helper_classes.py +10 -1
- rapidtide/io.py +1 -1
- rapidtide/simfuncfit.py +1 -1
- rapidtide/tidepoolTemplate.py +84 -167
- rapidtide/tidepoolTemplate.ui +64 -44
- rapidtide/tidepoolTemplate_alt.py +90 -172
- rapidtide/tidepoolTemplate_alt.ui +63 -44
- rapidtide/tidepoolTemplate_alt2.ui +1965 -0
- rapidtide/tidepoolTemplate_alt_qt6.py +17 -3
- rapidtide/tidepoolTemplate_big.py +992 -0
- rapidtide/tidepoolTemplate_big.ui +2395 -0
- rapidtide/tidepoolTemplate_big_qt6.py +990 -0
- rapidtide/tidepoolTemplate_qt6.py +19 -9
- rapidtide/workflows/rapidtide.py +8 -5
- rapidtide/workflows/tidepool.py +548 -466
- {rapidtide-3.0a7.dist-info → rapidtide-3.0a9.dist-info}/METADATA +1 -1
- {rapidtide-3.0a7.dist-info → rapidtide-3.0a9.dist-info}/RECORD +25 -21
- {rapidtide-3.0a7.dist-info → rapidtide-3.0a9.dist-info}/WHEEL +1 -1
- {rapidtide-3.0a7.dist-info → rapidtide-3.0a9.dist-info}/LICENSE +0 -0
- {rapidtide-3.0a7.dist-info → rapidtide-3.0a9.dist-info}/entry_points.txt +0 -0
- {rapidtide-3.0a7.dist-info → rapidtide-3.0a9.dist-info}/top_level.txt +0 -0
rapidtide/OrthoImageItem.py
CHANGED
|
@@ -68,7 +68,16 @@ def newColorbar(left, top, impixpervoxx, impixpervoxy, imgsize):
|
|
|
68
68
|
return thecolorbarfgwin, thecolorbarbgwin, theviewbox, colorbarvals
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
def
|
|
71
|
+
def setupViewWindow(
|
|
72
|
+
view,
|
|
73
|
+
left,
|
|
74
|
+
top,
|
|
75
|
+
impixpervoxx,
|
|
76
|
+
impixpervoxy,
|
|
77
|
+
imgsize,
|
|
78
|
+
enableMouse=False,
|
|
79
|
+
):
|
|
80
|
+
|
|
72
81
|
theviewbox = view.addViewBox(enableMouse=enableMouse, enableMenu=False, lockAspect=1.0)
|
|
73
82
|
theviewbox.setAspectLocked()
|
|
74
83
|
theviewbox.setRange(QtCore.QRectF(0, 0, imgsize, imgsize), padding=0.0, disableAutoRange=True)
|
|
@@ -146,6 +155,17 @@ class OrthoImageItem(QtWidgets.QWidget):
|
|
|
146
155
|
self.offsetx = self.imgsize * (0.5 - self.xfov / (2.0 * self.maxfov))
|
|
147
156
|
self.offsety = self.imgsize * (0.5 - self.yfov / (2.0 * self.maxfov))
|
|
148
157
|
self.offsetz = self.imgsize * (0.5 - self.zfov / (2.0 * self.maxfov))
|
|
158
|
+
self.axviewbox = None
|
|
159
|
+
self.corviewbox = None
|
|
160
|
+
self.sagviewbox = None
|
|
161
|
+
self.axviewwin = None
|
|
162
|
+
self.corviewwin = None
|
|
163
|
+
self.sagviewwin = None
|
|
164
|
+
self.axviewbgwin = None
|
|
165
|
+
self.corviewbgwin = None
|
|
166
|
+
self.sagviewbgwin = None
|
|
167
|
+
self.debug = True
|
|
168
|
+
self.arrangement = arrangement
|
|
149
169
|
|
|
150
170
|
if self.verbose > 1:
|
|
151
171
|
print("OrthoImageItem initialization:")
|
|
@@ -162,7 +182,6 @@ class OrthoImageItem(QtWidgets.QWidget):
|
|
|
162
182
|
print(" Offsets:", self.offsetx, self.offsety, self.offsetz)
|
|
163
183
|
self.buttonisdown = False
|
|
164
184
|
|
|
165
|
-
self.arrangement = arrangement
|
|
166
185
|
self.axview.setBackground(None)
|
|
167
186
|
self.axview.setRange(padding=0.0)
|
|
168
187
|
self.axview.ci.layout.setContentsMargins(0, 0, 0, 0)
|
|
@@ -182,7 +201,7 @@ class OrthoImageItem(QtWidgets.QWidget):
|
|
|
182
201
|
self.axviewvLine,
|
|
183
202
|
self.axviewhLine,
|
|
184
203
|
self.axviewbox,
|
|
185
|
-
) =
|
|
204
|
+
) = setupViewWindow(
|
|
186
205
|
self.axview,
|
|
187
206
|
self.offsetx,
|
|
188
207
|
self.offsety,
|
|
@@ -197,7 +216,7 @@ class OrthoImageItem(QtWidgets.QWidget):
|
|
|
197
216
|
self.corviewvLine,
|
|
198
217
|
self.corviewhLine,
|
|
199
218
|
self.corviewbox,
|
|
200
|
-
) =
|
|
219
|
+
) = setupViewWindow(
|
|
201
220
|
self.corview,
|
|
202
221
|
self.offsetx,
|
|
203
222
|
self.offsetz,
|
|
@@ -212,7 +231,7 @@ class OrthoImageItem(QtWidgets.QWidget):
|
|
|
212
231
|
self.sagviewvLine,
|
|
213
232
|
self.sagviewhLine,
|
|
214
233
|
self.sagviewbox,
|
|
215
|
-
) =
|
|
234
|
+
) = setupViewWindow(
|
|
216
235
|
self.sagview,
|
|
217
236
|
self.offsety,
|
|
218
237
|
self.offsetz,
|
rapidtide/RapidtideDataset.py
CHANGED
|
@@ -39,6 +39,34 @@ atlases = {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
|
|
42
|
+
def check_rt_spatialmatch(dataset1, dataset2):
|
|
43
|
+
if (
|
|
44
|
+
(dataset1.xdim == dataset2.xdim)
|
|
45
|
+
and (dataset1.ydim == dataset2.ydim)
|
|
46
|
+
and (dataset1.zdim == dataset2.zdim)
|
|
47
|
+
):
|
|
48
|
+
dimmatch = True
|
|
49
|
+
else:
|
|
50
|
+
dimmatch = False
|
|
51
|
+
if (
|
|
52
|
+
(dataset1.xsize == dataset2.xsize)
|
|
53
|
+
and (dataset1.ysize == dataset2.ysize)
|
|
54
|
+
and (dataset1.zsize == dataset2.zsize)
|
|
55
|
+
):
|
|
56
|
+
sizematch = True
|
|
57
|
+
else:
|
|
58
|
+
sizematch = False
|
|
59
|
+
if dataset1.space == dataset2.space:
|
|
60
|
+
spacematch = True
|
|
61
|
+
else:
|
|
62
|
+
spacematch = False
|
|
63
|
+
if dataset1.affine == dataset2.affine:
|
|
64
|
+
affinematch = True
|
|
65
|
+
else:
|
|
66
|
+
affinematch = False
|
|
67
|
+
return dimmatch, sizematch, spacematch, affinematch
|
|
68
|
+
|
|
69
|
+
|
|
42
70
|
class Timecourse:
|
|
43
71
|
"Store a timecourse and some information about it"
|
|
44
72
|
|
|
@@ -159,6 +187,8 @@ class Overlay:
|
|
|
159
187
|
self.setGeomMask(geommask, maskdata=False)
|
|
160
188
|
self.maskData()
|
|
161
189
|
self.updateStats()
|
|
190
|
+
self.dispmin = self.robustmin
|
|
191
|
+
self.dispmax = self.robustmax
|
|
162
192
|
if init_LUT:
|
|
163
193
|
self.gradient = getagradient()
|
|
164
194
|
self.lut_state = lut_state
|
|
@@ -242,8 +272,6 @@ class Overlay:
|
|
|
242
272
|
self.pct75,
|
|
243
273
|
self.robustmax,
|
|
244
274
|
) = tide_stats.getfracvals(calcmaskeddata, [0.02, 0.25, 0.5, 0.75, 0.98], nozero=False)
|
|
245
|
-
self.dispmin = self.robustmin
|
|
246
|
-
self.dispmax = self.robustmax
|
|
247
275
|
self.histy, self.histx = np.histogram(
|
|
248
276
|
calcmaskeddata, bins=np.linspace(self.minval, self.maxval, 200)
|
|
249
277
|
)
|
|
@@ -432,6 +460,7 @@ class Overlay:
|
|
|
432
460
|
|
|
433
461
|
class RapidtideDataset:
|
|
434
462
|
"Store all the data associated with a rapidtide dataset"
|
|
463
|
+
fileroot = None
|
|
435
464
|
focusregressor = None
|
|
436
465
|
regressorfilterlimits = None
|
|
437
466
|
regressorsimcalclimits = None
|
|
@@ -451,6 +480,8 @@ class RapidtideDataset:
|
|
|
451
480
|
ysize = 0.0
|
|
452
481
|
zsize = 0.0
|
|
453
482
|
tr = 0.0
|
|
483
|
+
space = None
|
|
484
|
+
affine = None
|
|
454
485
|
|
|
455
486
|
def __init__(
|
|
456
487
|
self,
|
|
@@ -1057,7 +1088,11 @@ class RapidtideDataset:
|
|
|
1057
1088
|
return self.regressors
|
|
1058
1089
|
|
|
1059
1090
|
def setfocusregressor(self, whichregressor):
|
|
1060
|
-
|
|
1091
|
+
try:
|
|
1092
|
+
testregressor = self.regressors[whichregressor]
|
|
1093
|
+
self.focusregressor = whichregressor
|
|
1094
|
+
except KeyError:
|
|
1095
|
+
self.focusregressor = "prefilt"
|
|
1061
1096
|
|
|
1062
1097
|
def setupoverlays(self):
|
|
1063
1098
|
# load the overlays
|
|
@@ -1286,4 +1321,8 @@ class RapidtideDataset:
|
|
|
1286
1321
|
return self.overlays
|
|
1287
1322
|
|
|
1288
1323
|
def setfocusmap(self, whichmap):
|
|
1289
|
-
|
|
1324
|
+
try:
|
|
1325
|
+
testmap = self.overlays[whichmap]
|
|
1326
|
+
self.focusmap = whichmap
|
|
1327
|
+
except KeyError:
|
|
1328
|
+
self.focusmap = "lagtimes"
|
|
@@ -14,29 +14,18 @@ rapidtide \
|
|
|
14
14
|
--nprocs -1 \
|
|
15
15
|
--searchrange -5 20 \
|
|
16
16
|
--simcalcrange 50 -1 \
|
|
17
|
-
--outputlevel min \
|
|
18
17
|
--refinedelay \
|
|
19
18
|
sub-RAPIDTIDETEST.nii.gz \
|
|
20
|
-
../dst/sub-
|
|
19
|
+
../dst/sub-RAPIDTIDETEST_filt
|
|
21
20
|
|
|
22
21
|
rapidtide \
|
|
23
|
-
--spatialfilt
|
|
22
|
+
--spatialfilt 0 \
|
|
24
23
|
--nprocs -1 \
|
|
25
24
|
--searchrange -5 20 \
|
|
26
25
|
--simcalcrange 50 -1 \
|
|
27
|
-
--
|
|
28
|
-
--norefinedelay \
|
|
29
|
-
sub-RAPIDTIDETEST.nii.gz \
|
|
30
|
-
../dst/sub-RAPIDTIDETEST_norefinedelay
|
|
31
|
-
|
|
32
|
-
rapidtide \
|
|
33
|
-
--spatialfilt 5 \
|
|
34
|
-
--nprocs -1 \
|
|
35
|
-
--searchrange -5 20 \
|
|
36
|
-
--simcalcrange 50 -1 \
|
|
37
|
-
--outputlevel min \
|
|
26
|
+
--refinedelay \
|
|
38
27
|
sub-RAPIDTIDETEST.nii.gz \
|
|
39
|
-
../dst/sub-
|
|
28
|
+
../dst/sub-RAPIDTIDETEST_nofilt
|
|
40
29
|
|
|
41
30
|
#rapidtide \
|
|
42
31
|
# --spatialfilt 5 \
|
rapidtide/happy_supportfuncs.py
CHANGED
|
@@ -134,6 +134,27 @@ def calc_3d_optical_flow(video, projmask, flowhdr, outputroot, window_size=3, de
|
|
|
134
134
|
return flow_vectors
|
|
135
135
|
|
|
136
136
|
|
|
137
|
+
def phasejolt(phaseimage):
|
|
138
|
+
|
|
139
|
+
# Compute the gradient of the window in x, y, and z directions
|
|
140
|
+
grad_x, grad_y, grad_z = np.gradient(phaseimage)
|
|
141
|
+
|
|
142
|
+
# Now compute the second order gradients of the window in x, y, and z directions
|
|
143
|
+
grad_xx, grad_xy, grad_xz = np.gradient(grad_x)
|
|
144
|
+
grad_yx, grad_yy, grad_yz = np.gradient(grad_y)
|
|
145
|
+
grad_zx, grad_zy, grad_zz = np.gradient(grad_z)
|
|
146
|
+
|
|
147
|
+
# Calculate our metrics of interest
|
|
148
|
+
jump = (np.fabs(grad_x) + np.fabs(grad_y) + np.fabs(grad_z)) / 3.0
|
|
149
|
+
jolt = (
|
|
150
|
+
(np.fabs(grad_xx) + np.fabs(grad_xy) + np.fabs(grad_xz))
|
|
151
|
+
+ (np.fabs(grad_yx) + np.fabs(grad_yy) + np.fabs(grad_yz))
|
|
152
|
+
+ (np.fabs(grad_zx) + np.fabs(grad_zy) + np.fabs(grad_zz))
|
|
153
|
+
) / 9.0
|
|
154
|
+
laplacian = grad_xx + grad_yy + grad_zz
|
|
155
|
+
return (jump, jolt, laplacian)
|
|
156
|
+
|
|
157
|
+
|
|
137
158
|
def cardiacsig(thisphase, amps=(1.0, 0.0, 0.0), phases=None, overallphase=0.0):
|
|
138
159
|
total = 0.0
|
|
139
160
|
if phases is None:
|
rapidtide/helper_classes.py
CHANGED
|
@@ -691,6 +691,7 @@ class SimilarityFunctionFitter:
|
|
|
691
691
|
FML_FITWIDTHHIGH = np.uint32(0x0800)
|
|
692
692
|
FML_FITLAGLOW = np.uint32(0x1000)
|
|
693
693
|
FML_FITLAGHIGH = np.uint32(0x2000)
|
|
694
|
+
FML_FITALGOFAIL = np.uint32(0x0400)
|
|
694
695
|
FML_FITFAIL = (
|
|
695
696
|
FML_FITAMPLOW
|
|
696
697
|
| FML_FITAMPHIGH
|
|
@@ -698,6 +699,7 @@ class SimilarityFunctionFitter:
|
|
|
698
699
|
| FML_FITWIDTHHIGH
|
|
699
700
|
| FML_FITLAGLOW
|
|
700
701
|
| FML_FITLAGHIGH
|
|
702
|
+
| FML_FITALGOFAIL
|
|
701
703
|
)
|
|
702
704
|
|
|
703
705
|
def __init__(
|
|
@@ -873,6 +875,8 @@ class SimilarityFunctionFitter:
|
|
|
873
875
|
reasons.append("Fit Lag too low")
|
|
874
876
|
if failreason.astype(np.uint32) & self.FML_FITLAGHIGH:
|
|
875
877
|
reasons.append("Fit Lag too high")
|
|
878
|
+
if failreason.astype(np.uint32) & self.FML_FITALGOFAIL:
|
|
879
|
+
reasons.append("Nonlinear fit failed")
|
|
876
880
|
|
|
877
881
|
if len(reasons) > 0:
|
|
878
882
|
return ", ".join(reasons)
|
|
@@ -1119,6 +1123,7 @@ class SimilarityFunctionFitter:
|
|
|
1119
1123
|
maxlag = np.fmod((1.0 * plsq[1]), self.lagmod)
|
|
1120
1124
|
maxsigma = plsq[2]
|
|
1121
1125
|
except:
|
|
1126
|
+
failreason |= self.FML_FITALGOFAIL
|
|
1122
1127
|
maxval = np.float64(0.0)
|
|
1123
1128
|
maxlag = np.float64(0.0)
|
|
1124
1129
|
maxsigma = np.float64(0.0)
|
|
@@ -1139,6 +1144,7 @@ class SimilarityFunctionFitter:
|
|
|
1139
1144
|
maxlag = np.fmod((1.0 * plsq[1]), self.lagmod)
|
|
1140
1145
|
maxsigma = plsq[2]
|
|
1141
1146
|
except:
|
|
1147
|
+
failreason |= self.FML_FITALGOFAIL
|
|
1142
1148
|
maxval = np.float64(0.0)
|
|
1143
1149
|
maxlag = np.float64(0.0)
|
|
1144
1150
|
maxsigma = np.float64(0.0)
|
|
@@ -1173,6 +1179,7 @@ class SimilarityFunctionFitter:
|
|
|
1173
1179
|
print("poly coffs:", a, b, c)
|
|
1174
1180
|
print("maxlag, maxval, maxsigma:", maxlag, maxval, maxsigma)
|
|
1175
1181
|
except np.lib.polynomial.RankWarning:
|
|
1182
|
+
failreason |= self.FML_FITALGOFAIL
|
|
1176
1183
|
maxlag = 0.0
|
|
1177
1184
|
maxval = 0.0
|
|
1178
1185
|
maxsigma = 0.0
|
|
@@ -1219,6 +1226,7 @@ class SimilarityFunctionFitter:
|
|
|
1219
1226
|
# different rules for mutual information peaks
|
|
1220
1227
|
if ((maxval - baseline) < self.lthreshval * baselinedev) or (maxval < baseline):
|
|
1221
1228
|
failreason |= self.FML_FITAMPLOW
|
|
1229
|
+
maxval_init = 0.0
|
|
1222
1230
|
if self.debug:
|
|
1223
1231
|
if (maxval - baseline) < self.lthreshval * baselinedev:
|
|
1224
1232
|
print(
|
|
@@ -1229,7 +1237,6 @@ class SimilarityFunctionFitter:
|
|
|
1229
1237
|
)
|
|
1230
1238
|
if maxval < baseline:
|
|
1231
1239
|
print("FITAMPLOW: maxval < baseline:", maxval, baseline)
|
|
1232
|
-
maxval_init = 0.0
|
|
1233
1240
|
if self.debug:
|
|
1234
1241
|
print("bad fit amp: maxval is lower than lower limit")
|
|
1235
1242
|
if (self.lagmin > maxlag) or (maxlag > self.lagmax):
|
|
@@ -1269,6 +1276,8 @@ class SimilarityFunctionFitter:
|
|
|
1269
1276
|
maxsigma = np.float64(maxsigma_init)
|
|
1270
1277
|
if failreason != self.FML_NOERROR:
|
|
1271
1278
|
maskval = np.uint16(0)
|
|
1279
|
+
else:
|
|
1280
|
+
maskval = np.uint16(1)
|
|
1272
1281
|
|
|
1273
1282
|
if self.debug or self.displayplots:
|
|
1274
1283
|
print(
|
rapidtide/io.py
CHANGED
rapidtide/simfuncfit.py
CHANGED