DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

User input based on visual check

Solved!
Go to solution

Hi,

 

I am stuck by a certain problem, I do not know how to solve it and I would like to ask you what is the best way to solve it.

 

I have a script which evaluates data but needs a visual check from a user (because of huge variations of data by data). Attached figure shows two curves: red and green. Red represents el. signal and green should show where the rise of the red curve ends (by a value of 1, otherwise it is 0). The green curve position needs to be visually checked by the user and if the green curve is at wrong position (like it is at the attached figure), the user should be able to input a value by how much the green curve needs to be shifted from the perspective of x-axis. The process of shifting the green curve needs to repeat till the user is satisfied with the green curve position.

Do you know any way how to solve this?


Thank you for any help

 

With regards

Radomir Kalinay

0 Kudos
Message 1 of 7
(3,888 Views)

Have you tried creating a GUI in DIAdem?  You can plot the 2 curves in a dialog box, have a control for the user to shift the green curve and replot the curves until satisfied.  I could potentially help you get started on that if you never made dialog boxes before and you are interested in this solution.

0 Kudos
Message 2 of 7
(3,871 Views)

Hi,

 

thanks for reply.

 

If you would be willing to help me with that I would very appreciate it. Do you have any example you can share?

 

I actually tried to create a GUI, but wasn't really successful. I was not able to transfer variables by using GetArgument and I was not able to change the range of x axis of a plot. Do you know how to solve this issues?

 

Thanks

 

Radomir

 

0 Kudos
Message 3 of 7
(3,863 Views)

I attached an example SUD and an example tdms file that you can potentially build on.  You can select the time, signal, and digital channels and use the "-1" and "+1" keys to shift the digital channel

Download All
0 Kudos
Message 4 of 7
(3,849 Views)

Hi,

 

thank you very much for your effort, appreciate it. However, I can't open it, a dialog window saying that the file is invalid pops out.

My version of DIAdem is 2015, can this be a problem?

 

Thanks

 

Radomir

0 Kudos
Message 5 of 7
(3,827 Views)
Solution
Accepted by topic author Radomir

I use version 2017.  I will paste the code of the SUD so you can copy it.  You will have to create a new dialog box with the same elements and rename a few of them:

Curve2DPreview: PlotArea

Button: MinusOne

Button: PlusOne

ChnListBox: DigitalChannelSelect

ChnListBox: SignalChannelSelect

ChnListBox: TimeChannelSelect

Option Explicit  'Forces the explicit declaration of all the variables in a script.

'Note: In this area area you can program auxiliary variables and functions that you can use in the entire dialog box.

Sub SignalChannelSelect_EventChange(ByRef This) 'Created Event Handler
  Call PLOT()
End Sub
Sub DigitalChannelSelect_EventChange(ByRef This) 'Created Event Handler
  Call PLOT()
End Sub
Sub TimeChannelSelect_EventChange(ByRef This) 'Created Event Handler
  Call PLOT()
End Sub

Sub PLOT()
  If Not SignalChannelSelect.Selection = -1 And Not DigitalChannelSelect.Selection = -1 And Not TimeChannelSelect.Selection = -1 Then
    Call PlotArea.Curves.RemoveAll()
    Set signalChnl = Data.GetChannel(SignalChannelSelect.Items().Item(SignalChannelSelect.Selection).Text)
    Set digitalChnl = Data.GetChannel(DigitalChannelSelect.Items().Item(DigitalChannelSelect.Selection).Text)
    Set timeChnl = Data.GetChannel(TimeChannelSelect.Items().Item(TimeChannelSelect.Selection).Text)
    Call PlotArea.Curves.Add(timeChnl.GetReference(eRefTypeIndexIndex), signalChnl.GetReference(eRefTypeIndexIndex))
    Call PlotArea.Curves.Add(timeChnl.GetReference(eRefTypeIndexIndex), digitalChnl.GetReference(eRefTypeIndexIndex))
    Call PlotArea.Refresh()
  End If
End Sub

Dim signalChnl, digitalChnl, timeChnl
Sub Dialog_EventInitialize(ByRef This) 'Created Event Handler
  TimeChannelSelect.Selection = 1
  SignalChannelSelect.Selection = 2
  DigitalChannelSelect.Selection = 3
  Set signalChnl = Data.GetChannel(SignalChannelSelect.Items().Item(SignalChannelSelect.Selection).Text)
  Set digitalChnl = Data.GetChannel(DigitalChannelSelect.Items().Item(DigitalChannelSelect.Selection).Text)
  Set timeChnl = Data.GetChannel(TimeChannelSelect.Items().Item(TimeChannelSelect.Selection).Text)
  Call PLOT()
End Sub

Sub PlusOne_EventClick(ByRef This) 'Created Event Handler
  Call digitalChnl.SetValues(0, 1, 1, eValueBlockValueInsert)
  Call PLOT()
End Sub

Sub MinusOne_EventClick(ByRef This) 'Created Event Handler
  Call DataBlDel(digitalChnl, 1, 1)
  Call PLOT()
End Sub

SUD.JPG

Message 6 of 7
(3,810 Views)

Hi,

 

thank you very much for sharing the script with me. It helps me a lot.

 

With regards

 

Radomir

0 Kudos
Message 7 of 7
(3,799 Views)