centerCPL

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Geometric Queries
Introduced first in SolidGeometry 3.8, Creation date: 2017-05-14, Last change: 2025-09-14

returns the center of all contours of a CPL

Description

This function helps to find fiducial marker center in xray images

See Also: centerPL , CPLcontourc , CPLdisttopoint

Example Illustration

 missing image of centerCPL(CPL)

Syntax

[PL,RL]=centerCPL(CPL)

Input Parameter

CPL: Closed Polygon list with several PL's

Output Parameter

PL: List of center of CPL using centerPL
RL: List of distance to most distant point vom PL

Examples


VL=50*rand(10,3)-25;
I=imageofVLprojection(VL,[100 100],[0 -100 0],[0 100 0],4);
CPL=CPLcontourc(double(I),1);
centerCPL(CPL)




Copyright 2017-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This function, centerCPL, is designed to find the center of all contours in a Closed Polygon List (CPL). It is particularly useful for identifying fiducial marker centers in X-ray images.

Input Parameters

Output Results

Algorithm Steps

  1. Use separateNaN to determine the number of separate polygons (n) in the CPL.
  2. Initialize PL as an n-by-2 matrix filled with NaN values to store the centers of each polygon.
  3. Initialize RL as an n-by-1 vector filled with NaN values to store the maximum distances.
  4. Iterate over each polygon (i from 1 to n):
  5. If no output arguments are specified, plot the results:
Algorithm explaination created using ChatGPT on 2025-08-19 01:04. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21