Home Image-Pro Automation (Macros, Apps, Reports)

DETECTING A USER GENERATED LINE PROFILE IN AN IMAGE . . .

All --

I have a customer that has a large set of images.  Some of the images (illustrated by AAA.TIF below) have ANNOTATION TEXT BOX, MEASUREMENT LINE OBJECTS, and SCALE BAR.  Some of the images (illustrated by BBB.TIF below) have ANNOTATION TEXT BOX, USER GENERATED LINE PROFILE LINE, and SCALE BAR.

I am writing an APP to do some work on these images.

Can you provide guidance on what CODE can determine / indicate whether an image is TYPE AAA (No USER LINE PROFILE LINE) or TYPE BBB (Yes USER LINE PROFILE LINE).

I think this may be possible indirectly in this case by determining the number of MEASUREMENT LINE OBJECTS are in the IMAGE (>0 = TYPE AAA, 0 = TYPE BBB) but I would rather do it directly in case there is a unique image that has both.

If I activate the LINE PROFILE TOOL and a TYPE AAA IMAGE is being processed, IMAGE-PRO automatically places a LINE PROFILE LINE in the image and this causes issues.

Thank you in advance.

-- Matt

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

AAA.TIF and BBB.TIF with LINE PROFILE TOOL DEACTIVATED


AAA.TIF and BBB.TIF with LINE PROFILE TOOL ACTIVATED


Best Answer

  • Accepted Answer
    Matt, you can disable adding default line profile in the options. The check for existing LP feature could be done wo LP panel and active tool:

                    Dim lpe As MediaCy.Commands.LineProfile.McLineProfileEngine
                    lpe = MediaCy.Commands.LineProfile.AddIn.LineProfileEngine(ThisApplication.ActiveDocument, True)
                    If lpe.LFeatures.Count > 0 Then
                        'check for any LP feature
                    End If

    Nikita.

Answers

  • 2020-09-07-194934

    All --

    An alternative would be if there is a MODE in IMAGE-PRO that will display the USER GENERATED LINE PROFILE LINE if it is stored with the image no LINE PROFILE if there is none stored with the image.

    Thanks.

    -- Matt

  • Hi Matt,

    You can check profiles collection of LineProfileEngine (search forum for LineProfileEngine).

    Thanks,
    Nikita.
  • 2020-09-08-094743

    Nikita --

    Thank you for your suggestion.

    I did the search that you suggested and scanned through the results.

    It looks like all of these require the LINE PROFILE TOOL to be ACTIVE.

    I am hoping that there is CODE that will allow a routine to test an image to see if there is a USER GENERATED LINE PROFILE LINE embedded in the IMAGE via the TIF FILE.

    Can you direct me to one of the discussions that addresses this or perhaps post a routine that will determine that AAA.TIF (below) does not contain a USER GENERATED LINE PROFILE LINE and BBB.TIF (below) does contain a USER GENERATED LINE PROFILE LINE?

    Thanks again.

    -- Matt

  • edited September 2020
    2020-09-08-174654

    Nikita -- 

    I will check for the AUTO DEFAULT LINE OPTION.  Turning that off might also smooth out some things.

    Thank you for the FEATURE COUNT CODE for LINE PROFILE.

    This looks like just the key to unlock the information I am looking for to make a branch in the CODE depending upon whether the image is similar to AAA.TIF or BBB.TIF.

    Thanks again.

    -- Matt




  • 2020-09-08-192923

    Nikita --

    I wired the CODE that you provided into a routine named

        tester

    which is below.

    I ran that routine on the AAA.TIF and BBB.TIF images provided and got the following results.

    ------------------------
    C:\Users\Owner\Desktop\AAA.tif
    USER LPE NOT FOUND
    ------------------------
    C:\Users\Owner\Desktop\BBB.tif
    USER LPE FOUND

    That is AFTER clearing a LINE PROFILE LINE out of AAA.TIF that snuck in there somehow.

    This gives me the CODE I need to detect and handle TYPE AAA IMAGES and TYPE BBB IMAGES.

    Thank you very much.

    -- Matt

    --------------------------------------------------------------------------

    Public Sub tester()
    
                    Debug.Print "------------------------"
    
                    Dim lpe As MediaCy.Commands.LineProfile.McLineProfileEngine
                    lpe = MediaCy.Commands.LineProfile.AddIn.LineProfileEngine(ThisApplication.ActiveDocument, True)
                    If lpe.LFeatures.Count > 0 Then
    
                        Debug.Print ThisApplication.ActiveDocument.FileName
                        Debug.Print "USER LPE FOUND"
    
                        Else
    
                        Debug.Print ThisApplication.ActiveDocument.FileName
                        Debug.Print "USER LPE NOT FOUND"
    
    
                    End If
    
    End Sub
    
    

Sign In or Register to comment.