Back to the main page.

Bug 2232 - external/gifti.m: cannot handle the label table from caret label files

Reported 2013-08-02 16:55:00 +0200
Modified 2014-01-15 14:45:35 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P3 normal
Assigned to: Jan-Mathijs Schoffelen
Depends on:
See also:

Jan-Mathijs Schoffelen - 2013-08-02 16:55:28 +0200

At the moment the 'high' level gifti.m function does not output potentially interesting information (i.e. the interpretation of the numeric data in terms of the parcellation's labels) when dealing with caret label files. At the moment we need to work around this by using the @gifti/private/read_gifti_file. It may be worthwile to discuss whether to make returning the label table a feature of gifti.m. I don't understand enough of the code to judge whether this may be a trivial enhancement, or whether this may break other functionality. @Guillaume: what do you think?

Guillaume - 2013-08-12 16:12:52 +0200

(In reply to comment #0) Could you add an example of a Caret label file as an attachment? Unless there is a bug, all information should be parsed appropriately (ie not ignored) but only a reduced set is available through the accessor methods. If 'g' is a MATLAB GIfTI object, you should be able to have a peek at the internal structure by typing g.private.

Jan-Mathijs Schoffelen - 2013-08-12 16:33:03 +0200

Hi Guillaume, Thanks for getting back at us about this. Indeed the g.private just gives me the info I need. Is there any particular reason why these fields are not 'visible' directly?

Guillaume - 2013-08-12 18:23:06 +0200

(In reply to comment #2) The GIfTI file format can contain many types of information and the OO methods provide a simplified access to the contents that were useful for my own needs. Plan is to add access to extra features when it appears necessary. How would you want label access to take place? * as in g.private.label, ie:{i} g.label.key(i) g.label.rgba(i,:) * or with a struct array: g.label(i).name g.label(i).key g.label(i).rgba The field 'label' would only be present if one of tha DataArray's Intent is NIFTI_INTENT_LABEL.

Jan-Mathijs Schoffelen - 2013-08-12 20:21:46 +0200

Hi Guillaume, I'd vote for option 1, i.e. g.label = Nx1 cell-array g.key = Nx1 vector g.rgba = NxM matrix But now I know how to extract the info, there's no hurry ;-).

Guillaume - 2013-08-13 17:21:16 +0200

Hi Jan-Mathijs, I made relevant modifications in SPM12 changeset r5608. Once FT version of the @gifti library is updated, change your code to use g.labels instead of g.private.label as this access is undocumented and likely to evolve.

Jan-Mathijs Schoffelen - 2013-08-13 17:27:13 +0200

great! thanks, guillaume

Jan-Mathijs Schoffelen - 2013-11-06 14:44:42 +0100

As discussed with Robert, Robert will pull the latest code from the spm svn repository (I don't have permissions there). He also will collect a series of old .gii files to ensure that the new implementation still deals with them correctly.

Robert Oostenveld - 2013-11-06 15:43:31 +0100

(In reply to comment #7) I have made some test data available on /home/common/matlab/fieldtrip/data/test/bug2232 mac001> svn commit Sending gifti/@gifti/display.m Sending gifti/@gifti/export.m Sending gifti/@gifti/fieldnames.m Sending gifti/@gifti/gifti.m Sending gifti/@gifti/private/base64decode.m Sending gifti/@gifti/private/base64encode.m Sending gifti/@gifti/private/dzip.m Sending gifti/@gifti/private/getdict.m Sending gifti/@gifti/private/isintent.m Sending gifti/@gifti/private/read_gifti_file.m Sending gifti/@gifti/save.m Sending gifti/@gifti/struct.m Sending gifti/@gifti/subsasgn.m Sending gifti/@gifti/subsref.m Sending gifti/@xmltree/Contents.m Sending gifti/@xmltree/add.m Sending gifti/@xmltree/attributes.m Sending gifti/@xmltree/branch.m Sending gifti/@xmltree/char.m Sending gifti/@xmltree/children.m Sending gifti/@xmltree/convert.m Sending gifti/@xmltree/copy.m Sending gifti/@xmltree/delete.m Sending gifti/@xmltree/display.m Sending gifti/@xmltree/editor.m Sending gifti/@xmltree/find.m Sending gifti/@xmltree/flush.m Sending gifti/@xmltree/get.m Sending gifti/@xmltree/getfilename.m Sending gifti/@xmltree/isfield.m Sending gifti/@xmltree/length.m Sending gifti/@xmltree/move.m Sending gifti/@xmltree/parent.m Sending gifti/@xmltree/private/Makefile Sending gifti/@xmltree/private/xml_findstr.c Sending gifti/@xmltree/private/xml_findstr.m Sending gifti/@xmltree/private/xml_findstr.mexa64 Sending gifti/@xmltree/private/xml_findstr.mexmaci64 Sending gifti/@xmltree/private/xml_findstr.mexw32 Sending gifti/@xmltree/private/xml_findstr.mexw64 Sending gifti/@xmltree/private/xml_parser.m Sending gifti/@xmltree/root.m Sending gifti/@xmltree/save.m Sending gifti/@xmltree/set.m Sending gifti/@xmltree/setfilename.m Sending gifti/@xmltree/view.m Sending gifti/@xmltree/xmltree.m Transmitting file data ............................................... Committed revision 8723.

Jan-Mathijs Schoffelen - 2013-11-24 10:48:05 +0100

test function created + ft_read_atlas updated revision 8840