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
WIP : ugly hack to fix the read_annot when parcellation has missing values #194
Conversation
Thanks for this. Can you think of a test? |
Can the freesurfer guys give any comment on this one? |
I guess this looks reasonable. I can't think of a clean way to handle it :/ |
Is it worth raising a warning here? |
Also maybe add a boolean argument to the function to "fix" incomplete annotations (a default value of |
I am -1 for the boolean argument. I've just updated the docstring that was All the lines are covered by tests but It's hard to add a test as the I think we can live with it :) On Fri, Aug 23, 2013 at 6:41 PM, Michael Waskom notifications@github.comwrote:
|
How hard would it be to create a tiny sample file for testing? |
the freesurfer module has no data for testing and the default freesurfer |
How about gzipping it down to 20K? We do that for the DICOM files, for example. We can't easily write annot files I guess? |
does it mean my annot reader need to support .gz files? Can you give a
Indeed. We don't have writers. |
Well - you would need to support file objects... Maybe that is a worthwhile change to
That way you get file-like objects as input for free... |
ok I'll give it a try asap |
should be good to go after some clarification from doug on the freesurfer ML there was a real bug with orig_ids=False :-/ luckily pysurfer uses orig_ids=True... I am now wondering if we should not deprecate orig_ids=False ... cc @mwaskom |
btw I forced push after squashing my commits |
I don't understand the issues here :( Are you now testing the orig_ids=False code path with 0s? |
It turns out that the annot provided by freesurfer also has 0 values. Is was just unnoticed before ... |
…g_ids=False. Vertices with 0 label were randomly merged with the first entry in the colortable
see my last change in test (squashed) |
Please forgive me - I must be confused. Am I right in thinking there are no extra tests for the orid_ids=False code path in this PR? |
Try the test with master. It should fail |
It does. I understand why now; you are testing the labels for Are you happy with this fix? What about deprecating |
Sorry as I'm in New York on vacation I haven't had time to fully wrap my
Is there a reason we can't make the undefined region NaN? On Tue, Aug 27, 2013 at 6:20 PM, Matthew Brett notifications@github.comwrote:
|
indeed
fair enough. But we have now -1 in label which is not a valid index.
yes. NaN cannot be in an integer array such as label. |
Sorry again, i'm probably missing something obvious, but do we do something On Wed, Aug 28, 2013 at 3:13 AM, Alexandre Gramfort <
|
it could but it's kind of ugly to store indices as floats |
Sorry - closed by accident. |
so? what's our status? |
OK I think your point about float indices being janky is correct. I guess So I am +1 on -1 :) On Thu, Aug 29, 2013 at 2:39 AM, Alexandre Gramfort <
|
matthew feel free to merge if you approve is there a place to mention bug fixes? release notes? |
For bug fix mentions - can you add something to the Changelog about this? I make the release notes from the Changelog file. |
I don't see any current devel section in changelog. can you take care of it? note:
thanks |
MRG : ugly hack to fix the read_annot when parcellation has missing values The issue comes with annot that have missing values ie that don't cover the entire cortex.
Hi With this hack, I am getting a type error at the following line: labels[mask] = ord[np.searchsorted(ctab[ord, -1], labels[mask])] TypeError: array cannot be safely cast to required type Thanks |
Can you point us to an example file with which we can replicate the problem? Thanks for any help in debugging this. |
hi, do you get this with any annot? what numpy version are you using? if it's A On Thu, Sep 26, 2013 at 4:52 AM, sanadeem notifications@github.com wrote:
|
weird I do: In [8]: import nibabel as nib and everything works fine. Can you debug in ipython to figure out the type |
Apparently the error doesn't occur with numpy 1.7.1 and only occurs with the assignment operation of |
good to know but we cannot forget this anyway. Could you find out what the thanks |
Interesting - in a numpy 1.6.0 virtualenv, I get this:
On my desktop machine running numpy 1.6.2 python 2.7, the same command gives:
|
Interesting. On another machine with a clean installation of nibabel, with numpy 1.6.2 and python 2.7, |
I found another weird thing. When everything is working fine, the last conditional statement doesn't seem to go through when orig_ids=False. I have verified this on three different machines. |
I am sorry I cannot reproduce these failures :( |
MRG : ugly hack to fix the read_annot when parcellation has missing values The issue comes with annot that have missing values ie that don't cover the entire cortex.
the issue comes with annot that have missing values ie that don't cover the entire cortex. One issue I don't know how to address it that there is no np.nan for integers and we index at 0 for indexing with colortab output.
any hint welcome
addresses #189
cc @mwaskom