view.py 756 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import pydicom
  2. import numpy as np
  3. import matplotlib.pyplot as plt
  4. import os
  5. import csv
  6. import math
  7. x = []
  8. y = []
  9. c = []
  10. a = []
  11. b = []
  12. c = []
  13. d = []
  14. first = True
  15. with open("mimx.csv") as f:
  16. for row in csv.reader(f, delimiter=","):
  17. if first or len(row) < 9:
  18. first = False
  19. continue
  20. x.append(int(row[4]))
  21. y.append(int(row[6]))
  22. a.append(int(row[7]))
  23. b.append(int(row[8]))
  24. c.append(int(row[9]))
  25. d.append(int(row[10]))
  26. def showHisto(items, n="?"):
  27. h = [0 for x in range(1 + max(items))]
  28. for i in items:
  29. h[i] += 1
  30. xs = list(range(len(h)))
  31. plt.plot(xs, [math.log(i + 1) for i in h], label=n)
  32. #plt.scatter(x,y,c=c)
  33. showHisto(a, "A")
  34. showHisto(b, "B")
  35. showHisto(c, "C")
  36. showHisto(d, "D")
  37. plt.show()