[FieldTrip] 3d scan with structure sensor - remove_vertices seems not to remove corresponding texture indices

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Tue Dec 22 09:28:20 CET 2020


Dear Pjotr,

The *.obj fileformat is quite flexible, and indeed may look different, depending on the hardware used and the user's behavior while creating it. The current fieldtrip code has been built based on a particular user scenario, and hardware. It could well be that it does not smoothly cover your use case. I think that your diagnosis (both in this e-mail and in the other one) is extremely valuable in making the code more robust. I think it would be very helpful if you create an issue about this on github (you points can be put into a single issue), and a skeleton PR can be created with a version of the changes that you suggested. Moreover, it would be good to send us (through dropbox, weshare, google drive whatever) a small set of files that caused you problems ,so that we can use it for testing purposes. Also, it would be useful to have a small test script that demonstrates that the intended code changes don’t break existing (correct) behavior. For an example file, you could make an 3D scan of an apple or so, because apples typically don’t have privacy issues.

Best wishes and keep up the good work,
Jan-Mathijs


On 22 Dec 2020, at 01:01, Piotr Gawroński <piotr.gawronski at student.uj.edu.pl<mailto:piotr.gawronski at student.uj.edu.pl>> wrote:

Dear community,

I am a new user of fieldtriptoolbox and have followed your tutorial on how to localize electrodes using 3D scanner, specifically using structure sensor by Occipital. I have encountered two issues and I adress each of these in separate e-mails.
Here I would like to ask about remove_vertices function behaviour.
I used matlab 2020a.

When I export model with texture, I get error informing me about invalid texture size:

Error using refine (line 72)
invalid size of texture

Error in ft_read_headshape (line 1001)
[shape.pos, shape.tri, texture] = refine(shape.pos, shape.tri,...

Error in lokalizacja_elektrod (line 30)
head_surface = ft_read_headshape(sciezka_model)

After some time I managed to find what I understand produces that error - that is, remove_vertices removes (in my case) one  un-used vertice it finds, but it seems to never remove texture vertice associated with the removed geometrical vertice. This results in different sizes of texture and vertice arrays.
When
[posR, triR, removetri] = remove_vertices(pos, tri, removepos)
is replaced  with
[posR, triR, txR, removetri] = remove_vertices_NEW(pos, tri, removepos, tx)

and one line added, that is:
% remove the vertices and triangles
...
txR = tx(keeppos,:);

then only it is possible to read in the model with its texture.

I am not however  sure (due to lack of in-depth knowledge of 3d meshes) whether it is a  bug or desired behaviour, which I do not fully comprehend. I understood that remove_vertice removes geometrical vertices which are unused by any face.

I have not reported it as an issue on github, as I am not certain whether it is a bug,as I have mentioned already.

Regards
Piotr Gawroński
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20201222/99299b7b/attachment.htm>


More information about the fieldtrip mailing list