Back to the main page.

Bug 2024 - ft_volumelookup cannot create masks based on anatomical labels alone

Status CLOSED FIXED
Reported 2013-03-04 11:58:00 +0100
Modified 2019-08-10 12:28:12 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 normal
Assigned to: Arjen Stolk
URL:
Tags:
Depends on: 172518431846
Blocks:
See also: http://bugzilla.fcdonders.nl/show_bug.cgi?id=2003

Arjen Stolk - 2013-03-04 11:58:36 +0100

source.dim = [121 145 121]; source.transform = ... [-1.5000 0 0 91.5000; ... 0.0000 1.5000 0.0000 -127.5000; ... -0.0000 -0.0000 1.5000 -73.5000; ... 0 0 0 1.0000]; cfg = []; cfg.roi = 'Calcarine_R'; % right V1 cfg.inputcoord = 'mni'; cfg.atlas = '/home/common/matlab/fieldtrip/template/atlas/aal/ROI_MNI_V4.nii'; mask = ft_volumelookup(cfg, source); >> find(mask>0) ans = Empty matrix: 0-by-1 [atlas] = ft_prepare_atlas('/home/common/matlab/fieldtrip/template/atlas/aal/ROI_MNI_V4.nii'); The labels are not present in variable 'atlas'. And not in the viewer: cfg = []; cfg.method = 'ortho'; cfg.funparameter = 'brick0'; cfg.funcolormap ='jet'; ft_sourceplot(cfg, atlas)


Arjen Stolk - 2013-03-04 12:02:47 +0100

ft_read_atlas, however, does contain the labels. atlas = ft_read_atlas('/home/common/matlab/fieldtrip/template/atlas/aal/ROI_MNI_V4.nii') Rescaling NIFTI: slope = 1, intercept = 0 atlas = dim: [91 109 91] hdr: [1x1 struct] transform: [4x4 double] unit: 'mm' tissue: [91x109x91 double] tissuelabel: {1x116 cell} >> atlas.tissuelabel{1} ans = Precentral_L


Jörn M. Horschig - 2013-03-04 12:11:20 +0100

I'm a bit surprised that the labels are there in ft_read_atlas, see bug 2003. When I tried reading it in, the labels were completely empty


Arjen Stolk - 2013-03-04 12:17:09 +0100

Yep, they seem to be now. :) In fact, it seems that the corresponding voxels to those labels are also present in the 'tissue' field (or 'brick0' field in case of afni atlas). Just they are not yet in the correct space (cf. dim fields of the examples)


Arjen Stolk - 2013-03-04 12:59:19 +0100

The problem seems to pertain only to the WFU/AAL atlas. The AFNI atlas seems to work fine: source.dim = [121 145 121]; source.transform = ... [-1.5000 0 0 91.5000; ... 0.0000 1.5000 0.0000 -127.5000; ... -0.0000 -0.0000 1.5000 -73.5000; ... 0 0 0 1.0000]; cfg = []; cfg.roi = 'Hippocampus'; cfg.inputcoord = 'mni'; cfg.atlas = '/home/common/matlab/fieldtrip/template/atlas/afni/TTatlas+tlrc.HEAD'; mask = ft_volumelookup(cfg, source); found 1 matching anatomical labels constructing mask for Hippocampus 791 voxels in mask, which is 0.037 % of total volume


Arjen Stolk - 2013-03-04 13:12:50 +0100

The problem with the AAL atlas occurs at line 616 of ft_prepare_atlas. A line of text is read from text file in the /template/atlas/aal dir. [num, rem] = strtok(tline, 9); num = FAG whereas it should be '2001' in this case, is my guess (see line below). tline = FAG Precentral_L 2001 because of this, the anatomical region will not be assigned to the output structure.


Arjen Stolk - 2013-03-04 13:21:27 +0100

Created attachment 431 AAL lookup test


Arjen Stolk - 2013-03-04 13:22:37 +0100

changed [num, rem] = strtok(tline, 9); [str, rem] = strtok(tline, 9); into C = textscan(tline,'%s'); num = C{1}{3}; str = C{1}{2}; around line 616


Jörn M. Horschig - 2013-03-04 13:49:39 +0100

ok, this was the exact same issue in bug 2003 ;) I'll mark that as a duplicate then


Jörn M. Horschig - 2013-03-04 13:50:17 +0100

*** Bug 2003 has been marked as a duplicate of this bug. ***


Robert Oostenveld - 2013-03-04 14:06:10 +0100

(In reply to comment #9) @Arjen and/or Jorn Could we have a test script for the aal and afni atlas that are included in the FT release? Could you please review http://fieldtrip.fcdonders.nl/template/atlas for correctness and clarity?


Arjen Stolk - 2014-01-29 16:11:48 +0100

committed (new version of) test_ft_volumelookup & went through the text on that wiki page, changing: aal = ft_read_atlas('fieldtrip/template/atlas/ROI_MNI_V4.nii') into aal = ft_read_atlas('fieldtrip/template/atlas/aal/ROI_MNI_V4.nii')


Robert Oostenveld - 2019-08-10 12:28:12 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue describing the issue on https://github.com/fieldtrip/fieldtrip/issues.