nsMCDLibrary Neuroshare Implementation for MC_Rack Data
Information in this document is subject to change without notice. No part of this document may be reproduced or transmitted without the express written permission of Multi Channel Systems MCS GmbH. While every precaution has been taken in the preparation of this document, the publisher and the author assume no responsibility for errors or omissions, or for damages resulting from the use of information contained in this document or from the use of programs and source code that may accompany it.
Table of Contents 1 1.1 1.2 Introduction About Matlab and Neuroshare Installation of Neuroshare Library 7 7 8 2 2.1 2.2 2.3 2.4 2.5 2.6 Implementation Details Mapping of Continuous Data Mapping of Triggered Data Entities 2.3.1 Event Entities 2.3.2 Analog Entities 2.3.3 Segment Entities 2.3.4 Neural Event Entities Nomenclature for Entities Configure Behavior Missing 11 11 12 13 13 13 14 14 14 15 15 3 3.1 3.2 3.3 3.4 MCS Specific Matlab Functions mcs_SetLibrary.m: Summary of Functionality mcs_Info.
1 Introduction 1.1 About Matlab and Neuroshare Matlab is a software package for numerical calculations and for the visualisation of data in the technical and scientific sector. Using Matlab for the analysis of company specific data files, an interface is needed. The Neuroshare Matlab Application Programming Interface (API) is the widely used interface for accessing physiological experiment data files.
Matlab and Neuroshare 1.2 Installation of Neuroshare Library To implement the Neuroshare software you first have to download the Neuroshare library from the MCS web site: http://www.multichannelsystems.com/downloads/software. Choose the version you need for your computer. Download the Neuroshare version you need and save the zip file in the respective folder. Important: Please unpack the nsMCDLibrary_37.
Points to Discuss The next step is most important: Unpack the nsMCDLibrary.zip file, otherwise the included information is not ready for use with Matlab! All packages contain this documentation and the library for the respective system, example source files to access the Neuroshare library directly from your own program code, the sources for the “mexprog“ library that is needed for the interface to Matlab as well as the Matlab functions. "mexprog" is the interface between the Neuroshare.dll and Matlab.
Matlab and Neuroshare To do so, please start Matlab. Open menu “File” and choose “Set Path”. Click the button “Add Folder”. Browse through the folders an set following path: C:\Eigene Dateien\Downloads\nsMCDLibrary_3.
Points to Discuss 2 Implementation Details MC_Rack has two different recording types. Both, continuous and triggered data, can be handled with the Neuroshare library. The mapping is a little bit different for each type, so the mapping is shown for each type separately. 2.
Matlab and Neuroshare 2.
Points to Discuss 2.3 Entities 2.3.1 Event Entities Each of the 16 bits of the digital data channel is represented as one event entity. Each change on the individual digital line results in a new event in the entity with the next index. The event information is in one 8 bit (byte) value. Its value is 1 for a change from 0 to 1 on the digital line and μ1 (255) for a change from 1 to 0 on the digital line. Triggers are mapped to one event entity for each trigger stream.
Matlab and Neuroshare 2.3.3 Segment Entities Spike streams are represented in segment entities. Spikes (or wave forms) are sampled independently for each channel. This means there is always only one source per segment entity. The number of sources is always 1. Each original channel from MC_Rack data forms one entity in Neuroshare. The different gain is considered. Data is given in Volt of the original input. For triggered data all analog entities are also represented as segment entities.
Points to Discuss 2.5 Configure Behavior The behavior of the Dll can be configured by a file in the ini-file format. All parameters are in the section [Settings]. BaseIsPressedStart configures how times are interpreted. 0: times start at 0 for each file (default and old behavior) 1: times start at the time when the start button is pressed.
Matlab and Neuroshare 3 MCS Specific Matlab Functions All functions listed in the following can be executed by mcs_ExampleScript. mcs_ExampleScript might serve as example and shows how to work with the given functions. mcs_ExampleScript generates all parameters needed to run and to perform the following Matlab functions: - mcs_Info.m - mcs_GetEntities.m - mcs_Graphic.m mcs_ExampleScript uses three predefined Neuroshare functions (“ns_...
Points to Discuss The table below shows possible designations. They can occur in various combinations.
Matlab and Neuroshare 3.1 mcs_SetLibrary.m: Summary of Functionality mcs_SetLibrary is a further implementation of ns_SetLibrary. mcs_SetLibrary supplements ns_SetLibrary through an optimized sequence of events if ns_SetLibrary is not able to open the required file. mcs_SetLibrary returns more information in the form of error and status messages and in case of failure, the function parse the Matlab path and tries to open the file using different paths.
Points to Discuss 3.2 mcs_Info.m: Summary of Functionality mcs_Info is a function to show information about the streams that are in a certain file given as stream, type, n, TimeSpan and infotext. The output contains the stream name as a eight digits sequence, the type of entity, n is the number of channels per stream, TimeSpan gives you information about the duration of data collection and infotext contains optional information about the data type.
Matlab and Neuroshare 3.3 mcs_GetEntities.m: Summary of Functionality: mcs_GetEntities is a function to generate a vector of entity numbers of entities with a given characteristic. mcs_GetEntities uses ns_GetFileInfo to produce the structure FileInfo. FileInfo contains information about EntityCount, needed to call ns_GetEntityInfo. ns_GetEntityInfo retrieves general entity information and type of entity saved in the structure EntityInfo that contains EntityLabel, EntityType and ItemCount.
Points to Discuss 3.4 mcs_Graphic.m: Summary of Functionality mcs_Graphic plots analog and triggered entities. mcs_Graphic uses ns_GetEntityInfo to get information about the EntityType. With this information, it is possible to switch between analog (EntityType = 2) and segment (EntityType = 3) data. In case of analog data, ns_GetAnalogInfo is called to get information about the location locX and locY.
Matlab and Neuroshare 4 Toolboxes that use Neuroshare For advanced users: The toolboxes FIND (http://find.bccn.uni-freiburg.de/) and sigTOOL (http://sigtool.sourceforge.net/) use Neuroshare to access data. They already contain the necessary Matlab interface to the Neuroshare Dll. If your FIND or sigTOOL installations have only an older version of the nsMCDLibrary.dll, just replace the nsMCDLibrary.dll with the newer one.