Back to the main page.
Bug 3435 - Syntax error using vol2mesh
Status | CLOSED FIXED |
Reported | 2018-07-02 21:27:00 +0200 |
Modified | 2019-08-10 12:37:18 +0200 |
Product: | FieldTrip |
Component: | core |
Version: | unspecified |
Hardware: | PC |
Operating System: | Linux |
Importance: | P5 normal |
Assigned to: | |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Jiaming - 2018-07-02 21:27:27 +0200
Line 73 of prepare_mesh_tetrahedral.m It seems that the code tries to feed an isovalue (which is defined in Line 72) to vol2mesh. If my understanding is correct, the use of vol2mesh [node, elem, face] = vol2mesh(seg, 1:mri.dim(1), 1:mri.dim(2), 1:mri.dim(3), 2, 2, isovalue); is incorrect, according to the documentation fo vol2mesh. I'd suggest changing the line to: [node, elem, face] = vol2mesh(seg, 1:mri.dim(1), 1:mri.dim(2), 1:mri.dim(3), 2, 2,1,'cgalsurf', isovalue);
Jan-Mathijs Schoffelen - 2018-11-21 15:30:56 +0100
Hi Simon, could you look into this? Thanks, JM
Simon - 2018-11-21 17:23:12 +0100
So investigated prepare_mesh_tetrahedral line 72. Indeed i found an incorrect usage of vol2mesh. It is used as followed: isovalue = 0.5; [node, elem, face] = vol2mesh(seg, 1:mri.dim(1), 1:mri.dim(2), 1:mri.dim(3), 2, 2, isovalue); However, looking into vol2mesh i found this usage: vol2mesh(img,ix,iy,iz,opt,maxvol,dofix,method,isovalues) According to the code we parsed the value 0.5 into dofix, and method and isovalues is left empty. However, dofix is a binary. So I looked into vol2mesh. In line 60 an IF starts. Here is were the incorrect usage of vol2mesh is dealt with, with nargin=7 we end in line 65. So I propose to change line 72, to make the behaviour more explicit, and consistent with the documentation. This will not change the output of prepare_mesh_tetrahedral. Pull request is coming!
Jan-Mathijs Schoffelen - 2018-11-22 17:06:48 +0100
Thanks Simon! I have approved the PR, will close this for now. Jiaming feel free to reopen if the problem persists.