rapidtide 3.0a7__py3-none-any.whl → 3.0a8__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 +25 -5
- rapidtide/RapidtideDataset.py +1 -0
- rapidtide/data/examples/src/testfmri +3 -14
- rapidtide/happy_supportfuncs.py +21 -0
- rapidtide/helper_classes.py +10 -1
- rapidtide/io.py +1 -1
- rapidtide/simfuncfit.py +1 -1
- rapidtide/tidepoolTemplate_big.ui +1888 -0
- rapidtide/workflows/tidepool.py +435 -282
- {rapidtide-3.0a7.dist-info → rapidtide-3.0a8.dist-info}/METADATA +1 -1
- {rapidtide-3.0a7.dist-info → rapidtide-3.0a8.dist-info}/RECORD +15 -14
- {rapidtide-3.0a7.dist-info → rapidtide-3.0a8.dist-info}/LICENSE +0 -0
- {rapidtide-3.0a7.dist-info → rapidtide-3.0a8.dist-info}/WHEEL +0 -0
- {rapidtide-3.0a7.dist-info → rapidtide-3.0a8.dist-info}/entry_points.txt +0 -0
- {rapidtide-3.0a7.dist-info → rapidtide-3.0a8.dist-info}/top_level.txt +0 -0
rapidtide/OrthoImageItem.py
CHANGED
|
@@ -25,6 +25,7 @@ import os
|
|
|
25
25
|
|
|
26
26
|
import numpy as np
|
|
27
27
|
import pyqtgraph as pg
|
|
28
|
+
from more_itertools.more import first
|
|
28
29
|
from pyqtgraph.Qt import QtCore, QtGui, QtWidgets
|
|
29
30
|
|
|
30
31
|
try:
|
|
@@ -68,7 +69,16 @@ def newColorbar(left, top, impixpervoxx, impixpervoxy, imgsize):
|
|
|
68
69
|
return thecolorbarfgwin, thecolorbarbgwin, theviewbox, colorbarvals
|
|
69
70
|
|
|
70
71
|
|
|
71
|
-
def
|
|
72
|
+
def setupViewWindow(
|
|
73
|
+
view,
|
|
74
|
+
left,
|
|
75
|
+
top,
|
|
76
|
+
impixpervoxx,
|
|
77
|
+
impixpervoxy,
|
|
78
|
+
imgsize,
|
|
79
|
+
enableMouse=False,
|
|
80
|
+
):
|
|
81
|
+
|
|
72
82
|
theviewbox = view.addViewBox(enableMouse=enableMouse, enableMenu=False, lockAspect=1.0)
|
|
73
83
|
theviewbox.setAspectLocked()
|
|
74
84
|
theviewbox.setRange(QtCore.QRectF(0, 0, imgsize, imgsize), padding=0.0, disableAutoRange=True)
|
|
@@ -146,6 +156,17 @@ class OrthoImageItem(QtWidgets.QWidget):
|
|
|
146
156
|
self.offsetx = self.imgsize * (0.5 - self.xfov / (2.0 * self.maxfov))
|
|
147
157
|
self.offsety = self.imgsize * (0.5 - self.yfov / (2.0 * self.maxfov))
|
|
148
158
|
self.offsetz = self.imgsize * (0.5 - self.zfov / (2.0 * self.maxfov))
|
|
159
|
+
self.axviewbox = None
|
|
160
|
+
self.corviewbox = None
|
|
161
|
+
self.sagviewbox = None
|
|
162
|
+
self.axviewwin = None
|
|
163
|
+
self.corviewwin = None
|
|
164
|
+
self.sagviewwin = None
|
|
165
|
+
self.axviewbgwin = None
|
|
166
|
+
self.corviewbgwin = None
|
|
167
|
+
self.sagviewbgwin = None
|
|
168
|
+
self.debug = True
|
|
169
|
+
self.arrangement = arrangement
|
|
149
170
|
|
|
150
171
|
if self.verbose > 1:
|
|
151
172
|
print("OrthoImageItem initialization:")
|
|
@@ -162,7 +183,6 @@ class OrthoImageItem(QtWidgets.QWidget):
|
|
|
162
183
|
print(" Offsets:", self.offsetx, self.offsety, self.offsetz)
|
|
163
184
|
self.buttonisdown = False
|
|
164
185
|
|
|
165
|
-
self.arrangement = arrangement
|
|
166
186
|
self.axview.setBackground(None)
|
|
167
187
|
self.axview.setRange(padding=0.0)
|
|
168
188
|
self.axview.ci.layout.setContentsMargins(0, 0, 0, 0)
|
|
@@ -182,7 +202,7 @@ class OrthoImageItem(QtWidgets.QWidget):
|
|
|
182
202
|
self.axviewvLine,
|
|
183
203
|
self.axviewhLine,
|
|
184
204
|
self.axviewbox,
|
|
185
|
-
) =
|
|
205
|
+
) = setupViewWindow(
|
|
186
206
|
self.axview,
|
|
187
207
|
self.offsetx,
|
|
188
208
|
self.offsety,
|
|
@@ -197,7 +217,7 @@ class OrthoImageItem(QtWidgets.QWidget):
|
|
|
197
217
|
self.corviewvLine,
|
|
198
218
|
self.corviewhLine,
|
|
199
219
|
self.corviewbox,
|
|
200
|
-
) =
|
|
220
|
+
) = setupViewWindow(
|
|
201
221
|
self.corview,
|
|
202
222
|
self.offsetx,
|
|
203
223
|
self.offsetz,
|
|
@@ -212,7 +232,7 @@ class OrthoImageItem(QtWidgets.QWidget):
|
|
|
212
232
|
self.sagviewvLine,
|
|
213
233
|
self.sagviewhLine,
|
|
214
234
|
self.sagviewbox,
|
|
215
|
-
) =
|
|
235
|
+
) = setupViewWindow(
|
|
216
236
|
self.sagview,
|
|
217
237
|
self.offsety,
|
|
218
238
|
self.offsetz,
|
rapidtide/RapidtideDataset.py
CHANGED
|
@@ -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
|
-
--outputlevel min \
|
|
28
26
|
--norefinedelay \
|
|
29
27
|
sub-RAPIDTIDETEST.nii.gz \
|
|
30
|
-
../dst/sub-
|
|
31
|
-
|
|
32
|
-
rapidtide \
|
|
33
|
-
--spatialfilt 5 \
|
|
34
|
-
--nprocs -1 \
|
|
35
|
-
--searchrange -5 20 \
|
|
36
|
-
--simcalcrange 50 -1 \
|
|
37
|
-
--outputlevel min \
|
|
38
|
-
sub-RAPIDTIDETEST.nii.gz \
|
|
39
|
-
../dst/sub-RAPIDTIDETEST_noption
|
|
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