943,883 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 2873
  • C# RSS
Sep 1st, 2006
1

Should I single or multi-thread this ECG code?

Expand Post »
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.

C# Syntax (Toggle Plain Text)
  1. /// <summary>
  2. /// Event handler for signal from hand trigger. Needs to be debounced.
  3. /// </summary>
  4. private void OnTrigger1()
  5. {
  6. if(this.cbCaptureType.SelectedIndex==1) //Only trigger if the correct setting is used, and
  7. {
  8. dt.AcquireOn=true;
  9. captureState = 1;
  10. if(this.mIBirdOn.Checked)
  11. bird.Point(); //DataisHere will call GetSingleFrame after a bird position is read in.
  12. else
  13. GetSingleFrame();
  14. }
  15. }

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!
Similar Threads
Reputation Points: 22
Solved Threads: 5
Posting Whiz in Training
Drowzee is offline Offline
244 posts
since Jul 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: firewall application
Next Thread in C# Forum Timeline: c# multithreading help needed ---urgent





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC