diff --git a/ShoulderCase/@Muscle/measureAndSaveCentroid.m b/ShoulderCase/@Muscle/measureAndSaveCentroid.m index eef08fa..d04222c 100644 --- a/ShoulderCase/@Muscle/measureAndSaveCentroid.m +++ b/ShoulderCase/@Muscle/measureAndSaveCentroid.m @@ -1,8 +1,11 @@ function measureAndSaveCentroid(obj) muscleContour = obj.loadMask("Contour"); - centroidIndices = round(regionprops(muscleContour).Centroid); muscleCentroid = false(size(muscleContour)); - muscleCentroid(centroidIndices(1), centroidIndices(2)) = true; + centroidIndices = round(regionprops(muscleContour).Centroid); + % centroidIndices(2) is the vertical top->down index + % centroidIndices(1) is the horizontal left->right index + % kind of opposite to the matlab array indexing... + muscleCentroid(centroidIndices(2), centroidIndices(1)) = true; obj.saveMask(muscleCentroid, "Centroid"); obj.centroid = obj.getMaskCoordinates("Centroid"); end \ No newline at end of file