In [1]:
import os
PATH="/Users/gui/claritycontrol/code/scripts/" # use your own path
os.chdir(PATH)
import clearity as cl # I wrote this module for easier operations on data
import clearity.resources as rs
import csv,gc # garbage memory collection :)
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d
import jgraph as ig
import plotly
import plotly.plotly as py
import plotly.graph_objs as go
%matplotlib inline
In [3]:
c = cl.Clarity('Fear197')
#fname = rs.HIST_DATA_PATH+token+".csv"
claritycsv = c.loadNiiImg().imgToPoints(threshold=0.1,sample=0.11).savePoints()
#np.savetxt(token,claritycsv,delimiter=',')
print "Fear197.csv saved."
del c
gc.collect()
Out[3]:
In [ ]:
c = cl.Clarity('globaleq')
#fname = rs.HIST_DATA_PATH+token+".csv"
claritycsv = c.loadEqImg().imgToPoints(threshold=0.99,sample=0.008).savePoints()
#np.savetxt(token,claritycsv,delimiter=',')
print "globaleq.csv saved."
del c
gc.collect()
In [7]:
import nibabel as nb
fear197 = nb.load('../data/raw/Fear197.nii')
globaleq = nb.load('../data/raw/globaleq.nii')
print fear197.shape
print globaleq.shape
In [3]:
c = cl.Clarity('localeq')
#fname = rs.HIST_DATA_PATH+token+".csv"
claritycsv = c.loadEqImg().imgToPoints(threshold=0.1,sample=0.11).savePoints()
#np.savetxt(token,claritycsv,delimiter=',')
print "Fear197.csv saved."
del c
gc.collect()
In [99]:
thedata = np.genfromtxt('../data/points/Fear197.csv', delimiter=',', dtype='int', usecols = (0,1,2), names=['a','b','c'])
trace1 = go.Scatter3d(
x = thedata['a'],
y = thedata['b'],
z = thedata['c'],
mode='markers',
marker=dict(
size=1,
color='purple', # set color to an array/list of desired values
colorscale='Viridis', # choose a colorscale
opacity=0.05
)
)
data = [trace1]
layout = go.Layout(
margin=dict(
l=0,
r=0,
b=0,
t=0
)
)
fig = go.Figure(data=data, layout=layout)
print "Fear197"
py.iplot(fig, filename= "Fear197")
Out[99]:
In [ ]:
thedata = np.genfromtxt('../data/points/globaleq.csv', delimiter=',', dtype='int', usecols = (0,1,2), names=['a','b','c'])
trace1 = go.Scatter3d(
x = thedata['a'],
y = thedata['b'],
z = thedata['c'],
mode='markers',
marker=dict(
size=1,
color='purple', # set color to an array/list of desired values
colorscale='Viridis', # choose a colorscale
opacity=0.05
)
)
data = [trace1]
layout = go.Layout(
margin=dict(
l=0,
r=0,
b=0,
t=0
)
)
fig = go.Figure(data=data, layout=layout)
print "globaleq"
py.iplot(fig, filename= "globaleq")
In [ ]:
thedata = np.genfromtxt('../data/points/localeq.csv', delimiter=',', dtype='int', usecols = (0,1,2), names=['a','b','c'])
trace1 = go.Scatter3d(
x = thedata['a'],
y = thedata['b'],
z = thedata['c'],
mode='markers',
marker=dict(
size=1,
color='purple', # set color to an array/list of desired values
colorscale='Viridis', # choose a colorscale
opacity=0.05
)
)
data = [trace1]
layout = go.Layout(
margin=dict(
l=0,
r=0,
b=0,
t=0
)
)
fig = go.Figure(data=data, layout=layout)
print "localeq"
py.iplot(fig, filename= "localeq")