Problem with stl-files in subject specific scaling

Hello,

I’m working on the TLEMsafe project at the University of Twente. I encounter the following error when loading my model. I load STL-files in order to create a subject-specific scaling (see script below). An error indicates that “Node to node correspondence requires matching number of vertices.” However, the number of faces and vertices match exactly. Strangely enough, it occurs only for some STL-files. For example for one patient it only happens for right shank and left femur, while the STL-files of the other bones are morphed without a problem.

Thank you in advance!

SCRIPT:

AnyFunTransform3DSTL TLEMCTtoHS1stl =
{
//PreTransforms = {&.TLEMtoHS1rbf};
RBFDef.Type = RBF_MultiQuadratic;
RBFDef.Param = 0.2;
//FileName0 = “Cad3_Tibia_ISB.stl”;
FileName0 = …BodyModel.Right.Leg.Seg.STL.FilenamePelvisMorphing;
ScaleXYZ0 = {0.001, 0.001, 0.001};
FileName1 = …SubjectSpecificData.PelvisRightSTL;
ScaleXYZ1 = {0.001, 0.001, 0.001};
NumPoints = 1000;
UseClosestPointMatchingOnOff = On;
BoundingBox.ScaleXYZ = {2, 2, 2};
BoundingBox.DivisionFactorXYZ = 2*{1, 1, 1};
BoundingBoxOnOff = On;
};

ERROR:

ERROR(OBJ1) : C:/U…s/B…o/D…p/D…n/M…1/A…l/C…M/M…a/h…0/SubjectSpecificScalingModel56.any(102) : TLEMCTtoHS1stl.UseClosestPointMatchingOnOff : Node to node correspondence requires matching number of vertices. Please use UseClosestPointMatchingOnOff = On.
Model loading skipped

Hi Branco,

I suspect that you might have some small triangles, that are being deleted during the loading process and, thus, disappear from the pointcloud.

I would recommend to use a slightly different approach to avoid this kind of error. You could actually load stl-vertices as landmarks directly using STL_Vertices and STL_Sizes functions. After that you treat them as normal landmarks to construct an RBF function.
Something like:



      AnyFile f3 = "Femur3.stl";
      AnyInt size = STL_Size(f1, 1);
      AnyInt VertNum = 1500;
      AnyInt vertices = iarr(1,VertNum)*floor(size[0]/VertNum);
  
      Points1 = STL_Vertices(f3, vertices , 1); 


Regards,
Pavel

Thank you for your quick answer. Is it possible to open .anysurf3 files with Matlab?

Not without a small trouble - you would need to parse this file.

ANYSURF
FORMAT 3
4860  9394
 -4.801790e+001   3.507710e+001  -3.551965e+002   2.504340e-001   1.992195e-002  -9.679287e-001 

The first number represents the number of vertices, the second the number of triangles. The next line, starting a block, shows the vertex coordinates and then the corresponding normal. The next block will contain connectivity matrix.

But I do not really think you need to do that. I would probably use the suggestion that I gave.

Regards,
Pavel

1 Like