Interfacing with MRI scanner

Hi Chris,

we have presumably a rather simple issue atm.

We would like to perform an mWorks experiment in an MRI scanner. Once the scanner is ready to record, we would like to start our procedure.

So far we have achieved this using an NI card. The scanner sent a TTL pulse, the NI card received it and mWorks only continued to run the experiment once iut received the pulse.

The scanner we are intending to use, sends the number “5” once it is ready. We can connect the that input to our minimac and the number 5 is being produced (e.g. on notepad). Would it be possible to use this keyboard input number “5” as input to continue running the mWorks procedure?

Thanks for your help with this,

Marcus

Hi again,

please find attached the xml file we have been using so far. It would be great if you could adjust it, such that the dummy variable is able to react to the number 5 keyboard input.

Thanks for your help with this,

Marcus

Hi Marcus,

So far we have achieved this using an NI card. The scanner sent a TTL pulse, the NI card received it and mWorks only continued to run the experiment once iut received the pulse.

This is still probably the best way to receive the trigger from the scanner. If you just need a replacement for the NI device, I can make some suggestions.

The scanner we are intending to use, sends the number “5” once it is ready. We can connect the that input to our minimac and the number 5 is being produced (e.g. on notepad). Would it be possible to use this keyboard input number “5” as input to continue running the mWorks procedure?

That’s interesting. Does the scanner connect to the computer via USB and appear as a keyboard input? If so, then MWorks should be able to receive the “5” via a USB HID device.

please find attached the xml file we have been using so far.

I think the file may have been corrupted in transit, as it doesn’t appear to contain XML. Can you try sending it again?

Thanks,
Chris

Hi Chris,

thanks for the feedback.

The scanner is connected to some sort of interface box. This box can be connected to a PC via USB and sends the number “5” whenever a scan starts. Best case scenario, I just need to bring my macbook and run the experiment with that, rather than with the NI card attached.

Please find attached an xml that hopefully works. I already put in the USB HID Device and USB HID Input device, but I am not entirely sure about how to use it. Maybe you can make the necessary adaptations, such that I can use it and remove the NI card?

Thanks for your help with this,

Marcus

Attachment: xml.zip (6.33 KB)

Hi Marcus,

The scanner is connected to some sort of interface box. This box can be connected to a PC via USB and sends the number “5” whenever a scan starts.

OK. It seems likely that the scanner does indeed appear as a USB keyboard device to macOS, so hopefully MWorks’ USB HID interface will work.

Please find attached an xml that hopefully works.

Thanks, I got it this time.

I’ve attached a modified version that will watch for events on the “5” key and set the variable “five_pressed” to one when the key is pressed, zero when it’s released (with “press” and “release” being simulated by the MRI hardware). The usage value for the key (34) corresponds to the standard “5” key on a US/English Mac keyboard. It’s possible that the MRI sends a different type of “5” (e.g. the “5” in the numeric keypad of an extended keyboard). If MWorks doesn’t register the “5” when you expect it, try setting log_all_input_values to YES. This will cause all inputs received from the device to be logged to the MWServer console, and you should be able to read the correct usage value from there.

Also, since both the real keyboard and the simulated MRI keyboard will appear as USB keyboards to the OS, you’ll almost certainly need to set preferred_location_id to tell MWorks which one to use. To do this, load the experiment once as is. MWorks will print an error message saying there are multiple matching devices and listing the location ID’s for each. You can then set the appropriate ID in your XML file and reload.

If you need more help with this, please let me know!

Cheers,
Chris

Attachment: with_keyboard.zip (6.44 KB)