<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Dear Pjotr,
<div class=""><br class="">
</div>
<div class="">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.</div>
<div class=""><br class="">
</div>
<div class="">
<div>Best wishes and keep up the good work,</div>
<div>Jan-Mathijs</div>
<div><br class="">
</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 22 Dec 2020, at 01:01, Piotr Gawroński <<a href="mailto:piotr.gawronski@student.uj.edu.pl" class="">piotr.gawronski@student.uj.edu.pl</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
Dear community,
<div class=""><br class="">
</div>
<div class="">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.</div>
<div class="">Here I would like to ask about remove_vertices function behaviour.</div>
<div class="">I used matlab 2020a.</div>
<div class=""><br class="">
</div>
<div class="">When I export model with texture, I get error informing me about invalid texture size:</div>
<div class=""><br class="">
</div>
<div class="">Error using refine (line 72)</div>
<div class="">invalid size of texture</div>
<div class=""><br class="">
</div>
<div class="">Error in ft_read_headshape (line 1001)</div>
<div class="">[shape.pos, shape.tri, texture] = refine(shape.pos, shape.tri,...</div>
<div class=""><br class="">
</div>
<div class="">Error in lokalizacja_elektrod (line 30)</div>
<div class="">head_surface = ft_read_headshape(sciezka_model)</div>
<div class=""><br class="">
</div>
<div class="">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.</div>
<div class="">When</div>
<div class="">[posR, triR, removetri] = remove_vertices(pos, tri, removepos)</div>
<div class="">is replaced  with</div>
<div class="">[posR, triR, txR, removetri] = remove_vertices_NEW(pos, tri, removepos, tx)</div>
<div class=""><br class="">
</div>
<div class="">and one line added, that is:</div>
<div class="">% remove the vertices and triangles</div>
<div class="">...</div>
<div class="">txR = tx(keeppos,:);</div>
<div class=""><br class="">
</div>
<div class="">then only it is possible to read in the model with its texture.</div>
<div class=""><br class="">
</div>
<div class="">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.</div>
<div class=""><br class="">
</div>
<div class="">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.</div>
<div class=""><br class="">
</div>
Regards<br class="">
Piotr Gawroński</div>
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">fieldtrip
 mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="https://doi.org/10.1371/journal.pcbi.1002202" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://doi.org/10.1371/journal.pcbi.1002202</a></div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>