In [1]:
%matplotlib inline
from matplotlib import pyplot as plt
import numpy
import csv
In [2]:
data = open('../data/data.csv', 'r').readlines()
fieldnames = ['x', 'y', 'z', 'unmasked', 'synapses']
reader = csv.reader(data)
reader.next()
rows = [[int(col) for col in row] for row in reader]
sorted_x = sorted(list(set([r[0] for r in rows])))
sorted_y = sorted(list(set([r[1] for r in rows])))
sorted_z = sorted(list(set([r[2] for r in rows])))
In [3]:
volume = numpy.ndarray((len(sorted_x), len(sorted_y), len(sorted_z)))
In [4]:
for row in rows:
if row[-1] != 0:
volume[sorted_x.index(row[0]), sorted_y.index(row[1]), sorted_z.index(row[2])] = row[-1]
In [5]:
plt.imshow(numpy.amax(volume, axis=0), interpolation='nearest')
plt.xlabel("Image Z-axis")
plt.ylabel("Image Y-axis")
plt.title("MIP Down X Axis")
plt.show()
In [6]:
plt.imshow(numpy.amax(volume, axis=1), interpolation='nearest')
plt.xlabel("Image Z-axis")
plt.ylabel("Image X-axis")
plt.title("MIP Down Y Axis")
plt.show()
In [7]:
plt.imshow(numpy.amax(volume, axis=2), interpolation='nearest', )
plt.xlabel("Image Y-axis")
plt.ylabel("Image X-axis")
plt.title("MIP Down Z Axis")
plt.show()
In [ ]: