Closed ftadel closed 4 years ago
@ftadel, sorry for the delay, was attending a conference last week.
are you sure you can not call mwpath without input? I just tried it in matlab 2010, 2016 and octave 4.2 and it returns the temporary path - which is [tempdir filesep 'iso2mesh-' getenv('UserName')]
, for example, on my Linux machine, I have
>> mwpath
ans = /tmp/iso2mesh-fangq/
on my Windows machine, I have
>> mwpath
ans =
C:\Users\fangq\AppData\Local\Temp\iso2mesh-fangq\
can you confirm if you are able to repeat these? if not, can you send me a sample test so that I can see the crash? thanks
Hi Qianqian,
The problem comes from when the variable ISO2MESH_TEMP is set but fname empty. The variable "p" is not empty, the returned path is "tempname=[p filesep session fname];", which can't be evaluated.
>> mwpath
Not enough input arguments.
Error in mwpath (line 58)
tempname=[p filesep session fname];
Thanks for looking into this. Francois
FYI: We are integrating into Brainstorm (https://neuroimage.usc.edu/brainstorm) new FEM forward models for EEG and MEG that rely on iso2mesh, SimNIBS and duneuro.
We set up an automatic download the last stable release of iso2mesh from sourceforge (eg for windows: https://downloads.sourceforge.net/project/iso2mesh/iso2mesh/1.9.0-1%20%28Iso2Mesh%202018%29/iso2mesh-2018-win32.zip?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fiso2mesh%2Ffiles%2Fiso2mesh%2F1.9.0-1%2520%2528Iso2Mesh%25202018%2529%2Fiso2mesh-2018-win32.zip%2Fdownload%3Fuse_mirror%3Diweb%26r%3Dhttps%253A%252F%252Fsourceforge.net%252Fprojects%252Fiso2mesh%252Ffiles%252Fiso2mesh%252F1.9.0-1%252520%252528Iso2Mesh%2525202018%252529%252Fiso2mesh-2018-win32.zip&ts=1568212385)
Is it ok to proceed this way? How often do you release new versions? Is there a way to get noticed when you release a new version, so that we can update the download link?
@ftadel, that makes sense, the patch is accepted and merged.
I am also excited to hear the plan of integrating iso2mesh with brainstorm.
Regarding the release frequency, embarrassingly, I have not been making a lot of releases, despite constantly updating the software. I will establish a fixed release schedule, like my other projects, and hopefully make updates more frequent (at least once or twice a year).
One way to get notified is to click on the "Watch" link at the top of this github repo, and select "Release only". Every time I add a new release, you should be able to get an email.
By the way, if you go to the release tab, the latest one I "unofficially" released was made on Oct last year, when I packaged this toolbox for Fedora. You may download the .zip or .gz file, although the package contains pre-compiled binaries for all platforms. If you prefer, I can also upload separate packages for Linux/Windows/Mac for that particular release, so you can redirect your download link.
By the way, the brain mesh shown in the screenshot looks awesome! was this generated by iso2mesh or SimNIBS (which I believe was built upon mri2mesh)?
I just want to mention about our recently accepted brain2mesh paper:
https://www.biorxiv.org/content/10.1101/2020.02.07.939447v1
the associated brain2mesh toolbox is basically a single matlab script (that heavily depends on iso2mesh)
http://mcx.space/brain2mesh/ https://github.com/fangq/brain2mesh
there are many things we can do with iso2mesh for brain meshing. with brain2mesh, we hope to create a fully automated path for high-quality mesh generation (from multi-labeled seg. and SPM outputs). Currently, the code works for most segmentation we tested, but in some minor cases, it may need some manual tuning. If you are interested, I am happy to polish the code a bit more and make it available to brainstorm.
If you prefer, I can also upload separate packages for Linux/Windows/Mac for that particular release, so you can redirect your download link.
At the moment, Brainstorm downloads automatically the platform-specific binaries from sourceforge: https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/process/functions/process_generate_fem.m#L950
It's best this way, because the download size is smaller. But I guess it's not a major problem to have all the platforms in the same .zip, since the all-in-one package is not too big anyway. But it would require some adaptations of the downloader/installer. It would be great if we could setup a logic that we keep for the future (either separate platform packages, or all-in-one).
If you have time to repackage the different OS separately for release 1.9.1, could you also include the last modification to mwpath, so that we can use mergesurf? It would be awesome! (at the moment it crashes because of mwpath, and we have to use mergemesh instead)
Note that we've had issues downloading files from the github servers with older versions of Java (ie. older versions of Matlab), so sourceforge could be a better file storage, in case this is not much extra work.
By the way, the brain mesh shown in the screenshot looks awesome! was this generated by iso2mesh or SimNIBS (which I believe was built upon mri2mesh)?
The mesh was created with SimNIBS/headreco. I haven't dug into SimNIBS much, so I don't know which library is used. Maybe @tmedani or @juangpc know about this?
the associated brain2mesh toolbox is basically a single matlab script (that heavily depends on iso2mesh)
Thanks for pointing this out! We will try it and maybe add it as a third option for generating tetra meshes needed for our FEM forward modeling (so far we're using either SimNIBS/headreco from the T1/T2 images, or iso2mesh/surf2mesh from surface layers obtained in various ways).
Hi, we use the "headreco" tool within SimNIBS, which relies on spm and cat12. mri2mesh is still available but headreco seems to work a bit better. But @tmedani knows much more.
Hello,
@juangpc, yes, indeed, we are using headreco instead of mri2mesh, since the last relies on freesurfer and FSL, then it's limited to Linux OS. headreco is based on spm and cat and it's for all platforms, so it's more interesting for us.
Also, headreco output mesh includes the whole head, whereas mri2mesh mesh only the top part of the head. Regarding the execution time mri2mesh (~10hours) is slower than headreco (~2hours ).
About the volume meshing, headreco calls the netgen libraries from gmsh.
In Brainstorm, we have added an option that can generate the tetra mesh from the nested surfaces by calling the iso2mesh toolbox (mainly the surf2mesh function) here is an example generated by iso2mesh, it looks also good :
@ftadel, Including the last release of brain2mesh could be a nice option as well.
@fangq I will have a look on the last updates and test it in some scenarios asap.
Thanks!
Re @ftadel
If you have time to repackage the different OS separately for release 1.9.1, could you also include > the last modification to mwpath, so that we can use mergesurf? It would be awesome!
it is easy enough for me to create a new release, see
https://github.com/fangq/iso2mesh/releases/tag/v1.9.2
I just thought it is easier to do it on github, but if your script show frequent errors for github links, I am happy to upload these to sf.
Re @juangpc, @tmedani and @ftadel
Hi, we use the "headreco" tool within SimNIBS, which relies on spm and cat12. mri2mesh is still available but headreco seems to work a bit better. But @tmedani knows much more.
In Brainstorm, we have added an option that can generate the tetra mesh from the nested surfaces > by calling the iso2mesh toolbox (mainly the surf2mesh function)
I see. Give brain2mesh a try - the typical meshing time is only a few minutes - for very dense mesh, maybe 3-5 min (single-threaded), but sounds like still significantly faster than the alternatives.
Because I myself use these meshes for modeling purposes, I tried my best to reduce the mesh density, so that it is sufficient to represent the shapes but not overwhelmingly dense to slow down the modeling part. I think this also helps with the speed.
the first built-in example in brain2mesh should work out-of-box (processing an SPM segmentation)
https://github.com/fangq/brain2mesh/tree/master/examples
but I am aware that the 2nd one does not work - this is actually not a problem with brain2mesh/iso2mesh, but something failed with tetgen 1.5 - I could generate a mesh using tetgen 1.4 but losing all tissue labels. I've reported this issue to Dr. Hang Si, the author of tetgen, but haven't received a reply yet.
The headreco mesh look nice - I am wondering if it works under the assumption that one tissue layer must fully enclose another (from the screenshot near the brain stem, it looks like this was the case) - I just want to mention that in brain2mesh, we allow GM/WM/CSF to have shared boundary (instead of one enclosing another with a small gap). see this tissue topology diagram in our paper
https://www.biorxiv.org/content/biorxiv/early/2020/02/09/2020.02.07.939447/F2.large.jpg
The code is basically a short driver code, the heavy-lifting work is done by iso2mesh functions (which calls CGAL, cork and tetgen in turn) behind the scene. I still need to polish it a lot because my student's initial version used a lot of non-vectorized code. But the functionality is there (the hybrid meshing pathway to join FreeSurfer's wm/pial surface is in a separate function, which I will integrate with brain2mesh shortly).
Let me know if you have any feedback or see any errors on your data. I can use this opportunity to prepare brain2mesh for a milestone release.
Thanks! I've updated Brainstorm so it downloads these new files: https://github.com/brainstorm-tools/brainstorm3/commit/a09061d8ee28459c55360fbf2769b619c02bf626#diff-7c3a114ee98415cadd8af55c3c3b262eR995
HTTPS connections require Java 1.7, and therefore Matlab >= 2013b, but the same limitation applies for sourceforge or github. Let's try with the .zip files from github and we'll see if anybody complains.
thanks @ftadel, if HTTPS becomes an issue, I am happy to upload the zip file to my own web hosting space.
Calling mwpath with no inputs crashed when trying to reach variable "fname". Some functions (eg. surfboolean) call this function without parameters to get only a temporary folder.