-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSALTACII_MiniHelperScripts.py
More file actions
52 lines (42 loc) · 1.49 KB
/
Copy pathSALTACII_MiniHelperScripts.py
File metadata and controls
52 lines (42 loc) · 1.49 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
import SimpleITK as sitk
import sys
import os
import numpy as np
import matplotlib.pyplot as plt
import argparse
import pandas as pd
def FindLabels(patient_id):
label_mat = np.loadtxt(open("SALTACII_SegLabels.csv", "rb"), delimiter=",", skiprows=1, usecols=(1,2,3,4))
if patient_id == "SALTACII_0037":
patient_num = 36
elif patient_id == "SALTACII_0040":
patient_num = 37
else:
patient_num = int(patient_id[len(patient_id)-4:])
f_i = label_mat[patient_num-1,0]
t_i = label_mat[patient_num-1,1]
f_c = label_mat[patient_num-1,2]
t_c = label_mat[patient_num-1,3]
return f_i,t_i,f_c,t_c
def FindInjuredSide(patient_id):
side_mat = np.loadtxt(open("SALTACII_SegLabels.csv", "rb"), delimiter=",", skiprows=1, usecols=(4,5))
if patient_id == "SALTACII_0037":
patient_num = 36
elif patient_id == "SALTACII_0040":
patient_num = 37
else:
patient_num = int(patient_id[len(patient_id)-4:])
side_num = side_mat[patient_num-1,1]
return side_num
def FindMRIThreshold(patient_id):
PeakIntensity_mat = np.loadtxt(open("SALTACII_SegLabels.csv", "rb"), delimiter=",", skiprows=1, usecols=(5,6))
if patient_id == "SALTACII_0037":
patient_num = 36
elif patient_id == "SALTACII_0040":
patient_num = 37
else:
patient_num = int(patient_id[len(patient_id)-4:])
PeakIntensity = PeakIntensity_mat[patient_num-1,1]
MRI_thres = PeakIntensity*0.2
# print(MRI_thres)
return MRI_thres