| | |
Should I single or multi-thread this ECG code?
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2005
Posts: 244
Reputation:
Solved Threads: 5
Hello, everyone. It's been a while.
I'm still working on the same Ultrasound machine GUI, but I'd taken time off for summer courses. Fortunately, thanks to the help I received here, I have made great advances in my program over the previous coder's attempt, but I'm now facing a bit of a problem.
I don't have code yet, and I won't have much to show until I've got a clear idea of the best way to begin.
Here's the problem.
This ultrasound machine GUI needs to handle inputs from an electrocardiogram machine. Currently, there is an event handler for a signal.
I made it a while back and haven't touched it since as I worked on developing a better way of implementing filesaving and improving the backend of the interface.
When the user is doing ECG-based captures, they can use 0-2 delays (length of delay set by trackbars and enabled/disabled by checkboxes) that will take a single frame capture at the termination of the delay period.
The problem is, what to do when another signal comes in from the ECG before the image captures have completed.
Luckily, the human heart cannot generate pulses as cleanly as a signal generator, so there's an easy answer for handling a premature heart signal. If it comes between the initial signal and the first capture, don't take capture the first or second image for the initial signal.
If the initial signal's first capture is taken and then the new signal arrives, skip the second capture for the initial and focus on getting both of the new signal's captures.
The problem is the implementation.
I'll need to be able to check for a second trigger signal while the program waits to take the appropriate images for the initial signal.
When I think of how to do this in a single thread, I'm not sure I'd be able to catch a vitally-important ECG trigger.
I think that using another thread for checking for ECG trigger changes would be a good idea. I could use a flag from the second thread in a while loop to allow early termination and achieve the desired effects, but I'm not entirely sure it's necessary.
If more information is needed, I'd be happy to provide it.
Thanks in advance!
I'm still working on the same Ultrasound machine GUI, but I'd taken time off for summer courses. Fortunately, thanks to the help I received here, I have made great advances in my program over the previous coder's attempt, but I'm now facing a bit of a problem.
I don't have code yet, and I won't have much to show until I've got a clear idea of the best way to begin.
Here's the problem.
This ultrasound machine GUI needs to handle inputs from an electrocardiogram machine. Currently, there is an event handler for a signal.
C# Syntax (Toggle Plain Text)
/// <summary> /// Event handler for signal from hand trigger. Needs to be debounced. /// </summary> private void OnTrigger1() { if(this.cbCaptureType.SelectedIndex==1) //Only trigger if the correct setting is used, and { dt.AcquireOn=true; captureState = 1; if(this.mIBirdOn.Checked) bird.Point(); //DataisHere will call GetSingleFrame after a bird position is read in. else GetSingleFrame(); } }
I made it a while back and haven't touched it since as I worked on developing a better way of implementing filesaving and improving the backend of the interface.
When the user is doing ECG-based captures, they can use 0-2 delays (length of delay set by trackbars and enabled/disabled by checkboxes) that will take a single frame capture at the termination of the delay period.
The problem is, what to do when another signal comes in from the ECG before the image captures have completed.
Luckily, the human heart cannot generate pulses as cleanly as a signal generator, so there's an easy answer for handling a premature heart signal. If it comes between the initial signal and the first capture, don't take capture the first or second image for the initial signal.
If the initial signal's first capture is taken and then the new signal arrives, skip the second capture for the initial and focus on getting both of the new signal's captures.
The problem is the implementation.
I'll need to be able to check for a second trigger signal while the program waits to take the appropriate images for the initial signal.
When I think of how to do this in a single thread, I'm not sure I'd be able to catch a vitally-important ECG trigger.
I think that using another thread for checking for ECG trigger changes would be a good idea. I could use a flag from the second thread in a while loop to allow early termination and achieve the desired effects, but I'm not entirely sure it's necessary.
If more information is needed, I'd be happy to provide it.
Thanks in advance!
Explainer of control logic and some basics.
"If you seek to drink from a fountain of knowledge, make sure your cup is big enough."
"If you seek to drink from a fountain of knowledge, make sure your cup is big enough."
![]() |
Similar Threads
- How do i create a simple game using c++?? (C++)
- Winsock Multi-Client Servers (C++)
- Send data on a serial port (C++)
- C++ Server: Multi-thread VS Single-thread (C++)
- thread pooling and synchronization (VB.NET)
- Multi-threading with C++.NET (C++)
Other Threads in the C# Forum
- Previous Thread: firewall application
- Next Thread: Looking for a code for editing XML
| Thread Tools | Search this Thread |
.net access algorithm array barchart bitmap box broadcast c# check checkbox client combobox control conversion csharp custom cyclethruopenforms data database datagrid datagridview dataset date/time datetime degrees development dll draganddrop drawing encryption enum event excel file finalyearproject form format forms function gdi+ getoutlookcontactusinfcsvfile globalization httpwebrequest image index input install installer java label list listbox mandelbrot math mono mouseclick mysql operator panel path photoshop picturebox pixelinversion post programming radians regex remote remoting richtextbox save server silverlight sleep socket sql sql-server statistics stream string table text textbox thread time timer timespan update usercontrol users validate validation visualstudio webbrowser wia windows winforms wpf xml





