function output = getRimPointsIndices(obj) % Return the indices of the points on the rim of the glenoid surface. % To find the rim points, this function analyses the faces of the glenoid.surface % structure. These faces are triangles, each triangle is defined by three points % of the glenoid's surface. The points on the rim are defined to be the points % that appear in the faces 4 times or less (usually 3 or 4 times). Consequently, % the other points that appear more than 4 times in the faces (usually 5 or 6 % times) are expected to be the inner points of the surface. % % WARNING: This is an empirical method to define which points are the rim points. % It is not based on the glenoid's surface tesselation algorithm and might % return false positive and false negative points. % For example, P200 shoulderAuto rim points found with the current function % feature several 4-occurence points that are inner points of the surface. There % are also 5-occurence rim points that are not detected. % Fix hint to try: Run a new triangulation algorithm on the glenoid points ( % like the matlab's delaunay() funtion). trianglePointsIndices = obj.surface.faces; pointsOccurence = arrayfun(@(pointIndex)sum(trianglePointsIndices == pointIndex,"all"),... unique(trianglePointsIndices)); rimPointsIndices = find(pointsOccurence <= 4); output = rimPointsIndices; end