Home Image-Pro General Discussions

Extract x and y co-ordinates from a line profile

Hello,

May I know if there is an option to extract the (x,y) co-ordinates from a line profile on a calibrated image?

Thanks for any help,

Paulstar008

Answers

  • Additional info: The line is created using Auto Trace Polyline tool  under Measure tab in Image-Pro Premier V 9.2
  • 2018-10-25-091034

    PaulStart008 --

    Can you provide an image that illustrates the information that you are looking for?

    Perhaps sketch it up on a piece of paper and photo or scan it and send it?

    Thanks.

    -- Matt
  • Dear Matt,

    Here is a copy of the image. The line profile is also visible.

    Thanks

  • Dear NikitaRG,

    Thanks for your suggestion. The original co-ordinates of the image ranges from (0,0) to (990,740). When I performed the measurements using the above macro, I get strange values with co-ordinates up to (2014, 813), see below. I would also like to export the values to MS excel with x and y values in two different columns for further analysis.

    Thanks,

    Paulstar008
  • HI Paulstar008,

    If you want to print coordinates in 2 columns, use Matt's code (from the same topic):

    'Output the CURRENT BOUDARY POINT
                            s = _
                                p.x.ToString("F2") & vbTab & _
                                p.y.ToString("F2")
                            ThisApplication.Output.PrintMessage(s)

    Then you can export the Output window to Excel.
    Note, that the coordinates are in Pixels, that may explain 2014,813.

    Yuri
     
  • 2018-10-26-104110

    PaulStar008 --

    The information below may help also.

    All of these IMPORTS may not be needed but these are in the PROJECT / APP that includes this CODE so I am showing them below.

    You can replace the IMAGE WIDTH and IMAGE HEIGHT (in PIXELS) with the X COORDINATES and Y COORDINATES (in PIXELS) to get the CALIBRATED versions of the X COORDINATES and Y COORDINATES.

    I hope this information is helpful

    -- Matt

    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

            'Import REFERENCES

            Imports MediaCy.Addins.Measurements
            Imports MediaCy.Addins.Measurements.Gadgets
            Imports MediaCy.Addins.Measurements.McMMData

            'Declare VARIABLES

            Dim MyCalibrationUnits As String
            Dim MyPixelSizeX As Double
            Dim MyPixelSizeY As Double
            Dim MyRoiArea As Double

            'Learn CALIBRATION INFORMATION

            If (ThisApplication.ActiveImage.SpatialCalibration IsNot Nothing) _
                Then

                    MyCalibrationUnits = _
                        ThisApplication.ActiveImage.SpatialCalibration.UnitAbbrev

                    MyPixelSizeX = _
                        ThisApplication.ActiveImage.SpatialCalibration.PixelSizeX

                    MyPixelSizeY = _
                        ThisApplication.ActiveImage.SpatialCalibration.PixelSizeY

                Else

                    MyCalibrationUnits = _
                        "pix"

                    MyPixelSizeX = _
                        1

                    MyPixelSizeY = _
                        1

                End If

            'Learn ROI AREA in CALIBRATED UNITS

            MyRoiArea = _
                ( ThisApplication.ActiveImage.Width * MyPixelSizeX ) * _
                ( ThisApplication.ActiveImage.Height * MyPixelSizeY )

  • Thank you Yuri and Matt for your kind support. As I am not that familiar with macros, perhaps you can provide a little bit more information on how I can implement the above.
    Thanks,

    PaulStar008
  • 2018-10-31-111239

    PaulStar008 --

    Writing a MACRO to EXTRACT and REPORT the DATA that you are looking for (as I understand the challenge) would take about 30 to 60 minutes for a basic routine that would handle 1 LINE in 1 IMAGE.

    This is a bit too big a project for me to tackle for the FORUM.

    MEDIA CYBERNETICS holds MACRO PROGRAMMING CLASSES for IMAGE-PRO a couple of times each year for a fee.

    ALCES IMAGING AND AUTOMATION provides MACRO PROGRAMMING SERVICES for IMAGE-PRO for a fee.

    I hope this information is helpful.

    -- Matt
Sign In or Register to comment.