Skip to content

Commit 579d894

Browse files
authored
Merge branch 'jamieboss:main' into main
2 parents 7486ae9 + b44a61e commit 579d894

File tree

5 files changed

+30
-12
lines changed

5 files changed

+30
-12
lines changed

.DS_Store

0 Bytes
Binary file not shown.

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# R21-doppler
2+
## Running the program
3+
Open and run the file 'cbfFull.py'.
4+
5+
Follow the prompts to:
6+
- Select the folderpath containing the videos to be analyzed.
7+
- Input a name for the excel file to be generated by the program.
8+
- Select the method of analysis (Doppler will analyzed only videos for blood flow velocity, Colormode will additionally analyze videos for vessel diameters).
9+
- Select the files to be analyzed. Multiple baseline or hyperemic Doppler videos should be selected all at once. For Colormode analysis, only one baseline and hyperemic colormode file each should be selected.
10+
- If Colormode analysis was selected, input the probe angle and maximum/minimum penetration depth (indicated below).
11+
12+
![colormodeInput](https://user-images.githubusercontent.com/57882373/155819942-1d9129f0-d193-47d9-a8d1-dffbfb441b31.png)
13+
14+
The program will automatically parse each video file into a single image and attempt to binarize the image in order to capture the Doppler envelope and remove. The user can verify or adjust this threshold value in the 'Scroll Test' window that appears (shown below).
15+
16+
<img width="1294" alt="Screen Shot 2022-02-25 at 7 11 06 PM" src="https://user-images.githubusercontent.com/57882373/155819957-1ebce476-8267-4cd3-8fe0-07033c30fc15.png">
17+
18+
The program will complete its analysis and output the following files:
19+
- An excel file with the input name containing all calculated data points. This will be in the same directory as the analyzed video files.
20+
- Images named using the input file name + "_#", labeled in the order that video files were analyzed. These images label the following data points for each cardiac cycle: beginning of cycle (green), peak velocity (yellow), decay velocity (pink), peak diastolic deceleration (red), and end of cycle (blue).
21+
- For colormode analysis, images named "baseline_###" and "hyperemic_###", with numbers corresponding to that image's identified vessel diameter.
-34 Bytes
Binary file not shown.

cbfFull.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
#Select folder containing video files to be analyzed
3030
root = tkinter.Tk()
3131
root.withdraw()
32-
#folderpath = filedialog.askdirectory(parent = root, initialdir = "/", title = "Select Folder Path")
33-
folderpath = '/Users/jamieb/Documents/videos'
32+
folderpath = filedialog.askdirectory(parent = root, initialdir = "/", title = "Select Folder Path")
3433

3534
#Input filename where doppler analysis results will be stored
3635
savefile = filedialog.asksaveasfilename(parent = root, initialdir = folderpath, title = "Save Results As:")
@@ -72,7 +71,6 @@
7271
pics.append(pictureBL)
7372
TP.append(timeperpixelBL)
7473
velocityMax.append(maxVel) #Store maximum velocity
75-
print('MaxVel: ' + str(maxVel))
7674

7775

7876

@@ -261,10 +259,10 @@
261259
count+=1
262260

263261
#View ecg peaks
264-
peakImg = ecgRegionBinary
265-
peakImg.T[locs] = 255
266-
filenamepeak = 'peaks' + str(countALL) + '.png'
267-
cv2.imwrite(filenamepeak, peakImg)
262+
#peakImg = ecgRegionBinary
263+
#peakImg.T[locs] = 255
264+
#filenamepeak = 'peaks' + str(countALL) + '.png'
265+
#cv2.imwrite(filenamepeak, peakImg)
268266

269267
#Calculate beats-per-minute
270268
bpm = []
@@ -332,7 +330,7 @@
332330
#Diastolic velocity or beginning of diastolic phase (BD)
333331
fifteenCycle = (timeCycle[-1]-timeCycle[0]) * .075 #7.5% of total beat duration
334332
fifteenWinStart = timeCycle[PDAloc] - fifteenCycle #Time 7.5% prior to peak
335-
k
333+
336334
index15 = np.argmin([abs(x - fifteenWinStart) for x in timeCycle]) #Find index of time closest to %7.5
337335
DV1vel = min(filtEnvelope[index15:PDAloc+1]) #Decay velocity
338336
DV1time = timeCycle[[i for i, x in enumerate(filtEnvelope) if x == DV1vel][0]] #Decay velocity time

vevoAVIparser.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def parse(videoFile):
7575

7676
#Values depending on video size
7777
##Note: [slider bar row, slider bar column, temperature black-out, Vevo logo black-out, slide bar minimum]
78-
print('height: ' + str(height) + ' width: ' + str(width))
78+
#print('height: ' + str(height) + ' width: ' + str(width))
7979
if width == 880 and height == 666:
8080
values = [378, 772, 830, 34, 500]
8181
elif width == 1168 and height == 864:
@@ -89,7 +89,7 @@ def parse(videoFile):
8989
else:
9090
#Default values
9191
values = [round(0.567 * height), round(0.875 * width), round(0.895 * width), round(0.125*height)-67, 1000]
92-
print('Using values: ' + str(values))
92+
#print('Using values: ' + str(values))
9393

9494

9595

@@ -221,7 +221,6 @@ def parse(videoFile):
221221
newsplitscroll.append(index + c)
222222

223223
newsplitscroll = list(dict.fromkeys(newsplitscroll))
224-
print(newsplitscroll)
225224

226225
###Merge images around slider bar reset
227226
newFirst = []
@@ -273,6 +272,6 @@ def parse(videoFile):
273272
wholeSequence = wholeSequence[values[3]-1:, :] #Remove Vevo logo
274273
(c, length) = wholeSequence.shape #Find pixel length of image
275274
timeperpixel = length / duration / 10 #Calculate time-per-pixel
276-
cv2.imwrite('test.png', wholeSequence) #View parsed image
275+
#cv2.imwrite('test.png', wholeSequence) #View parsed image
277276

278277
return wholeSequence, timeperpixel, maxVel

0 commit comments

Comments
 (0)