Search code examples
c#itk

How to get center coordinates of a label in SimpleItk


I am using the SimpleITK framework(x64) for C#.

After I do some operations and filtering I got a bunch of labels through the LabelShapeStatisticsImageFilter, where i am interested in.

How do I get the center coordinates of a specific label ? When I use the function GetCentroid I get partial negative results and I do not understand how to proceed with this data.

Thanks in advance.


Solution

  • thank you for your answers and comments.

    I found the solution to the problem in a comment of an example:

     // NOTE: As of April 8, 2015 the filter does not work with non-zero origins
    

    So i saved the Origin data, set the Origin to (0,0) - got a useful Centeroid and altered the Centeroid result for the original Origin to finally set it again to its former value.