|
| 1 | +%PYRAVIEW Process raw data into multi-resolution pyramid files. |
| 2 | +% |
| 3 | +% STATUS = pyraview.pyraview(DATA, PREFIX, STEPS, NATIVERATE, STARTTIME) |
| 4 | +% STATUS = pyraview.pyraview(DATA, PREFIX, STEPS, NATIVERATE, STARTTIME, APPEND) |
| 5 | +% STATUS = pyraview.pyraview(DATA, PREFIX, STEPS, NATIVERATE, STARTTIME, APPEND, NUMTHREADS) |
| 6 | +% |
| 7 | +% This function processes a chunk of raw data (DATA) and writes it into |
| 8 | +% a set of decimated binary files (Level Files) suitable for efficient |
| 9 | +% multi-scale visualization. |
| 10 | +% |
| 11 | +% Inputs: |
| 12 | +% DATA - Numeric matrix of size (Samples x Channels). |
| 13 | +% Supported types: int8, uint8, int16, uint16, int32, uint32, |
| 14 | +% int64, uint64, single, double. |
| 15 | +% Data is assumed to be interleaved by sample if provided |
| 16 | +% as Samples x Channels (standard MATLAB convention). |
| 17 | +% |
| 18 | +% PREFIX - String or character vector specifying the base path and |
| 19 | +% name for the output files. The function will generate |
| 20 | +% files named: |
| 21 | +% <PREFIX>_L1.bin |
| 22 | +% <PREFIX>_L2.bin |
| 23 | +% ... |
| 24 | +% <PREFIX>_LN.bin |
| 25 | +% |
| 26 | +% STEPS - Vector of integers specifying the decimation factor for |
| 27 | +% each level relative to the previous level. |
| 28 | +% Example: [100, 10, 10] means: |
| 29 | +% Level 1: Decimated by 100 relative to Raw. |
| 30 | +% Level 2: Decimated by 10 relative to Level 1 (1000 total). |
| 31 | +% Level 3: Decimated by 10 relative to Level 2 (10000 total). |
| 32 | +% |
| 33 | +% NATIVERATE - Scalar double. The sampling rate of the original raw data |
| 34 | +% in Hz. This is stored in the file header. |
| 35 | +% |
| 36 | +% STARTTIME - Scalar double. The start time of the recording in seconds. |
| 37 | +% This is stored in the file header. |
| 38 | +% |
| 39 | +% APPEND - (Optional) Logical/Scalar. Default is false (0). |
| 40 | +% If true (1), the function appends the processed data to |
| 41 | +% existing level files. |
| 42 | +% If false (0), existing files are overwritten. |
| 43 | +% |
| 44 | +% NUMTHREADS - (Optional) Scalar integer. Default is 0 (Auto). |
| 45 | +% Specifies the number of worker threads to use for parallel |
| 46 | +% processing. If 0, the function automatically detects the |
| 47 | +% number of available hardware concurrency. |
| 48 | +% |
| 49 | +% Outputs: |
| 50 | +% STATUS - Scalar double. |
| 51 | +% 0 on success. |
| 52 | +% Negative values indicate errors (e.g., I/O error, type mismatch). |
| 53 | +% If the function fails, it may also throw a MATLAB error. |
| 54 | +% |
| 55 | +% File Format: |
| 56 | +% The generated files are binary files with a 1024-byte header followed |
| 57 | +% by the data. The data is stored in a planar layout (all samples for |
| 58 | +% Channel 1, then Channel 2, etc.). Each "sample" in the level file |
| 59 | +% consists of a Minimum and Maximum value pair to preserve signal |
| 60 | +% envelope information during decimation. |
| 61 | +% |
| 62 | +% Example: |
| 63 | +% % Process 10 seconds of 1kHz data into 3 levels |
| 64 | +% fs = 1000; |
| 65 | +% data = randn(10000, 2); % 10s, 2 channels |
| 66 | +% steps = [10, 10]; % L1=10x, L2=100x |
| 67 | +% |
| 68 | +% % Generates 'mydata_L1.bin' and 'mydata_L2.bin' |
| 69 | +% status = pyraview.pyraview(data, 'mydata', steps, fs, 0); |
| 70 | +% |
| 71 | +% See also PYRAVIEW.READFILE, PYRAVIEW.DATASET |
0 commit comments