help > Index out of bounds error for sphere in DrawLine (BrainNet.m, line 3486) at length_cyl (line 3496)
Showing 1-4 of 4 posts
Display:
Results per page:
Aug 4, 2020  02:08 PM | davidblair8 - Universitat Pompeu Fabra
Index out of bounds error for sphere in DrawLine (BrainNet.m, line 3486) at length_cyl (line 3496)
I'm trying to visualise some brain networks with the command-line version of BrainNet Viewer, but I'm receiving a rather strange error in the function DrawLine (BrainNet.m, line 3486), at the computation for length_cyl (line 3496):

length_cyl=norm(sphere(surf.cylinder(i,2),1:3)-sphere(surf.cylinder(i,1),1:3))-sphere(surf.cylinder(i,2),7)-sphere(surf.cylinder(i,1),7);

When I debugged this line, I found that surf.cylinder(:,1) has a range [1, 79] and surf.cylinder(:,2) has a range [2, 90], while sphere has dimensions of 1x7. Thus, whenever surf.cylinder(:,1) or surf.cylinder(:,2) exceeds 1 (which is the majority of cases), the code throws an index-out-of-bounds error.

As far as I can tell, the files I use are in the same format as the example files in the BrainNet Viewer package. Thus, I'm not certain what is causing this error.  Has any experienced a similar problem?

Thanks,
David
Attachment: connMap.edge
Aug 5, 2020  04:08 AM | Mingrui Xia
RE: Index out of bounds error for sphere in DrawLine (BrainNet.m, line 3486) at length_cyl (line 3496)
Could you please also attach the node file? Thanks.

Best,
Mingrui


Originally posted by davidblair8:
I'm trying to visualise some brain networks with the command-line version of BrainNet Viewer, but I'm receiving a rather strange error in the function DrawLine (BrainNet.m, line 3486), at the computation for length_cyl (line 3496):

length_cyl=norm(sphere(surf.cylinder(i,2),1:3)-sphere(surf.cylinder(i,1),1:3))-sphere(surf.cylinder(i,2),7)-sphere(surf.cylinder(i,1),7);

When I debugged this line, I found that surf.cylinder(:,1) has a range [1, 79] and surf.cylinder(:,2) has a range [2, 90], while sphere has dimensions of 1x7. Thus, whenever surf.cylinder(:,1) or surf.cylinder(:,2) exceeds 1 (which is the majority of cases), the code throws an index-out-of-bounds error.

As far as I can tell, the files I use are in the same format as the example files in the BrainNet Viewer package. Thus, I'm not certain what is causing this error.  Has any experienced a similar problem?

Thanks,
David
Aug 5, 2020  10:08 AM | davidblair8 - Universitat Pompeu Fabra
RE: Index out of bounds error for sphere in DrawLine (BrainNet.m, line 3486) at length_cyl (line 3496)
Here's the node file.  It seems I can only attach one file per post.
I use the ICBM_152 surface file from the BrainNet Viewer archive.
Attachment: nodeMap.node
Aug 6, 2020  02:08 AM | Mingrui Xia
RE: Index out of bounds error for sphere in DrawLine (BrainNet.m, line 3486) at length_cyl (line 3496)
Please replace the spaces with dots in the label column of the node file.
 
Originally posted by davidblair8:
Here's the node file.  It seems I can only attach one file per post.
I use the ICBM_152 surface file from the BrainNet Viewer archive.