Block Processing Parser for the Wyko Vision ASCII File Format

Summary

This random access parser allows extraction of arbitrary sub-blocks from the Wyko Vision ASCII image database. It is largely based on the original MITAC ASCII parser, but is relatively minimal in size and optimized for speed. The most important advantage is that the entire database does not have to be parsed to access data, allowing for intelligent block-based processing of a single record groove.
The current version is 1.2.0. Improvements over previous releases include minor bug fixes for special cases when transitioning between 'Bad' and good numerical data. The most recent version fixes a bug to prevent extracting data in a vertically flipped manner.

The source code files are available at [Randparser-1.2.0.zip]

The main function is main.m, which simply demonstrates how to use the random access capabilities to grab arbitrary subarrays from the given database.

See The Wyko Vision ASCII file format for a better understanding of the parser's parent code and its implementation detail.

Function Specification

gethead.m

The function gethead.m gets basic information from the Wyko dataset header for use by the getarray.m function. Therefore, it needs to be executed only once prior to all other calls to getarray.m.

[fid, xysize, zpos] = gethead(inpath)

where

inpath: path and file of input database fid: file ID used by MATLAB file read/write functions xysize: size of total dataset zpos: position in the input file that indicates the beginning of z profile data

getarray.m

The function getarray.m is the random access parser. It uses getcol.m to assemble subcolumns of a 2D array extracted from the database. Due to getcol.m's usage of textscan, this function cannot be run on MATLAB versions prior to 7.0.

[z] = getarray(fid, zpos, xysize, rows, cols, fflag, ds)

where

fid: file ID used by MATLAB file read/write funcitons zpos: position in the input file that indicates the beginning of z profile data xysize: size of total dataset rows: 2 element array. rows(1) is beginning row, rows(2) is ending row of extracted subarray cols: 2 element array. cols(1) is beginning column, cols(2) is ending column of extracted subarray fflag: 1 if database is float. 0 if it is integer ds: integer factor for downsampling of arrays
z: extracted subarray

getcol.m

The function getcol.m returns subcolumns to getarray.m that are concatenated into an array. The concatenation is oriented in this manner due to efficiency considerations with textscan and the organization of the ASCII databases.

[col] = getcol(fid, vrun, startpt, fflag)

where

fid: file ID used by MATLAB file read/write funcitons vrun: size of subcolumn to be extracted startpt: current starting position of subcolumn within database fflag: 1 if database is float. 0 if it is integer
col: extracted subcolumn

isbad.m

The function isbad.m identifies good or bad data in the Z profile. Used by getcol.m while reading blocks of data with textscan. This is necessary because textscan will halt a run when it detects a formatting change in the data (i.e. change from float to string 'Bad').

[true] = isbad(fid, zpos, startpt, floatflag)

where

fid: file ID used by MATLAB file read/write funcitons zpos: beginning of z profile data within database startpt: current starting position of subcolumn within database floatflag: 1 if database is float. 0 if it is integer
true: 1 if currently pointing to Bad data in Z profile. 0 if it is not Bad

getleft.m

The function getleft.m is a subfunction of gethead.m It merely extracts the leftmost data field from the current line.

[left] = getleft(line)

where

line: current line
left: leftmost datafield

getright.m

The function getright.m is a subfunction of gethead.m. It merely extracts the rightmost data field from the current line.

[right] = getright(line)

where

line: current line
right: rightmost datafield

To Do

Global positioning with respect to the center of the record needs to be extracted and tested for accuracy. This will be used as the basis for differentiation along the radial axis when attempting to sonify the lateral deviations of a mono 78rpm record.