From 7b3c2c5b188551c4807437f678a246c805537133 Mon Sep 17 00:00:00 2001 From: Jersey Deng Date: Tue, 26 Jul 2016 14:51:28 -0700 Subject: [PATCH 1/2] changed files for issues --- README.md | 57 ++++++++----------- RunProjectMain.py | 4 +- .../CorrelationTables/correlation_table.py | 2 +- .../VisitInterface/CreateVolumneRenderer.py | 17 +++--- 4 files changed, 36 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index a618ce7..e3f080e 100644 --- a/README.md +++ b/README.md @@ -15,46 +15,34 @@ centroid depiction via a sphere Fig. C. ### 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 + 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) @@ -63,16 +51,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 diff --git a/RunProjectMain.py b/RunProjectMain.py index aa022e3..a6e685e 100755 --- a/RunProjectMain.py +++ b/RunProjectMain.py @@ -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") diff --git a/brain-vis/CorrelationTables/correlation_table.py b/brain-vis/CorrelationTables/correlation_table.py index d19c39a..3abdd3d 100644 --- a/brain-vis/CorrelationTables/correlation_table.py +++ b/brain-vis/CorrelationTables/correlation_table.py @@ -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]) diff --git a/brain-vis/VisitInterface/CreateVolumneRenderer.py b/brain-vis/VisitInterface/CreateVolumneRenderer.py index bad0073..0997214 100644 --- a/brain-vis/VisitInterface/CreateVolumneRenderer.py +++ b/brain-vis/VisitInterface/CreateVolumneRenderer.py @@ -3,7 +3,6 @@ import os import numpy -import vtk from numpy import * import nibabel as nib import numpy as np @@ -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): @@ -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')) @@ -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): @@ -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) @@ -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 @@ -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) @@ -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): From c7d66a5c05bbea3876ef25bc11f82990bd6328b4 Mon Sep 17 00:00:00 2001 From: Sugeerth Murugesan Date: Fri, 29 Jul 2016 11:55:27 -0700 Subject: [PATCH 2/2] graphviz --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e3f080e..b0e987f 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,8 @@ To install all the libraries for the python script to run sudo pip install nibabel==2.0.2 sudo pip install pydot3==1.0.8 sudo pip install python-louvain==0.5 - sudo pip install pygraphviz==1.3.1 + 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