Replies: 4 comments 7 replies
-
This sounds good to me. I suppose that Side note: docs state that "Refraction, speed of sound, and beamwidth are not modeled.", but |
Beta Was this translation helpful? Give feedback.
-
This class does something similar: So yes, you would create a new device type and in your if/else you just create the appropriate device. |
Beta Was this translation helpful? Give feedback.
-
The ultrasound simulator device should be extensible with whatever you need (unless you want to add something very special that could ever happen in your ultrasound system). For example, adding freeze function to the simulator would be useful in general. You can simulate trackers and other sensors in Plus, too, but it is probably simpler to do it using Python scripting in Slicer. You can add an observer to the transforms that the user can change and update all the derived transforms (if the transform tree does not take care of something automatically). If you want to simulate independent, non-user initiated actions (e.g., patient breathing motion) then you can add a QTimer that calls a function N times per second to update certain transforms. |
Beta Was this translation helpful? Give feedback.
-
My understanding is that Adam is essentially wanting to test the code from an UltrasoundDevice which essentially has all the device API calls removed so that is purely Plus code. Then it could be used to confirm if appropriate device internal properties are being set correctly. Of course testing if the image data changes wouldn't be accomplished here as you would have to confirm with hardware that your device actually did what you asked it to do. |
Beta Was this translation helpful? Give feedback.
-
Hi folks,
I'm interested in building some simulator classes for specific Plus devices. I'm wondering if this is something that could belong in the repo, or if this is even the correct approach to what I'd like to do.
Basically, our group has a robotic setup with multiple devices (probes and trackers) that are controlled by a separate application that interfaces with a PlusServer. I'd like to automate testing of this external application without needing actual probes by simulating the hardware that is run by the application.
I understand that there is a UsSimulatorVideoSource class, but I'd like to combine this functionality of simulating the Us stream with faking certain functions to more closely simulate the state of the device (e.g., calling fakeDevice->freezeProbe() freezes the simulated stream, or calling fakeDevice->setVoltage() sets some internal variable which maintains that voltage state). Ideally, I'd like to simulate our entire robotic setup in a scene in Slicer (similar to how the example scene is set up for the UsSimulator demo) and have that scene interact with our application as if it were just connecting to physical devices.
So far, I have been hacking together simulated actions by rerouting commands sent to the PlusServer, but this is both tedious and feels like a bad way to design a testing framework. What I'd like to do is to be able to instantiate the real and fake device in the same way, and call the same methods from each. This would mean that the devices I'm interested in simulating would need an interface which both the real and fake device classes would inherit from. So something like
So in the application I can do something like
Does this approach seem viable and appropriate? Happy to clarify things if need be.
cc @dzenanz @jamesobutler
Beta Was this translation helpful? Give feedback.
All reactions