Home Image-Pro General Discussions

modifying otolith app

Hi, We are using the otolith app to record increment measures. We use the .txt file export feature to combine multiple collections into one data file. I was looking at the app to see if the output for the txt file can be modified to change the output from recording annuli index to the annuli label. I'm not sure what coding language to focus on, but I think one issue is the formatting syntax. The function for GetAnnuliLabel() is below the DataAlaskaFish function. Anyways, if anyone has any suggestions for modifying the app, let me know 

Thanks,
Kevin 

Best Answer

  • Answer ✓
    Hi, Just to followup. The following VB.net code changes the DataAlaskaFish function to output the circuli measurements with the annuli label. 
    Public ReadOnly Property DataAlaskaFish As String
        Get
            Dim s As String = ""
            Dim l As Double = 0.0
            Dim fs As String = GetFormatString
    
            ' Check if line profile data exists and has one feature
            If _lineProfile IsNot Nothing AndAlso _lineProfile.FeaturesCount = 1 Then
                Dim n As String = If(String.IsNullOrEmpty(_lineProfile.Document.FileName),
                                     _lineProfile.Document.DisplayName,
                                     System.IO.Path.GetFileNameWithoutExtension(_lineProfile.Document.FileName))
    
                ' Append metadata
                s = $"{n}{vbTab}{Format(Now, "MMM dd yyyy HH:mm")}{vbTab}{_sUserID}{vbTab}{_sComment}{vbTab}{GetFreshWaterPlusGlNumber}{vbTab}"
    
                ' Retrieve and format distances
                Dim dA() As Double = _lineProfile.ProfileData(0).EdgesData(mcEdgeTypes.mcetReference).Distances(0)
                Dim dC() As Double = GetCirculiDistances()
    
                If dC IsNot Nothing AndAlso dC.Length > 0 Then
                    For Each d As Double In dC
                        s &= $"{GetAnnuliLabelForCirculi(_lineProfile.ProfileData(0).EdgesData(mcEdgeTypes.mcetReference), dA, d)},{Format(d - l, fs)}{vbTab}"
                        l = d
                    Next
                End If
            End If
    
            Return s.Trim & vbNewLine
        End Get
    End Property

Answers

  • Hello Kevin,
    are you aware that you call the String.Format with an "A" placeholder! That should be a {0} as in the below version of DataAlaskaFish!
    I do not know the otolith app and therefore have no knowledge about the GetAnnuli-functions.
    But sometimes it's just that we overlook the obvious :-)
    Regards,
    Helga
  • I was messing with the formatting to see if the A would support text. When I run the app with the function changed and the formatting stuck to {0},{1} I get the following error. I expect the txt output to be something like "FW-1,0.091". Thanks for looking at this.  
  • Hi Kevin,

    In order to replace Annuli index with Annuli label change next line in DataAlaskaFish:
    s &= String.Format("{0},{1}", GetAnnuliIndexForCirculi(ed, dA, d) + 1, Format(d - l, fs)) & vbTab
    with 
    s &= String.Format("{0},{1}", GetAnnuliLabelForCirculi(ed, dA, d), Format(d - l, fs)) & vbTab

    Let me know, if you wish to do other modifications.

    Thanks,
    Nikita.
Sign In or Register to comment.