Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setting up and testing pypi delivery #9

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
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
89 changes: 0 additions & 89 deletions .gitignore

This file was deleted.

2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include versioneer.py
include conwhat/_version.py
11 changes: 5 additions & 6 deletions conwhat/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

__all__ = [ 'VolTractAtlas', 'VolConnAtlas', 'StreamTractAtlas', 'StreamConnAtlas' ]


__version__ = '0.1.dev0'


from atlas import (VolTractAtlas,VolConnAtlas,
from .atlas import (VolTractAtlas,VolConnAtlas,
StreamTractAtlas,StreamConnAtlas)


from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
15 changes: 15 additions & 0 deletions conwhat/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@



def main():
"Entry point."

raise NotImplementedError('The command line interface for ConWhAt is not currently supported. '
'Please use it via API in a script or jupyter notebook. \n'
'Example usages : \n'
'from conwhat import StreamConnAtlas \n'
'from conwhat import VolConnAtlas \n'
'')

if __name__ == '__main__':
main()
40 changes: 26 additions & 14 deletions conwhat/atlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

# Author: John Griffiths
# License: simplified BSD
from __future__ import print_function

import os

Expand All @@ -14,17 +15,17 @@

from nilearn.plotting import plot_glass_brain

from utils.readers import (load_connectivity,load_vol_file_mappings,load_vol_bboxes,
from .utils.readers import (load_connectivity,load_vol_file_mappings,load_vol_bboxes,
load_stream_file_mappings,load_stream_bboxes,
make_nx_graph,dpy_to_trk)

from utils.stats import (compute_vol_hit_stats,compute_vol_scalar_stats,
from .utils.stats import (compute_vol_hit_stats,compute_vol_scalar_stats,
compute_streams_in_roi,#compute_stream_hit_stats,compute_stream_scalar_stats,
hit_stats_to_nx)

#from viz.network import plot_network,plot_matrix
#from viz.volume import plot_vol_cnxn,plot_vol_tract
#from viz.streams import plot_stream_cnxn,plot_stream_tract
from .viz.network import plot_network, plot_matrix
from .viz.volume import plot_vol_cnxn, plot_vol_tract
from .viz.streams import plot_stream_cnxn, plot_stream_tract



Expand All @@ -38,7 +39,7 @@ class _Atlas(): # object):

def __init__(self):

print 'blah'
print('blah')


class _VolAtlas(_Atlas):
Expand All @@ -61,6 +62,7 @@ def __init__(self,atlas_name=None,atlas_dir=None):
self.vfms,self.atlas_dir = load_vol_file_mappings(atlas_name=atlas_name,atlas_dir=atlas_dir)
self.bbox = load_vol_bboxes(atlas_name=atlas_name,atlas_dir=atlas_dir)

self.scalar_stats = dict()

def get_vol_from_vfm(self,idx):
"""
Expand All @@ -79,10 +81,10 @@ def get_vol_from_vfm(self,idx):

if os.path.isfile(nii_file):
if (np.isnan(volnum) or volnum == 'nan'):
print 'getting atlas entry %s: image file %s' %(idx,nii_file)
print('getting atlas entry {}: image file {} ' % (idx,nii_file))
img = nib.load(nii_file)
else:
print 'getting atlas entry %s: volume %s from image file %s' %(idx,volnum,nii_file)
print('getting atlas entry {}: volume %s from image file {}' % (idx,volnum,nii_file))
img = index_img(nii_file,volnum)

return img
Expand Down Expand Up @@ -174,7 +176,8 @@ def compute_hit_stats(self,roi,idxs,n_jobs=1,run_type='simple',joblib_cache_dir=
def plot_tract(self,atlas_name):

# (uses plotting param defaults tuned to JHU atlas)
plot_tract()
# plot_tract()
raise NotImplementedError



Expand Down Expand Up @@ -207,6 +210,8 @@ def __init__(self,atlas_dir=None,atlas_name=None):
# Compile node and connectivity info into a networkx graph
self.Gnx = make_nx_graph(self.vfms,self.bbox,ws,rls,hs,ctx)

self.modcons = dict()


@property
def weights(self):
Expand Down Expand Up @@ -282,13 +287,17 @@ def get_vol_from_rois(self,roi1,roi2):
return img


def modify_vol_connectome(self):

raise NotImplementedError

def modify_connectome(self, name='mc1',function=''):
"""
Modify canonical connectome using hit or scalar
stats, and store in this obj
"""

res = modify_vol_connectome()
res = self.modify_vol_connectome()

self.modcons[name] = res

Expand Down Expand Up @@ -398,7 +407,7 @@ def __init__(self,atlas_name=None,atlas_dir=None):

def write_subset_to_trk(self,ref_file,outfile,stream_inds='all'):

print 'writing streams to trk file: %s' %outfile
print('writing streams to trk file: {}' % outfile)
dpy_to_trk(self.dpy_file,ref_file,outfile,inds=stream_inds)


Expand Down Expand Up @@ -444,6 +453,8 @@ def __init__(self,atlas_name=None,atlas_dir=None):
# Compile node and connectivity info into a networkx graph
self.Gnx = make_nx_graph(self.sfms,self.bbox,ws,rls,hs,ctx)

self.modcons = dict()



def get_rois_from_idx(self,idx):
Expand Down Expand Up @@ -484,15 +495,16 @@ def compute_hit_stats(self,roi,idxs,n_jobs=1,run_type='simple',joblib_cache_dir=




def modify_stream_connectome(self):
raise NotImplementedError

def modify_connectome(self, name='mc1',function=''):
"""
Modify canonical connectome using hit or scalar
stats, and store in this obj
"""

res = modify_stream_connectome()
res = self.modify_stream_connectome()

self.modcons[name] = res

Expand Down Expand Up @@ -521,7 +533,7 @@ def plot_matrix(self):

def plot_cnxns(self):

plot_stream_cnxns()
plot_stream_cnxn()



15 changes: 9 additions & 6 deletions conwhat/utils/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,20 +388,23 @@ def calc_streams_in_roi(dpy_file,roi_dat,stream_idxs):



def compute_vol_scalar_stats():
def compute_vol_scalar_stats(params):

print 'computing vol scalar stats'
print('computing vol scalar stats')
raise NotImplementedError


def compute_stream_hit_stats():
def compute_stream_hit_stats(params):

print 'computing stream hit stats'
print('computing stream hit stats')
raise NotImplementedError


def compute_stream_scalar_stats():
def compute_stream_scalar_stats(params):

print('computing stream scalar stats')
raise NotImplementedError

print 'computing stream scalar stats'



Expand Down
7 changes: 5 additions & 2 deletions conwhat/viz/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@

def plot_network():

print 'plotting network'
print('plotting network')

return


def plot_matrix():

print 'plotting matrix'
print('plotting matrix')

return



8 changes: 5 additions & 3 deletions conwhat/viz/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def get_track_vis_pic(trk_file, length=None,bg_image=None,bz=None, sc='/tmp/movi
if tr:
cmd += ' -s -r %s' %tr

if tc:
if tc:
cmd += ' -c %s ' %tc
if aa: cmd+= ' -aa '

Expand All @@ -74,11 +74,13 @@ def get_track_vis_pic(trk_file, length=None,bg_image=None,bz=None, sc='/tmp/movi

def plot_stream_cnxn():

print 'plotting streamlinetric connection'
print('plotting streamlinetric connection')
raise NotImplementedError


def plot_stream_tract():

print 'plotting streamlinetric tract'
print('plotting streamlinetric tract')
raise NotImplementedError


8 changes: 8 additions & 0 deletions conwhat/viz/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,11 @@ def plot_vol_and_rois_nilearn(vol,labels,roi1_img=None,roi2_img=None,
return display


def plot_vol_cnxn():
""

raise NotImplementedError

def plot_vol_tract():

raise NotImplementedError
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ nilearn
dipy
joblib
matplotlib
sklearn
pyyaml
networkx
indexed_gzip
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
VCS = git
style = pep440
versionfile_source = conwhat/_version.py
versionfile_build = _version.py
versionfile_build = conwhat/_version.py
tag_prefix =
parentdir_prefix = conwhat-
Loading