Hi @djarecka,
thank you for your quick reply! I have to correct myself: I was previously running the code step by step using the python debugger pdb, which produced the error message you see in my first post.
Running the code all at one, I get the following error message for edge_key = "weight"
File "nbs_try.py", line 38, in <module>
network,pval,files = nbs.run()
File "/usr/local/lib/python3.6/site-packages/nipype/interfaces/base.py", line 1081, in run
runtime = self._run_wrapper(runtime)
File "/usr/local/lib/python3.6/site-packages/nipype/interfaces/base.py", line 1029, in _run_wrapper
runtime = self._run_interface(runtime)
File "/usr/local/lib/python3.6/site-packages/nipype/interfaces/cmtk/nbs.py", line 90, in _run_interface
PVAL, ADJ, _ = nbs.compute_nbs(X, Y, THRESH, K, TAIL)
NameError: name 'nbs' is not defined
Interface NetworkBasedStatistic failed to run.
I went to the respective script and I am guessing it is not importing the cviewer as it should in line 24 of this https://github.com/nipy/nipype/blob/3c3d2e9bc5e5f288b8dc7d13e6d4d2f8a44576f5/nipype/interfaces/cmtk/nbs.py#L27
When I don’t set an edge_key, i.e. run it with the default key, as well as with any other key, I get the following message, where (enter edge_key here) ist the edge_key that I provide.
File "nbs_try.py", line 36, in <module>
nbs = cmtk.NetworkBasedStatistic()
File "/usr/local/lib/python3.6/site-packages/nipype/interfaces/base.py", line 1081, in run
runtime = self._run_wrapper(runtime)
File "/usr/local/lib/python3.6/site-packages/nipype/interfaces/base.py", line 1029, in _run_wrapper
runtime = self._run_interface(runtime)
File "/usr/local/lib/python3.6/site-packages/nipype/interfaces/cmtk/nbs.py", line 87, in _run_interface
X = ntwks_to_matrices(self.inputs.in_group1, edge_key)
File "/usr/local/lib/python3.6/site-packages/nipype/interfaces/cmtk/nbs.py", line 35, in ntwks_to_matrices
graph[u][v]['weight'] = d[edge_key] # Setting the edge requested edge value as weight value
KeyError: '(*enter edge_key here*)\nInterface NetworkBasedStatistic failed to run. '
I should add that I am running the code on a Mac - I thought using nypipe I might get around the problem of the connectome viewer suggesting to install on Debian. Thinking that might the problem, I set everything to run on Virtual Box running Debian as described in: http://www.connectomics.org/viewer/documentation/users/installation.html
Running it on that machine, I get the following error message:
brain@neurodebian:~/share$ sudo python nbs_try.py
Traceback (most recent call last):
File "nbs_try.py", line 46, in <module>
network,pval,files = nbs.run()
File "/usr/lib/python2.7/dist-packages/nipype/interfaces/base.py", line 1033, in run
runtime = self._run_wrapper(runtime)
File "/usr/lib/python2.7/dist-packages/nipype/interfaces/base.py", line 983, in _run_wrapper
runtime = self._run_interface(runtime)
File "/usr/lib/python2.7/dist-packages/nipype/interfaces/cmtk/nbs.py", line 87, in _run_interface
PVAL, ADJ, _ = nbs.compute_nbs(X, Y, THRESH, K, TAIL)
File "/usr/lib/pymodules/python2.7/cviewer/libs/pyconto/groupstatistics/nbs/_nbs.py", line 173, in compute_nbs
nr_edges_per_component = np.zeros( len(comp_list) )
TypeError: object of type 'generator' has no len()
Interface NetworkBasedStatistic failed to run.
You can reproduce the problem by simply creating random matrices. Replace the readcsv line in the code from above by graph = np.random.rand(69,68)
.
Thanks a lot for your help!