Udicus File Manager: Udcs and UdcsChannel Classes

Table of Contents

User Docs:
Basic Features
Addt. Features
Tips & Tricks

Dev Docs:
UDCS
Prog. Tools
Alignment

GUI
Known Bugs
Expansion

SourceForge Logo

Udcs
The main purpose of Udcs is to read and write all of the different file formats. Udcs is a top level inheritable class that has a child for each of the file formats, which takes over the reading/writing once the type of file is determined. Udcs also keeps a list of all the UdcsChannels that have been imported. Every time a new import takes place, a temporary Udcs object is created. The file is imported using the appropriate Udcs child class and data is stored in UdcsChannels. When reading is complete, the temporary Udcs object passes the channels onto the main Udcs object and is then deleted.

UdcsChannel
UdcsChannel was created in order to make file conversion in Udicus easier. Udicus must be able to read three file formats and write two. This means six different direct conversions, and thus six different conversion tools. An easier method is to have a common format that can accommodate data from all the other file formats. All files are imported into UdcsChannel and exported from UdcsChannel. Udicus also provides the option to read from or write UdcsChannel files. Our team has proposed that the new scoring system that is to be developed use UdcsChannel as its input format since it can accommodate many different types of data. This would lift the burden of interpreting files from the scoring system.

The public variables of the UdcsChannel class are given below. Most of the variable names are self-evident, so only the ones that need extra attention will be discussed in detail.

string group_name;
string subject_name;
string channel_type;
string unit_name;
string original_format;
Date start_time;
Date end_time;
double gain_coeff;

unsigned __int64 sample_rate;
unsigned __int64 sample_count;
unsigned char data_type;
unsigned char* valid_map;

FILE* fd;
string temp_filename;
string original_filename;
unsigned int LIST_ID;

Note: 1. ‘string’ is a Microsoft Visual C++ object that is similar to the Standard Template Library string.
2. FILE * is a pointer to a file, also part of Microsoft Visual C++.
3. Refer to the description of the Date class in this manual for a description of the Date class.

UdcsChannel expects all of the above variables to contain correct values, except for group_name and original_format, which may be left blank.

The gain_coeff is a number, most of the time 1.0, which all data values must be multiplied by in order to match their proper values and range. This variable can be used to wrap any signal within the 16 bits of a short integer, matching each integer to a real value.

The sample_rate variable has the unit samples per day. Switching between samples per day and another unit may cause round-off errors.

A number of text strings have been listed in the UdcsChannel header file (udcs.h) to give the user an idea of what may be used as a channel name. These strings are as follows:

- EEG
- EMG
- Temperature
- GrossActivity
- RunningWheel
- WaterBottle
- LightStatus
- Generic

These strings are not interpreted by Udicus, they are only meant for the user. So the user may chose to use different strings.

The units however, are used by Udicus to determine the magnitude of the data, so a specific convention must be followed. The units used by Udicus are listed in the unit list. The unit_name variable also holds an exponent. The unit_name string is formatted so that the actual name of the unit is first in the string. It is followed by an exponent, which is separated by an asterisk. So if the unit was volts, and the exponent was 10^(-4), unit_name would look like this:

V*10^-4

The string original_format tells where the data was initially recorded. It is not necessary for the operation of Udicus, but can be used if the user wishes.

Sample_count holds the number of samples, regardless of the sample size.

The sample size and type information is kept in the data_type. Data_type is one byte where each bit is a Boolean that represents a characteristic of the data type. A number of constants are defined in “udcs.h” to set the type of data samples. Data_type is formed by logical OR ing the appropriate constants. The names of the constants are given in table X.

PDP_FLAG_ISFLOAT
PDP_FLAG_ISSIGNED
PDP_FLAG_IS64
PDP_FLAG_IS32
PDP_FLAG_IS16
PDP_FLAG_IS8
PDP_FLAG_IS4
PDP_FLAG_IS1

The valid_map is an unsigned character array that has one bit corresponding to each sample. The bit tells if the sample is valid or not. Alignment functions as well as some of the recording programs use this. The purpose of having a valid_map is to be able to distinguish between real and padded data, or real data that was recorded when the recoding hardware was experiencing problems.

© 2001 SRI International, Inc., contact skander@skander.com