SCIInstitute / Cleaver

A MultiMaterial Tetrahedral Meshing Library and Application
https://cleaver.readthedocs.io
Other
40 stars 18 forks source link

Uneven Volumes #97

Open fluviolobo opened 3 years ago

fluviolobo commented 3 years ago

Hello,

Is it possible to generate a good mesh when then input volume is not equilateral and padding is not used?

Let me expand;

If I use an equilateral volume as an input, say [256,256,256], these flat boundaries are preserved.

NOTE: I am using the version of Cleaver embedded into 3DSlicer, which I have updated after reading this issue

lassoan commented 3 years ago

SegmentMesher extension can add padding around the original image (in Advanced section -> Cleaver background padding). Size is defined as percentage of volume size, set to 10% by default but you can set it to higher value if you create large mesh elements, or set it to 0 if you want make Cleaver deal with boundaries.

For me it is not clear what problem you have, but if you post a few screenshots and maybe link to an example data set then Cleaver developers can investigate it.

jessdtate commented 3 years ago

Cleaver can handle anisotropic spacing and size, but it does so by adding some volume to make the whole region a cube. This isn't padding, per-say, as it only adds the volume to one side of the image.

The poor quality elements are concerning, screen shots would help, as would example data if you could share it.

fluviolobo commented 3 years ago

Thanks for your response @lassoan! I was originally going to continue my August post on the 3D Slicer forum, but I was hoping I could ping the Cleaver guys here faster 👍

I am aware of the padding option. I am actually trying to avoid it as much as possible, unless it becomes the only way I can do what I am attempting.

Here is the deal; I have an input segmentation from a anisotropic volume [251, 402, 263] (fig below)

volume I cut the volume so that some of the edges of the segmentation are still internal to the patient's anatomy. In other words, my segmentation is not fully enclosed by skin.

When I use cleaver to mesh this volume, I get some bad elements and weird geometry on some of these edges, but not all! (fig below) perps horrible_elements

On the following image, you can see how the mesh follows the segmentation boundary between two tissues nicely, but only on the side of the model. A weird jagged line separates the two tissues on the top.

horrible_elements_and_good_ones

For the most part, I have avoided this issue by cropping the volume to an isotropic voxel input, say [256,256,256]. While this seems to do the trick, then I am limited by the # of voxels on the shortest plane of the DICOM dataset. Effectively limiting my ability to simulate structures that are further apart from each other than this shortest length.

If I use padding, then I have to reduce my blend sigma considerably, while still getting these rounded dips when transitioning between tissues (fig below)

with_padding

My motivation to leaving these boundaries flat is simple. So I can more efficiently assign BCs based on shared normals. We are running large deformations, so any small dihedral angles throw our simulation off from the start. We have found some of these on the weird boundaries and the dips generated by the padding.

fluviolobo commented 3 years ago

@jessdtate,

I just saw your response! I actually crop the volume to be have an isotropic voxel distribution, using 3D Slicer's Crop Volume tool. Would this have an adverse effect?

Also, I can share the entire 3D Slicer scene, the mesh, the .nrrd file or the DICOM. Just let me know what you need!

jessdtate commented 3 years ago

The nrrd segmentation would be most helpful.

When you say isotropic voxel distribution it seems to mean the size of the voxel is isotropic. Is that correct? Cleaver only takes a regular grid. It think the biggest factor to avoid the added volume would be even sizes, as you tried when you resampled to 256x256x256.

The padding creates a region on the boundary surfaces, which is what causes the furrow along the other boundaries. reducing blending should help, but it wasn't working properly in older versions.

fluviolobo commented 3 years ago

@jessdtate,

That is correct and sorry for the confusion. The Crop Volume tool should make the voxels isotropic.

Let me expand a little more on the volume sizing. The original input DICOM volume is [512, 512, 90]. original

I usually crop this original dataset so that the resulting volume is a cube [90, 90, 90]. I am limited by the 90 pixels on the sagittal view. If I generate a mesh on that cropped volume, I get perfectly flat boundaries. cube

But some features and BCs I am testing require a bigger, non-cube volume [256, 512, 90] half

Here are the .nrrd files of the segmentation and labelmap. Let me know if you need more info. Segmentation-label.zip

Thank you for your help!

lassoan commented 3 years ago

@fluviolobo you don't need to worry about the shape of boundary elements where you "cut off" the body, because you specify zero displacement on them anyway. If they are too close to the region of interest so that you don't want to set displacement to zero then just add more body (segment more of the image, and if the image end then you can just continue painting or importing a general body shape).

fluviolobo commented 3 years ago

@lassoan,

That is true for the fixed BC case! I am playing with some symmetry plane BCs and sliding on the chest wall to allow more motion on the model. I want to have the capability to do both if possible. Again, I mostly want to know if I can get them flat, but I can adapt too

fluviolobo commented 3 years ago

@jessdtate,

Just wanted to circle back to your response:

The padding creates a region on the boundary surfaces, which is what causes the furrow along the other boundaries. reducing blending should help, but it wasn't working properly in older versions.

So, essentially, unless I am using even sizes then padding will be needed and, hence, furrowing will occur on multi-material boundaries. This is just the normal behavior of Cleaver, correct?

Will there be a way of playing with ratios of sizes [128x128x256] or perhaps ratios between the input parameters --scale o --multiplier that could help? Lowering the blend sigma helps, but it causes some issues in other areas of the mesh...