finite element method for medical images
8 views (last 30 days)
Show older comments
I am trying to create fem mesh for MRI brain tumor image after labeling but shows error below.
Error using checkMeshIncompatible
Invalid input mesh. Neighboring mesh elements or mesh elements in one or more regions are not properly
connected.
Error in checkMeshValidity (line 49)
checkMeshIncompatible(elements(1:3,:)');
Error in pde.EquationModel/geometryFromMesh (line 126)
checkMeshValidity(nodes,elements,regions);
Error in untitled (line 17)
geometryFromMesh(model,verticesPatientMeters',faces');
The script is given below:
filepath = ("C:\Users\DELL\OneDrive\Documents\MATLAB\");
dataFolder = fullfile(filepath,"MedicalVolumeDICOMData","LabelData");
labelVol = medicalVolume("C:\Users\DELL\OneDrive\Documents\MATLAB\MedicalLabelingSession6\LabelData\8_19_2021_11_41_40_AM.nii");
R = labelVol.VolumeGeometry;
isovalue = 1;
[faces,vertices] = extractIsosurface(labelVol.Voxels,isovalue);
I = vertices(:,1);
J = vertices(:,2);
K = vertices(:,3);
[X,Y,Z] = intrinsicToWorld(R,I,J,K);
verticesPatient = [X Y Z];
verticesPatientMeters = verticesPatient.*10^-3;
triangul = triangulation(double(faces),double(verticesPatientMeters));
viewer = viewer3d;
surface = images.ui.graphics3d.Surface(viewer,data=triangul,Color=[1 0 0],Alpha=1);
model = createpde(3);
geometryFromMesh(model,verticesPatientMeters',faces');
pdegplot(model,FaceLabels="on")
2 Comments
Brian McDonnell
on 9 Apr 2024
Hi did you find a solution for this? I'm also getting some similar errors with a mesh generated in tetGen. I'm confident after some extensive checking that the mesh is fine. I've been using checkMeshIncompatible to try and troubleshoot the issue but no luck.
Answers (0)
See Also
Categories
Find more on 3-D Volumetric Image Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!