Closed cleemesser closed 8 years ago
Thanks for the report.
That's a very strange error, which I have never encountered and would never have found. I don't have any idea why you're getting it and I'm not (on several different machines). But your patch cannot hurt.
thanks!
Thanks. It seems to happen when my laptop is under load. I tried replicating it in isolation, but it never reproduced the error in isolation (just calling get_vox2rasxfm() on my data or on sample data) but it happened reproducibly when running the whole pipeline on my 2012 macbookpro
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.wait() # \ here is the update ** i = 0 for ln in ps.stdout: try: loc = np.array(map(float, ln.strip('()[]\n').split())) except: continue