Variable Element Sizing and Smooth Border

64 views
Skip to first unread message

Ross

unread,
May 24, 2022, 1:35:33 PM5/24/22
to iso2mesh-users

Hello, I would first like to say a huge thanks for making such a great piece of software open source. I think Iso2Mesh has a place for a lot of the work we are doing in the group I am in. It was very easy to make a working mesh for FEA, but I was wondering if you could help me refine the mesh further.

The main problem I am having is to try and create a variable sizing field for the elements. Ideally, it would be fantastic to have smaller element size on the border of certain image labels.

I can set radbound and distbound globally in the function vol2surf, however changing these settings for each label (e.g. opt(1).radbound=1)doesn’t seem to work. I have also tried to rectify this by using meshrefine after the volumetric mesh is created with parameters such as opt.reratio=0.5 and  opt.reratio=1.5 yielding identical results. I thought a temporary file was overriding the variables, but deleting files in the mwpath doesn’t seem to fix this problem.

Are there any functions I should explore to make boundaries cleaner between labels? Smoothsurf seemed to help. I would like to avoid triangles sticking out too much. Would the labelled image I am entering have to be higher resolution?

In the image above, it would be great if these elements were smoother and following the red line more closely, whilst having the elements more concentrated at the border.

These links show the current script and labelled input matrix. Code in comments are some ideas that I have tried to play around with.

https://drive.google.com/file/d/17hr0dhEXnwjrWJ-RH0BK04N5aoofB2Ho/view?usp=sharing, https://drive.google.com/file/d/1jeLH69YjJdo2mrnTc5C7UPCLEtlkDm9Z/view?usp=sharing

Any help would be greatly appreciated!

Ross

unread,
May 24, 2022, 2:00:38 PM5/24/22
to iso2mesh-users

I realise I didn't attach an image. It would be great to smoothen this boundary and have smaller elements close to the border.
 Picture1.png

Qianqian Fang

unread,
May 25, 2022, 12:27:47 AM5/25/22
to iso2mesh-users
@Ross, opt.distbound is the most relevant built-in flag to achieve adaptive triangle/tet size to conform to small and sharp features if you use cgalmesh option

you can run the below example to see the effect

in fact, one of the recent screenshots I posted in the mailing list shows this effect to a further extend:
https://groups.google.com/g/iso2mesh-users/c/VRFFNZdV9mg/m/EcimX1niAQAJ

if getting smooth surfaces is important, I would go for the v2s -> sms -> s2m route - for multi-labeled volume, v2s also support 'cgalmesh'. to ensure even higher quality, I would go for a path similar to our brain2mesh papar, especially Fig. 3, see
 
Qianqian

On Tuesday, May 24, 2022 at 1:35:33 PM UTC-4 Ross wrote:

Ross

unread,
May 27, 2022, 1:39:55 PM5/27/22
to iso2mesh-users
Hello Dr Fang,

Thank you very much for the links, they are very helpful and I will incorporate these ideas. I will try to closely replicate the quality you achieved in the brain2mesh paper.

I previously attempted to go down the root of the meshing pipeline you specified. Unfortunately, I’m getting a CGAL error when using s2m:

terminate called after throwing an instance of 'CGAL::Assertion_exception'
  what():  CGAL ERROR: assertion violation!
Expr: !tree_.empty()
File: C:/msys64/mingw64/include/CGAL/Polyhedral_mesh_domain_3.h
Line: 640


The code I am using to generate this error is as follows:


mat=load(‘…/labels.mat');
fullimg=mat.mydata;

fullimg( fullimg == 1 ) = 0; %I don’t need this label
maxvol='2=3:3=3:4=3:5=3:6=3'; %Volumes for the different labels

clear opt
opt.distbound=0.5;    % set max distance that deviates from the level-set
[node,elem,regions,holes]=v2s(fullimg,[2 3 4 5 6],opt,'cgalmesh');

[node,elem,face]=s2m(node,elem(:,1:3),1,5,'cgalpoly');


For now, I am leaving out smoothing until s2m works. Would you happen to know what the error with my code is? 

Ross

unread,
May 27, 2022, 1:47:25 PM5/27/22
to iso2mesh-users

An important detail I forgot to mention is that there are sections where three labels touch. Is the pipeline you described within Iso2Mesh (v2s -> sms -> s2m) capable of doing that?

Reply all
Reply to author
Forward
0 new messages