Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 25 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,35 @@ centroid depiction via a sphere Fig. C.
<!--![ScreenShot](http://s32.postimg.org/blbh7yllh/Anatomical_Diagram_Page_1.jpg)-->

### Required dependencies ###

PySide
networkx
nibabel
numpy
pygraphviz
communtiy
PyVTK

################################

numpy
networkx
nibabel
pydot
community
pygraphviz
vtk
PySide
decorator

################################


### Installation Procedure ###

To install all the libraries for the python script to run


1) Install all the source files from the requirements folder in the same order

pip install numpy==1.11.0

pip install decorator>=3.4.0

pip install networkx==1.11

pip install nibabel==2.0.2

pip install pydot3==1.0.8

pip install python-louvain==0.4

pip install pygraphviz==1.3.1

pip install PyVTK==0.5.18

sudo pip install numpy==1.11.0
sudo pip install networkx==1.11
sudo pip install nibabel==2.0.2
sudo pip install pydot3==1.0.8
sudo pip install python-louvain==0.5
Install Graphviz through the graphviz website--(http://www.graphviz.org)
sudo pip install pygraphviz==1.3.1
sudo pip install vtk (if the version bundled with pip does not include the vtkNiftiImageReader function, you must install a version that does)
sudo pip install qt-sdk; sudo pip install PySide
sudo pip install decorator>=3.4.0

The links might have changed be aware of it
Links to source code for libraries in case the libraries bundled with your distribution are not the right versions. The links might have changed so be aware of it:

[Numpy](https://sourceforge.net/projects/numpy/files/NumPy/1.11.0/numpy-1.11.0.tar.gz/download)`
[Decorator](https://pypi.python.org/packages/68/04/621a0f896544814ce6c6a0e6bc01d19fc41d245d4515a2e4cf9e07a45a12/decorator-4.0.9.tar.gz#md5=f12c5651ccd707e12a0abaa4f76cd69a)
Expand All @@ -63,16 +52,19 @@ The links might have changed be aware of it
[Louvain](https://pypi.python.org/packages/5d/81/497a95ba9d79d5bf04f9318256d1c0102329dd6a77b9d1e4dd84871e1089/python-louvain-0.5.tar.gz)
[PyDot](https://pypi.python.org/pypi/pydot3/1.0.8)
[PyGraphViz](https://pypi.python.org/packages/98/bb/a32e33f7665b921c926209305dde66fe41003a4ad934b10efb7c1211a419/pygraphviz-1.3.1.tar.gz#md5=7f690295dfe77edaa9e552d09d98d279)
Note: If after installing, "import pygraphviz" returns an error, then uninstall and reinstall using: pip install pygraphviz --install-option="--include-path=/usr/local/include/graphviz" --install-option="--library-path=/usr/local/lib/graphviz/" (https://github.com/pygraphviz/pygraphviz/issues/72)
[VTK and PyVTK](http://kazenotaiyo.blogspot.com/2010/06/installing-vtk-in-ubuntu-and-making.html)

and then, type python and paste these commands
import numpy
import networkx
import nibabel
import pydot3
import python-louvain
import pydot
import community
import pygraphviz
import vtk
import PySide
import decorator
If none of them returns an error then you are set

2) Configure the data paths in BrainViewerDataPaths.py
Expand Down
4 changes: 2 additions & 2 deletions RunProjectMain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
If you made it this far congrats!!
CHANGE the paths below to visit and your directory
"""
os.environ["PYTHONPATH"] = "/YOUR_PATH_TO_THE_INSTALLATION_DIRECTORY/brain-vis"
os.system("python /YOUR_PATH_TO_THE_INSTALLATION_DIRECTORY/brain-vis/BrainViewer.py")

os.system("python /data/mridata/jdeng/tools/modulyzer/brain-vis/BrainViewer.py")
2 changes: 1 addition & 1 deletion brain-vis/CorrelationTables/correlation_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, filename,dataProcess=None):
self.RegionName = []

with open(filename, 'rb') as csvfile:
reader = csv.reader(csvfile, delimiter=' ', quotechar='\'')
reader = csv.reader(csvfile, delimiter=',', quotechar='\'')
self.header = reader.next()
self.RegionName.append((self.header))
self.data=np.array([map(float, line) for line in reader])
Expand Down
17 changes: 9 additions & 8 deletions brain-vis/VisitInterface/CreateVolumneRenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os
import numpy

import vtk
from numpy import *
import nibabel as nib
import numpy as np
Expand Down Expand Up @@ -135,7 +134,7 @@ def __init__(self,parcelation_filename, template_filename,correlationTable,selec
source.SetCenter(0, 0, 0)
source.SetRadius(5.0)

self.FinalRenderView()
#self.FinalRenderView()
self.show()

def setCentreFilename(self):
Expand All @@ -145,7 +144,8 @@ def setCentreFilename(self):
which is very much dataset specific
"""

self.CentrePath = os.environ['PYTHONPATH'].split(os.pathsep)
#self.CentrePath = os.environ['PYTHONPATH'].split(os.pathsep)
self.CentrePath = '/data/mridata/jdeng/tools/modulyzer/brain-vis'.split(os.pathsep)
head, tail = os.path.split(self.parcelation_filename)
tail = tail.replace(".","")
CenterFile = '%s%s'% (str(tail),str('CentreFile.csv'))
Expand Down Expand Up @@ -667,7 +667,7 @@ def addSliceZ(self):
self.renderWin.GetInteractor().Render()

def updateSliceZ(self):
if not(self.toggleThreeSlicesFlag):
if not(self.toggleThreeSlicesFlag):
return

if not(self.Slices[2]== None):
Expand Down Expand Up @@ -703,7 +703,7 @@ def removeSpheres(self):
def addParcels(self):
self.removeParcels()
self.Parcel = []
for i in range(self.nRegions):
for i in range(1, self.nRegions):
dmc =vtk.vtkDiscreteMarchingCubes()
dmc.SetInputConnection(self.ParcelationReader.GetOutputPort())
dmc.GenerateValues(i,i,i)
Expand Down Expand Up @@ -736,7 +736,7 @@ def addParcels(self):
def addSpheres(self):
self.removeSpheres()
self.SphereActors = []
for i in range(self.nRegions):
for i in range(1, self.nRegions):
source = vtk.vtkSphereSource()
# random position and radius
x = float(self.Centroid[i][0])* self.PixX
Expand Down Expand Up @@ -783,8 +783,9 @@ def addSpheres(self):


def UpdateSpheres(self, Visibility):
for i in range(self.nRegions):
for i in range(self.nRegions-1):
if self.SphereActors:
#import pdb; pdb.set_trace()
actor = self.SphereActors[i]
if not(Visibility):
actor.GetProperty().SetOpacity(0)
Expand All @@ -804,7 +805,7 @@ def UpdateSpheres(self, Visibility):
self.renderWin.GetInteractor().Render()

def UpdateParcels(self,Visibility):
for i in range(self.nRegions):
for i in range(self.nRegions-1):
if self.Parcel:
actor = self.Parcel[i]
if not(Visibility):
Expand Down