GithubHelp home page GithubHelp logo

ielu's People

Contributors

aestrivex avatar choldgraf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ielu's Issues

BUG: Error when snapping electrodes to surface

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,)

intermittent IOError errno 0 in geometry.py/get_vox2rasxfm()

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 

Compatibility issue Python 2.7 vs Python 3.x for the code

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

Errors on basic co-registrations

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.

ENH: Add new electrode without linear interpolation

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.

ENH: Plot all grid / strip electrodes on the CT brain

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:
image

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.

run does not exist

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

Problems with using 'Examine CT' option

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

Error when manually bringing up electrodes

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: Error when open the "examine CT window"

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'

Manual steps instead of pipeline?

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 :

  • the user indicates he/she'll add a new grid n x m electrodes and indicate the fixed distance between neighboring electrodes
  • the user then manually click on an 3-view MRI on the location of some of the electrodes that are clearly identifiable
  • an algorithm fits a linear (for rigid depth electrodes) or a polynomial (for surface ECoG) functions, and predicts the location of the remaining electrodes.
  • the users confirm or adjust all electrodes locations.
    ?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.