Getting Started

This page gives details about using neuroshare libraries in your C code.



To Start

  1. Get a Neuroshare DLL by visiting the download area.
  2. Get a Sample Data file. Some vendors already have them on the web.
  3. Get the files ns.c and ns.h by visiting the CVS area .
  4. Include these files in your project and you are good to go.


How is data organzied

Everything is an entity, and there are 4 types of entities: Segment, Event, Analog and Neural Events.

  • Segment entities are brief snippets of time extracted from a high-sample rate data stream.
  • Values from a serial input would show up as event entities.
  • Analog entities are continuously sampled data streams, such as LFP or EEG recordings.
  • Neural event entities are just the timestamps of segment entites.

Almost all data is organized using the same pattern. An example is likely the easist to follow.
Lets say we are interested in finding the 3rd data point, of the 2nd entity in the 1st file. Then:

  • hFile = 1             hFile is 1 based. It is the only variable that is.
  • dwEntityID = 1   0 based
  • dwIndex = 2       0 based

Most applications using neuroshare data will act the same way. In particular the following steps will be done:

  1. Get a handle to the neuroshare DLL by calling ns_LoadLibrary.
  2. Get a file handle (hFile) by calling ns_OpenFile.
  3. Find out how many enties exist by calling ns_GetFileInfo. The field of interest is ns_FILEINFO.dwEntityCount.
  4. Separate the entities into the different types by calling ns_GetEntityInfo. The field of interest is dwEntityType.
  5. Do any data processing.
  6. Close the file handle by calling ns_CloseFile.
  7. Release the neuroshare DLL by calling ns_CloseLibrary.


API Weirdness

  • Every pointer value is allowed to be NULL. A value of NULL means that this information is not to be returned. In particular this means it is perfectly valid to do a call to ns_GetFileInfo with the Info pointer set to NULL. This would not be useful, but it is allowed and no error would be generated.

  • In the function ns_GetAnalogData you pass in the size of the buffer and get back the number of points until a gap is found. Lets say you have 100 points, a gap, then 100 more points. If you ask for 200 points, you will get just that. 200 points, and the num-of-points-until-a-gap will be set to 100. If as a consumer of a dll, you choose to ignore that the 2nd hundred points really are there (as is more natural), and then do a call for the 100 points starting at point 101, that is your prerogative. This weirdness is a potential gotcha for people who create DLLs.



Useful resources

The DLL tester will allow you see your data. It will not graph data, but does allow you to verify what the values should be. It is GUI based and easy to understand.

The file main.cpp is part of our very simple test of using a neuroshare dll. We hope you find it useful.





BACK TO TOP Comments/Suggestions to webmaster@neuroshare.org
Copyright (C) 2001-2007 neuroshare.org, All rights reserved.
Campaign for a Non-Browser Specific WWW SourceForge.net Logo