This repository was archived by the owner on Mar 18, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFJA_calculation_folder.py
More file actions
61 lines (45 loc) · 1.76 KB
/
Copy pathFJA_calculation_folder.py
File metadata and controls
61 lines (45 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import sys
import os
import os.path as osp
import numpy as np
from glob import glob
import pyvista as pv
import descriptors_utils as dut
from matplotlib import pyplot as plt
import pandas as pd
# -----------------------------------------------------------------------------------------------------------------------
rootDir=r'D:\InletProfileStudy\SSM\Output_2024\Circular\synthetic_cohort_first8modes' # path to synthetic files or sampled profiles
# IVP_number = '002'
# IVP_path = osp.join(rootDir,IVP_number)
# vtp_path = osp.join(IVP_path, '*.vtp')
# os.makedirs(Out_Dir, exist_ok=True)
#-----------------------------------------------------------------------------------------------------------------------
## Read IVPs
folders = [f.path for f in os.scandir(rootDir) if f.is_dir()]
fja_sum = 0
fdi_sum = 0
fja = []
for folder in folders:
vtp_path=osp.join(folder, '*.vtp')
input_vtps = pv.read(sorted(glob((vtp_path))))
## PPV calculation
PPV_all = dut.compute_positive_peak_velocity(input_vtps)
## FJA calculation
FJA_all=dut.compute_flow_jet_angle(input_vtps)
## FDI calculation
FDI_all = dut.compute_flow_dispersion(input_vtps)
## SFD calculation
SFD_all = dut.compute_secondary_flow_degree(input_vtps)
## HFI calculation
HFI_all = dut.compute_helical_flow_index(input_vtps)
fja.append(FJA_all['fja_systole_mean'])
fja_sum += FJA_all['fja_systole_mean']
fdi_sum += FDI_all['fdi_mean']
avg_fja = fja_sum/len(folders)
avg_fdi = fdi_sum/len(folders)
print('Average FJA:', avg_fja)
print('Min and max FJA:', min(fja), max(fja))
print('Average FDI:', avg_fdi)
# ## Plot
# input_vtps[5].plot(scalars='Velocity',clim=[0,0.5],cmap='jet')
# input_vtps[5].warp_by_vector(factor=0.5).plot(scalars='Velocity',clim=[0,0.5],cmap='jet')