Add files via upload

This commit is contained in:
mathur04
2024-05-14 13:38:35 +02:00
committed by GitHub
parent 8667824470
commit 27e5cc3aed
2 changed files with 47 additions and 0 deletions

23
SAFT/main.py Normal file
View File

@ -0,0 +1,23 @@
from util import *
from algo import *
"""
The A value of the algorithm is the sound speed divided by the frequency or 0.059 mm, which gives about 17 samples per mm.
The B value considered for this results 0,35 mm which corresponds the resolution of our transducer x-y scanning driving system.
Dans le cas de notre etude avec le dataset Shear_transform, nous avons des fréquences nominales de 55 kHz (ondes de cisaillement)
measurement was performed using a sampling rate of 2 MHz
"""
if __name__ == "__main__":
dossier = "Dataset/Shear_transform"
fichiers_selectionnes = ['Shear_x001-x101_y{:03d}_Rot00_transform.csv'.format(i) for i in range(10, 62)]
pre_volume = np.array(lire_fichier_csv(dossier, fichiers_selectionnes))
volume = pre_volume[:, ::4, :]
image = volume[0, :, :]
win = 10
A = 1
B = 1
# Application de l'algorithme SAFT
result = saft_algorithm(image, win, A, B)

24
SAFT/util.py Normal file
View File

@ -0,0 +1,24 @@
import csv
import os
def lire_un_fichier_csv(data):
tableau_2D = []
tab = []
with open(data, "r") as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',')
for ligne in csv_reader:
tableau_2D.append(ligne)
for i in range(len(tableau_2D[0])):
ligne = []
for j in range(len(tableau_2D)):
ligne.append(float(tableau_2D[j][i]))
tab.append(ligne)
return tab
def lire_fichier_csv(data,fichier):
resultat=[]
tableau=[]
for i in fichier:
tableau=lire_un_fichier_csv(os.path.join(data,i))
resultat.append(tableau)
return resultat