-
Notifications
You must be signed in to change notification settings - Fork 1
/
lidc_util.py
53 lines (38 loc) · 1.08 KB
/
lidc_util.py
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
#file for getting original lidc dicom files
import numpy as np
import os
from viewdicom import viewVolume, returnNumSlices
#from resampling import resample
'''
rt = r"D:\Documents\School\2020-21\CT\LIDC-IDRI"
def get_scan_dirs(root):
print("not done yet")
root = r"D:\Documents\School\2020-21\CT\LIDC-IDRI"
dataset_count = 0
num_slices = []
for path, subdirs, files in os.walk(root):
counter = 0
for name in files:
if (name[-3: ] == 'dcm'):
counter +=1
if (counter > 50):
slicenum = returnNumSlices(path)
print(path[51:55])
dataset_count +=1
print(slicenum)
num_slices.append(slicenum)
print(dataset_count)
num_slices = np.array(num_slices)
np.save('num_slices.npy', num_slices)
#resampled = resample(path)
#np.save(os.path.join(r"Data\Out", file + ".npy"), resampled)
'''
nums = np.load('num_slices.npy')
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from scipy import stats
sns.set_style('darkgrid')
sns.distplot(nums, kde=False)
plt.show()