aestrivex / ielu Goto Github PK
View Code? Open in Web Editor NEWgrids and strips electrode localization utility
License: GNU General Public License v3.0
grids and strips electrode localization utility
License: GNU General Public License v3.0
Another bug popped up - after I sort the electrodes and run snap electrodes to surface
, I get the following error:
File "/home/knight/holdgraf/anaconda/lib/python2.7/site-packages/pyface/ui/qt4/action/action_item.py", line 160, in _qt4_on_triggered
self.controller.perform(action)
File "/home/knight/holdgraf/anaconda/lib/python2.7/site-packages/traitsui/qt4/ui_base.py", line 138, in perform
self.ui.do_undoable( self._perform, action )
File "/home/knight/holdgraf/anaconda/lib/python2.7/site-packages/traitsui/ui.py", line 715, in do_undoable
action( *args, **kw )
File "/home/knight/holdgraf/anaconda/lib/python2.7/site-packages/traitsui/qt4/ui_base.py", line 158, in _perform
method()
File "gselu.py", line 1840, in do_snap
self.model.snap_all()
File "gselu.py", line 784, in snap_all
subject=self.subject, max_steps=self.nr_steps)
File "/home/knight/holdgraf/src/python/gselu/pipeline.py", line 1584, in snap_electrodes_to_surface
hist,_ = np.histogram(neighbor_dists, bins=(max-min)/2, range=(min, max))
File "/home/knight/holdgraf/anaconda/lib/python2.7/site-packages/numpy/lib/function_base.py", line 249, in histogram
n += np.bincount(indices, weights=tmp_w, minlength=bins).astype(ntype)
ValueError: operands could not be broadcast together with shapes (9,) (10,) (9,)
Hello,
Thank you for publishing your code. I have been trying it out with some of our preop/post-op MRIs and CT. I frequently got an IOError errno 0 in geometry.py with get_vox2rasxfm(). It appeared that sometimes the python code would try to read from the pipe ps.stdout before freesurfer's mri_info had completed.
It did not look like a streaming read was needed so I fixed this by inserting a wait() call to assure that the command had completed before iterating through the lines of output.
-Chris Lee-Messer
Would you like a pull request? Here is the updated code:
def get_vox2rasxfm(volume, stem='vox2ras'):
import subprocess
ps = subprocess.Popen(['mri_info','--%s'%stem,volume],
stdout=subprocess.PIPE)
vox2ras = np.zeros((4,4))
ps.wait() # ** here is the update **
i = 0
for ln in ps.stdout:
try:
loc = np.array(map(float, ln.strip('()[]\n').split()))
except:
continue
vox2ras[i,:] = loc
i+=1
return vox2ras
Sir,
I am a graduate student at Virginia Tech trying to implement your IELU pipeline. The problem I keep running into is that your code is written in Python 2.7 (forgive me if I'm grossly mistaken) whereas the few dependencies like PyMCubes which come with your package are all in Python 3.x. The main error I keep getting for now is that the super function needs at least 1 argument whereas the code passes 0 arguments (conforming to the python 3.x syntax standards). I believe that this is only one of the numerous problems I face while trying the implementation. I have spent two weeks trying to find a way around this. I request you to help me with a possible solution soon.
Thank you
Hey there - this looks like a useful tool. I've been trying to get it to work with some of the MRI/CT files we've got in the lab, but I'm having a hard time making it through the pipeline
without running into errors. In particular, right now I get the following error after the pipeline runs for a few minutes:
File "gselu.py", line 1653, in _run_pipeline_button_fired
self.model.run_pipeline()
File "gselu.py", line 426, in run_pipeline
aff = self.acquire_affine()
File "gselu.py", line 335, in acquire_affine
zf_override=self.zoom_factor_override)
File "/home/knight/holdgraf/src/gselu/pipeline.py", line 1335, in register_ct_using_zoom_correction
print 'resampling image with zoom_factor %.2f'%zoom_factor
TypeError: float argument required, not TraitListObject
Not sure if that's useful, but I'm not familiar with the code at all so it's tough to debug on my end right now. Maybe once I get more acquainted with it. Either way, wanted to give you a heads up now in case it's a bug.
I've been trying to add electrodes manually, but can't figure out how to do this. Right now, clicking "add blank electrode" seems to assume that you want to do some sort of linear interpolation. It would be much better to allow you to click on the CT manually to say where the electrodes are.
If I add a new blank electrode, then click on the "place manually" dropdown button, I get this error:
File "/home/knight/holdgraf/anaconda/lib/python2.7/site-packages/pyface/ui/qt4/action/action_item.py", line 160, in _qt4_on_triggered
self.controller.perform(action)
File "/home/knight/holdgraf/anaconda/lib/python2.7/site-packages/traitsui/qt4/ui_base.py", line 138, in perform
self.ui.do_undoable( self._perform, action )
File "/home/knight/holdgraf/anaconda/lib/python2.7/site-packages/traitsui/ui.py", line 715, in do_undoable
action( *args, **kw )
File "/home/knight/holdgraf/anaconda/lib/python2.7/site-packages/traitsui/qt4/ui_base.py", line 143, in _perform
method( self.ui.info )
File "/home/knight/holdgraf/src/python/gselu/electrode.py", line 560, in do_manual_reposition
x,y,z = self.cur_sel.asct()
ValueError: need more than 0 values to unpack
Perhaps a simple quick fix to this would be to specify a default x/y/z point at the center of the CT.
It would be really useful to have a plot similar to the current 3D MRI plots, but for the 2D locations on the brain. (like the plot that comes up when you select "manually modify electrode position", but where it shows all electrodes for a grid rather than just one). Most ecog people I know wouldn't trust an automatic electrode extraction algorithm without looking at the raw positions chosen on the CT brain.
E.g., I've found that the extraction algorithm often misses the centroid of electrodes by 5-10 pixels on a slice. In this case because it's actually 2 electrodes next to each other:
Alternatively, if you could quickly choose an electrode in the list, and have its position pop up in the CT, then this would be useful as well. That way, you could quickly scroll through the electrodes and make sure each one was positioned correctly. As it is now, clicking "manually modify electrode position" will bring up a new window every time.
When running the program for the first time, the instructions are incorrect -- there is nothing called run
to initiate the program. You need to run ./ielu
in the bin directory. Please update the instructions. Also, maybe obvious, but the instructions should include that you must first run python setup.py install
Hi,
When I try to use the 'Examine CT' function, I get an error which says 'no module named enable.component_editor'. I searched about it and now I think that I need a specific version of some graphics library to make it work. I am not sure but it looks like I just need the right version of some software. Would you be able to tell what I should do?
Thanks a lot
Sparsh
subject "lew" has erroneous matrix representation (registration procedure)
I keep getting an error when I bring up the "Examine electrodes" window. Oftentimes when it comes up, clicking on any of the rows (where each row is an electrode) results in this error:
File "/home/knight/holdgraf/anaconda/lib/python2.7/site-packages/traits/trait_notifiers.py", line 520, in _dispatch_change_event
self.dispatch( handler, *args )
File "/home/knight/holdgraf/anaconda/lib/python2.7/site-packages/traits/trait_notifiers.py", line 483, in dispatch
handler( *args )
File "gselu.py", line 1429, in update_single_glyph
raise ValueError('Error in figuring out what point was clicked')
ValueError: Error in figuring out what point was clicked
Moreover, if I click on an electrode and then do "operations -> Manually modify electrode position", nothing pops up and I get this error:
File "/home/knight/holdgraf/anaconda/lib/python2.7/site-packages/pyface/ui/qt4/action/action_item.py", line 160, in _qt4_on_triggered
self.controller.perform(action)
File "/home/knight/holdgraf/anaconda/lib/python2.7/site-packages/traitsui/qt4/ui_base.py", line 138, in perform
self.ui.do_undoable( self._perform, action )
File "/home/knight/holdgraf/anaconda/lib/python2.7/site-packages/traitsui/ui.py", line 715, in do_undoable
action( *args, **kw )
File "/home/knight/holdgraf/anaconda/lib/python2.7/site-packages/traitsui/qt4/ui_base.py", line 143, in _perform
method( self.ui.info )
File "/home/knight/holdgraf/src/python/gselu/electrode.py", line 566, in do_manual_reposition
ras_coords=True)
File "/home/knight/holdgraf/src/python/gselu/panel2d.py", line 546, in drop_pin
_,_,affine = self.images[image_name]
KeyError: 't1'
Note that this is after running the pipeline.
This doesn't always happen. Any idea what might be going on?
Bug just started popping up - when I open a CT scan and select "Examine CT" I get the following error:
Traceback (most recent call last):
File "/home/knight/holdgraf/anaconda/lib/python2.7/site-packages/pyface/ui/qt4/action/action_item.py", line 160, in _qt4_on_triggered
self.controller.perform(action)
File "/home/knight/holdgraf/anaconda/lib/python2.7/site-packages/traitsui/qt4/ui_base.py", line 138, in perform
self.ui.do_undoable( self._perform, action )
File "/home/knight/holdgraf/anaconda/lib/python2.7/site-packages/traitsui/ui.py", line 715, in do_undoable
action( *args, **kw )
File "/home/knight/holdgraf/anaconda/lib/python2.7/site-packages/traitsui/qt4/ui_base.py", line 158, in _perform
method()
File "gselu.py", line 1845, in do_examine_ct
pd = self.construct_panel2d()
AttributeError: 'iEEGCoregistrationFrame' object has no attribute 'construct_panel2d'
Hi @aestrivex, cc @choldgraf
Sorry if this is not the best place to discuss this.
I am trying to find a robust solution to detect the location of intracranial electrodes from MRI and not CT. As you know, this kind of detection is much more difficult than with CT because it relies on a noisy MRI dropout.
From what I see, your current API makes use of an automatic electrode localization.
Would it be conceivable to build a GUI with an MRI viewer so that :
This process could also make use of small tricks: e.g plot both the coregistered pre-op and post-op MRI, as well as their differences so as to highlight the electrodes locations, incorporate the location of the cortical surfaces in the fitting to bias the prediction towards particular locations etc.
There already are some interactive MRI viewers here and there, so such enhancement would mainly require work for the online fitting and prediction of the electrodes given specific dimensions and partial locations.
Of course, I'd be happy to help, but I'll need a bit of direction to interact with your code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.