Giter Club home page Giter Club logo

physionet-cardiovascular-signal-toolbox's Introduction

alt text

PhysioNet Cardiovascular Signal Toolbox

  1. Introduction
  2. Full Instructions
  3. Guide to Output
  4. Contributing to this project
  5. FAQ

If you are using this software, please cite:

 Vest A, Da Poian G, Li Q, Liu C, Nemati S, Shah A, Clifford GD, 
 "An Open Source Benchmarked Toolbox for Cardiovascular Waveform and Interval Analysis", 
  Physiological measurement 39, no. 10 (2018): 105004. DOI:10.5281/zenodo.1243111; 2018. 

Introduction

The PhysioNet Cardiovascular Signal Toolbox is a a cardiovascular dynamics analysis package, designed to meet the need in the clinical and scientific community for a validated, standardized, well-documented open-source toolkit to evaluate the relationships between physiological signals and disease. The package not only includes standard HRV tools to generate time and frequency domain metrics from ECG or pulsatile waveforms (like the blood pressure or photoplethysmographic waveforms), but more recent metrics such as acceleration and deceleration capacity and pulse transit time. The package is designed to accommodate a variety of input data, from raw unprocessed and unannotated waveforms, to fully annotated tachogram data. In general, abnormal beat and noise removal and methods for dealing with the missing data are poorly described and highly variant in most of the literature. Therefore, we have included signal processing methods that include state of the art peak detectors, signal quality processing units, and beat/rhythm phenotyping. The package can also analyze the interactions between multiple physiological signals.

Full Instructions:

I. Getting Started

System requirements:

  1. Download and install Matlab 2017b (v9.3) (required Matlab Toolboxes: Signal Processing Toolbox, and Statistics and Machine Learning Toolbox, Neural Network Toolbox)

  2. Add the PhysioNet Cardiovascular Signal Toolbox to your Matlab path: run startup.m

  3. (Optional) rrgen binary - compilation of rrgenV3.c on your system:

    1.  Compile rrgen
        Navigate to rrgen in HRV Toolbox & Compile using gcc
        gcc -Wall rrgenV3.c -lm -o rrgen
            or
        gcc -Wall -o rrgenV3 rrgenV3.c 
    2.  Ensure executable is on the system path, or move executable to
        usr/local/bin or similar location on the path
    3.  Ensure executable is on Matlab's path using the addpath fn
    

II. Starting Analysis

Quick Start:

  1. Review InitializeHRVparams.m and optimize the parameters for your data.
  2. The toolbox does not assume any format of data except that the input of the Main_HRV_Analysis.m fucntion are a two equal length vectors: RR interval and time in units of seconds or the 'raw' ECG signal (physical units,mV) and time. Additionaly, blood pressure waveform and photoplethysmographic/pulsatile data can be analyzed and they should be in the standard physical units (mmHg or normalized units respectively).
  3. Results will be stored in folder called as indicated in the InitializeHRVparams.m If the folder does not exist, it will be created.

III. Guide to Output:

The following metrics are output from the HRV Toolbox:

- t_start   : (s)  Start time of each window analyzed
- t_end     : (s)  End time of each window analyzed

Time domain measures of HRV:

- NNmean    : (ms) mean value of NN intervals
- NNmode    : (ms) mode of NN intervals
- NNmedian  : (ms) median value of NN intervals
- NNskew    : skweness of NN intervals
- NNkurt    : kurtosis of NN intervals
- NNiqr     : interquartile range of NN intervals
- SDNN      : (ms) Standard deviation of all NN intervals.
- RMSSD     : (ms) The square root of the mean of the sum of the squares 
                   of differences between adjacent NN intervals.
- pnn50     : (%) NN50 count divided by the total number of all NN intervals.
              (Number of pairs of adjacent NN intervals differing by more than 50 ms )
- tdflag    :   2 = not enough high SQI data in the window to process
            	(amount of data above threshold1 is greater than threshold2)
		3 = not enough data in the window 
		4 = window is missing too much data
		5 = success

Frequency domain measures of HRV (default using Lomb Periodogram method):

- ulf         : (ms^2) Power in the ultra low frequency range (default < 0.003 Hz)
- vlf         : (ms^2) Power in very low frequency range (default 0.003 <= vlf < 0.04 Hz)
- lf          : (ms^2) Power in low frequency range (default 0.04Hz  <= lf < 0.15 Hz)
- hf          : (ms^2) Power in high frequency range (default 0.15 <= hf < 0.4 Hz)
- lfhf        : Ratio LF [ms^2]/HF [ms^2]
- ttlpwr      : (ms^2) Total spectral power (approximately <0.4 Hz)
- fdflag      : 1 = Lomb Periodogram or other method failed
                2 = not enough high SQI data in the window to process
            	(amount of data above threshold1 is greater than threshold2)
		3 = not enough data in the window
		4 = window is missing too much data
		5 = success

Other HRV measures:

- PRSA - AC     : (ms) acceleration capacity
- PRSA - DC     : (ms) deceleration capacity
- SDANN         : (ms) Standard deviation of the average of NN intervals 
                   in all 5-minute segments of a long recording
- SDNNI         : (ms) Mean of the standard deviation in all 5-minute 
                  segments of a long recording

Entropy measures:

- SampEn        : (a.u.) Sample entropy, which measures the regularity and complexity of a time series
- ApEn          : (a.u.)Approximate entropy, which measures the regularity and complexity of a time series

Long range measures:

- MSE           : First column contains the scale factors, and the second 
                  column provides the corresponding entropy values
 
- DFA - alpha1  : Short range fractal scaling exponents (default 4<=n<16)
- DFA - alpha2  : Long range fractal scaling exponents (default 16<=n<length/4)

Nonlinear HRV measures:

Poincaré plot (PP)
 - SD1        : (ms) standard  deviation  of  projection  of  the  PP    
                on the line perpendicular to the line of identity (y=-x)
 - SD2        : (ms) standard deviation of the projection of the PP on 
                the line of identity (y=x)
 - SD2/SD1    : (ms) SD1/SD2 ratio

Heart Rate Turbulence HRT Analysis:

 - TO         : (%) turbulence onset
 - TS         : turbulence slope    

Detection Annotation Files

Using Main_HRV_Analysis.m, Analyze_ABP_PPG_Waveforms.m to analyze the ECG, PPG and/or ABP the function will return an annotation file with the locations of detected QRS peaks or PPG/ABP onsets:

ECG : *.jqrs (for jqrs detector)
      *.wqrs (for wqrs detector)
      *.sqrs (for sqrs detector)

PPG : *.ppg (for PPG onset)

ABP : *.abp (for ABP onset)

To read these files use the [read_ann.m] function included in the toolbox:

QRS_locations = read_ann('fileName', 'jqrs')
PPG_onsets = read_ann('fileName','ppg') 

Note that QRS locations and PPG/ABP onstets are in samples not in seconds

SQI Annotation Files

The SQI values are also saved as annotations files both for ECG and PPG/ABP

For ECG the SQI values are saved as a number from 0 to 100 in a file with extension:

*.sqijw : comparison of jqrs wrt wqrs detection
*.sqijs : comparison of jqrs wrt sqrs detection

read these files as follows

[sqiTime,~,sqiValue] = read_ann('fileName' , 'sqijw')

For PPG and ABP two different values of SQI are seved in each annotation files and they are related to a specific 'beat', one is a char value (E: excellent beat, A: acceptable beat, Q: unaceptable beat) and the other value is an integer in the range 0-100 given by the average of three SQI values (see PPG_SQI_buf.m)

read *.ppgsqi files as follows

[ppgAnn, ppgSQI, ppgSQInum] = read_ann('fileName', 'sqippg')

V. Contributing to this project

We are more than happy to accept contributions! If you like the project and find it useful, you can also start to improve the code or add new features yourself, it would be a great contribution to the community!

Using the issue tracker

The issue tracker is the preferred channel for bug reports but please do not use the issue tracker for personal support requests.

Bug reports

A bug is a demonstrable problem that is caused by the code in the repository. A good bug report is extremely important to solve the problem! Please, check if the issue has already been reported before opening a new issues.

Please try to be as detailed as possible in your report. Use the provided template! and answer the necessary points: what is your environment? What steps will reproduce the issue? What Matlab verison and OS experience the problem? What would you expect to be the outcome? All these details will help people to fix any potential bugs.

Pull requests

Follow this process if you'd like your work - patches, improvements, new features - considered for inclusion in the project.

  1. Fork the project, clone your fork, and configure the remotes.

  2. Create a new topic branch (off the main project development branch) to contain your feature, change, or fix.

  3. Commit your changes in logical chunks.

  4. Locally merge (or rebase) the upstream development branch into your topic branch.

  5. Push your topic branch up to your fork.

  6. Open a Pull Request with a clear title and description.

IMPORTANT: By submitting a patch, you agree to allow the project owner to license your work under the same license as that used by the project.

IV. FAQ

physionet-cardiovascular-signal-toolbox's People

Contributors

cevacu avatar embar- avatar gariclifford avatar giuliadap avatar jusjusjus avatar perezald avatar qiaoli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

physionet-cardiovascular-signal-toolbox's Issues

toolbox not working for raw ECG

I have downloaded the most updated toolbox (Master folder) and followed all of the instructions however, whenever I run raw ECG data the main code I get empty results with no errors.

All I changed in the initializing script was:
% Define new project name and parameters
case 'ECGdata' % Update with your project name
HRVparams.Fs = 250; % Spacify sampling frequency

Then I run:
[HRVoutput, Results]=Main_HRV_Analysis(rawECGdata,[],'ECGWaveform', HRVparams,'1')

And all I get is:

HRVoutput =

NaN

Results =

0×0 empty char array

Does time have to be included in the input signal? Does the data have to be a specific length? For example I am using data 1-5min length of data sampled at 250Hz.

The analysis error txt file sometimes gives me these:
Basic HRV Analysis faild for subject: 1,

I have tried the demos but only some of them worked and the ones that worked sometimes produced results but they never matched the reference ?

Desktop (please complete the following information):

  • OS:MacOS Catalina
  • Matlab version 2018b and 2020b with all installed toolboxes

I'm not sure what I'm doing wrong here, any help would be greatly appreciated!

RRI time and RRI index used in same variable in prsa.m

Second input variable for prsa.m function is "rri" is ambiguous and is used in two different contexts: index and time.

Cases where "rri" seems to be used as index:


nn_win = rr( rri >= WinStarIdxs(i_win) & rri < WinStarIdxs(i_win) + windowlength );


But "rri" is also re-used in context of time:


Also "rri" comes from Main_HRV_Analysis.m (as "tNN"):

[ac,dc,~] = prsa(NN, tNN, HRVparams, sqi, WinIdxs );

[NN, tNN, WinIdxs, AFWindows,out] = PreparDataForHRVAnlysis(rr,t,ann,sqi,HRVparams,subID);

function [NN, tNN, WinIdxs,AFWindows,out] = PreparDataForHRVAnlysis(rr,t,annotations,sqi,HRVparams,subjectID)

"tNN" created in RRIntervalPreprocess:
[NN, tNN] = RRIntervalPreprocess(rr,t,annotations, HRVparams);

function [cleanNN, cleantNN, flagged_beats] = RRIntervalPreprocess(rr,time,annotations,HRVparams)

according to "cleantNN" description, it "tNN" (and then "rri") should be index:
[NN, tNN] = RRIntervalPreprocess(rr,t,annotations, HRVparams);

Though computationally it could be time variable in seconds also.
Anyway, source is "t" variable at "Main_HRV_Analysis.m", that also has ambiguous definition:
% t - Time indices of the rr interval data (seconds) or


If these variables are time variables (units are seconds), then there is contradiction with cases where it is used as index.

If it is index please remove unit name "seconds" from Main_HRV_Analysis.m and include check whether it is integer. Also seems, we usually don't need it at all as input, because we can generate it internally, e.g. for Main_HRV_Analysis.m

if strcmpi(InputFormat,'RRIntervals')
   t=1:length(InputSig)
end

in other cases it described not be used anyway:

% leave empty for ECG/PPG input

Or to generate internally for prsa.m:
rri=1:length(rr)


Please clarify these variables.

Error in ConvertRawDataToRRIntervals

I can successfully run ConvertRawDataToRRIntervals on most of my raw ECG files, but not on some, and I cannot figure out why. They don't different visually.

I get the following error:

image

The problem seems to come from run_sqrs that returns an empty sqrs_ann line 60 of ConvertRawDataToRRIntervals.

Desktop:

  • Windows 10
  • Matlab 2021b

Demo Failed Matlab R2019a

Hello, Thanks for making this toolbox. I am having trouble with the getting DemoAnnotatedData.m to run successfully. In particular, there seems to be a scientific notation error when writing to .csv. In the AllPatients_HRV_results_allwindows...csv file Variable NNvariance is off by x10^3; for example subject nsr001 NNvariance in NRS_HRV...csv file is 3.2344 and for the actual output on my cpu it is 3234.3955. In addition, SD1SD2 is off by x10^3. In addition the ApEn variable values are off by no detectable metric. Assistant is sorting this out would be much appreciated.

Thanks
~Neil

Documentation for InitializeHRVparams is missing required argument

Describe the bug
Main_HRV_Analysis.m documentation for InitializeHRVparams is missing required argument

To Reproduce
Look at https://github.com/cliffordlab/PhysioNet-Cardiovascular-Signal-Toolbox/blob/master/Main_HRV_Analysis.m line 21 which reads:

       HRVparams   - struct of settings for hrv_toolbox analysis that can
                     be obtained using InitializeHRVparams.m function 
                     HRVparams = InitializeHRVparams();

Steps to reproduce the behavior:

  1. Copy-paste the documented command and try to execute it in Matlab, e.g. HRVparams = InitializeHRVparams();

Result:

Not enough input arguments.

Error in InitializeHRVparams (line 58)
if isempty(project_name)

Just need to update the comment to include the project name string for line 21 of Main_HRV_Analysis.m

Issue when having missing data (?)

Hi,

we adapted the DemRawDataICU.m to analyze one of our ECG files, which has some segments of noisy data and also some missing values (NaNs).
The Toolbox ran well, just as when used with the TestData. However, the .csv file with the Output data had no avgsqi values below the first row whose value was below the HRVparams.sqi.LowQualityThreshold.
Also, the ECG and SQI plots obtained with Plot_SignalDetection_SQI(time, signal(:,1), jqrs_ann, sqijw'./100,'ECG')) did not correspond well in time. The SQI values were all 'compressed' to the beginning of the signal, and segments that looked clean had zero SQI.
We tried to track the error, and we managed to 'solve it' by changing the outputs of the function ConvertRawDataToRRIntervals() as follows:

Original:
function [t,rr,jqrs_ann,SQIjw, StartIdxSQIwindows_jw] = ConvertRawDataToRRIntervals(ECG_RawData ,HRVparams, subjectID)

New:
function [t,rr,jqrs_ann,SQIjs, StartIdxSQIwindows_js] = ConvertRawDataToRRIntervals(ECG_RawData ,HRVparams, subjectID)

We basically matched the annotations with the SQI and the indexes of the windows. This solved both problems: the .csv file has now all the avgsgi values above the threshold, and the two plots correspond well in time (noisy or empty data segments have low SQI).

We are not submitting it as a pull request because we are not sure whether this is right for other types of analyses. Maybe the change has to be done somewhere else?

Best,
Federico

Appending to an existing csv file with different column number

Was trying to understand why it fails to work until I found another output file with the same name in MATLAB path with different output columns. Then SaveHRVoutput can't concatenate two tables. (This can happen if you worked in one directory and then switched current folder to another).
Also, not clear, why it should append to the same file by default and not overwrite it.

In general it is a very cool and advanced toolbox, but it lacks a bit of debugging markers. It can fail quietly with a vague explanation in AnalysisError.txt. At least could ooutput there an original debugger message and stack.

Thanks

Undefined function or variable 'ExportHRVparams'?

Hi,

I am trying to start with PhysioNet-Cardiovascular-Signal-Toolbox with DemoAnnotatedData.m using MATLAB. When I run the script, the following error happens in MATLAB:

Warning: Removed '/Users/albertlau/Documents/MATLAB/PhysioNet-Cardiovascular-Signal-Toolbox-master/Demos/OutputData/ResultsNSR' from the MATLAB path for this MATLAB session.
See 'doc path' for more information.

In DemoAnnotatedData (line 39)
Old Demo Folder deleted

New OUTPUT folder: "OutputData/ResultsNSR"
Undefined function or variable 'ExportHRVparams'.

Error in InitializeHRVparams (line 344)
ExportHRVparams(HRVparams);

Error in DemoAnnotatedData (line 45)

May I know what other things I need to tune/modify before I run the demo?

Thanks so much!

Aureliuz

BIOPAC PPG data cannot meet SQI, resulting dysfunctional calculation of HRV

Hi PhysioNet experts,

I am new with this toolbox. Our lab collected some PPG data, each condition lasts for 5-8 mins. However, when I used the parameters below to replace some default parameters, it seemed most of our data do not have enough good data points.

May I ask how could I confirm if our data could be used for analysis or not? Or how could I adjust the parameters to give it another try?

Thanks a lot!

% initiate InitializeHRVparams
HRVparams=InitializeHRVparams('ABC');
HRVparams.Fs=2000;
HRVparams.windowlength=240;
HRVparams.increment = 60; % Default: 30, seconds increment
HRVparams.preprocess.threshold1=0.8;
HRVparams.RejectionThreshold = 0.30;% Default: 0.2, amount (%) of data that can be rejected before a
% window is considered too low
% quality for analysis
HRVparams.preprocess.method_outliers='cub';
HRVparams.preprocess.minlength = 10;
HRVparams.preprocess.method_unphysio = 'cub';
HRVparams.timedomain.win_tol=0.5;
HRVparams.sqi.LowQualityThreshold = 0.5; % Default: 0.9, Threshold for which SQI represents good data

CreateWindowRRintervals.m not working

when i run the demo- DemoMultiScaleEntropy.m , An error is reported at line 53 (WindIdxs = CreateWindowRRintervals(tNN, NN, HRVparams,'mse');

results : WindIdxs=0

then i apply CreateWindowRRintervals then other rr time series , results : WindIdxs=NaN, can you help me?

missing function PreparDataForHRVAnlysis

Hi,

Trying to use the physionet toolbox for the first time and when running through code on a line-by-line basis to get HRV (which wasn't working using the normal InitializeHRVparams -> Main_HRV_Analysis) I found that matlab was giving me this error when trying to do the pre-processing steps:

[NN, tNN, tWin, AFWindows,out] = PreparDataForHRVAnlysis(rr,t,[],sqi,HRVparams,subID);
Undefined function or variable 'PreparDataForHRVAnlysis'.

I am utilizing MATLAB_2019a on a MacOS Mojave system. Physionet CV toolbox v 1.0.2

Searching in the directory for the toolbox I'm not finding this function there. It doesn't show up after removing/re-downloading the toolbox from the GitHub source.

Does anyone have this function available or have other thoughts?

Thanks!

Testing with MIMIC-III ECG Waveform Data

Hi,

Thank you for this wonderful toolbox. I am trying to calculate HRV for MIMIC ECG signals and need to ask that is this toolbox being tested for subject dataset (Fs=125Hz) ?

Thanks

draw_dtw.m use "dist" function that does not exist in MATLAB core

PhysioNet-Cardiovascular-Signal-Toolbox-master/Tools/PPG_Tools/draw_dtw.m at line 76 use "dist" function that does not exist in MATLAB core. Please replace it with some equivalent or create it as some subfunction.

Warning: MATLAB:UndefinedFunction

Undefined function 'dist' for input arguments of type 'double'.

> draw_dtw:76
> PPG_SQI_buf:145
> calculate_ppgsqi:64

 Analyze_ABP_PPG_Waveforms

error ConvertRawDataToRRIntervals

Hello!
Finally, I successfully run the Basic_Demo with my own ecg imported from acq file: thanks Giulia!!

Then I got this error running the other script:

ConvertRawDataToRRIntervals(ECG_RawData,HRVparams,'HC1')
Subscript indices must either be real positive integers or logicals.

Error in bsqi (line 43)
endtime = max([ann1(end), ann2(end)]);

Error in ConvertRawDataToRRIntervals (line 66)
[>>SQIjs, StartSQIwindows_js] = bsqi(jqrs_ann(:),sqrs_ann(:),HRVparams);

and empty results running the Main_HRV_Analysis. I tried also several windows lengths.
I assume that my own data are ok since the basic demo script got the r_peaks.
On the other hand, where am I wrong?

Thanks in advance!!!

InitializeHRVparams unrecognized

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Type in "DemoAnnotatedData" in the command line
  2. See error

Screenshots
It gives me the following error:
Unrecognized function or variable 'InitializeHRVparams'.

Error in DemoAnnotatedData (line 43)
HRVparams = InitializeHRVparams('demo_NSR');

Desktop (please complete the following information):

  • Matlab version 22a

Error: input signal or RR interval time series is shorter than the desired analysis windows (300 s).

Hi,
Apologies for such a newbie question but I can't figure out what is wrong after trying several tweaks.
The code I'm passing is
Main_HRV_Analysis('array.mat', '' ,'ECGWaveform',InitializeHRVparams('projectName'))
Where the 'array.mat' is a 179600x2 array of raw ECG signal sampled at 500Hz (ie. ~539 seconds).
I set HRVparams.windowlength = 300 in the InitializeHRVparams file but then I get
Error: input signal or RR interval time series is shorter than the desired analysis windows (300 s).

I must be doing something silly here but I can't figure it out; help, please? thanks

HRV toolbox demo not working

Hello,

I tried running the demo but I always have the same error :

Old Demo Folder deleted

New OUTPUT folder: "OutputData\ResultsNSR"
Error on subject nsr001
Error on subject nsr004
Error on subject nsr009

** DemoAnnotatedData: TEST FAILED **
Error: analysis not performed

any suggestions please ?

fMRI Biopac data

Hello!
Is it possible to analyse fMRI biopac data (ECG and PPG) with this toolbox?
I have imported in .mat the .acq ECG but, for instance, I cannot run the BasicDemo with my data since I've not the .hea file. I tried to adapt it but it doesn't run (error in readheader).
Any suggestion?
Thanks in advance!

sampling rate

What is the sampling rate for all the test data in the test data folder which is in the demo folder?

Running Demos in P-C-S-Toolbox

I recently installed P-C-S-Toolbox for use with Matlab R2017b (with associated toolboxes) and am now testing out the demos, particularly DemoRawDataICU.m, since I have an interest in calculating PTT data from ECG and PPG inputs.

Although I am getting output data .csv (and .tex) files, I see the following in the command window:

Index exceeds the number of array elements (0).

Error in GenerateListOfFilesTBA (line 94)
if isnumeric(ids{1})

Error in DemoRawDataICU (line 40)
[subjectIDs,filesTBA] = GenerateListOfFilesTBA(HRVparams.ext,HRVparams.readdata,0);

Error in run (line 91)
evalin('caller', strcat(script, ';'));

This occurs after typing "run DemoRawDataICU.m"

I tried to follow the instructions for compiling rrgen to see if this might help, but I am very new to MATLAB and can't get the instructions to work.

Any feedback or advice is appreciated!
Thank you!

physical vs digital units -> incorrect gain to convert to digital??

Hi,

ConvertRawDataIntervals considers input ECG to be physical, and multiplies signal by GainQrsDetect (i.e., 2000).
However, in wqrsm_fast, WFDB_DEFGAIN = 200.0
So should the gain in ConvertRawDataIntervals be 2000 or 200.0??
Also, it looks like wqrsm_fast multiplies by gain again, although the input to the function already multiplies by GainQrsDetect (i.e., 2000) lines 53 and line 63

Thanks in advance for any feedback on this

Cedric

Issue running toolbox

Describe the bug
Hello, so I have tested the demo and it works but I'm having a problem where when I try to run the tool box using raw ECG signal, I couldn't get the time domain indicators from the toolbox. .csv file were empty but only show the window t_start and t_end. The only way for me to do this is to pass in raw signal using 'ECGWaveform', get the RR intervals and it's time from your toolbox, save it into a file then run the toolbox again using 'RRIntervals' and it gave me the indicators just fine. I'm not sure if this is the ideal way to run this.

I wrote a new script containing these code for getting rr intervals and its time

  1. run([pwd filesep 'startup.m'])
  2. Fs = 128;
  3. HRVparams = InitializeHRVparams('Demo');
  4. HRVparams.Fs = Fs;
  5. [HRVout1, ResultsFileName1] = Main_HRV_Analysis(ekgSignal,[],'ECGWaveform',HRVparams,'1');

then there's another script after I saved rr intervals and its time from your toolbox

  1. HRVparams = InitializeHRVparams('Demo');
  2. Fs = 128;
  3. HRVparams.Fs = Fs;
  4. [HRVOUTpn, ResultsFileNamePn ] = Main_HRV_Analysis(physionetRR,physionetT,'RRIntervals',HRVparams,'1');

I want to be able to just run the toolbox once and generate the indicators for me without me having to save rr intervals and its time. I wonder what is the correct way to do this? Also for InitializeHRVparams('Demo'), I want to use the default values and not change anything is this correct?

  • Matlab version: MATLAB2019a

Dicrotic notch & Diastolic peak

Hello!

Thank you for your excellent work. It is really helpful. When I was using it to extract PPG signal features, I found some questions. I can't find any functions about detecting the Systolic peak, Dicrotic notch and Diastolic peak of PPG signal. In folder named "PPG_Tools", I only found mentions to detect Peaks.

If I miss them, please tell me where they are and how to use them.
If not, do you brilliant guys have some suggestions or reference code? Thanks a lot ^_^

RemoveAFsegments.m is not removing the right segments!

In RemoveAFsegments.m the script tries to identify the segments of RR data that contain the AFs, however it is not taking into consideration the length of the segments used to identify the AFs and therefore is misidentifying the segments.

I propose the following change in the function using beginning and end of window assuming windows are not overlapping - maybe it would be a good idea to not ask for window increment in AF detection (in InitializeHRVparams.m) - just assume no overlapping windows:

function [cleanRRAnalysisWindows,idx_af] = RemoveAFsegments(RRAnalysisWindows,AfAnalysisWindows, AFtest, HRVparams)

cleanRRAnalysisWindows = RRAnalysisWindows;

% Exclude AF Segments
% afsegs = AfAnalysisWindows(AFtest == 1); % afsegs is in seconds
afsegs_int = AfAnalysisWindows(AFtest == 1); %
afsegs_end = AfAnalysisWindows(find(AFtest == 1) + 1);
idx_af = [];

if ~isempty(afsegs_int)
for k = 1:length(afsegs_int)
try
idx_af = [idx_af find(RRAnalysisWindows <= afsegs_int(k) & HRVparams.windowlength + RRAnalysisWindows > afsegs_end(k))];
catch
end
end
idx_af = unique (idx_af); % Do not consider duplicate positions
cleanRRAnalysisWindows(idx_af) = NaN; % Remove all the windows with AF
end

Undefined function or variable 'imdb_unb'.

I was trying to run the PVC_detect function and it throws out this error

"Undefined function or variable 'imdb_unb'."

I am pretty sure i have the toolbox installed correctly and did not miss out on any functions.

Toolbox Not Working!

Thanks for what looks like a great all in one toolbox. I am working with Windows / r2018a, with the neural network toolbox installed. The demo's do not appear to be working for me and I wanted to see if you guys had any suggestions. I do not have the rrgen features installed, but suspect that only explains the error with the standardized data.

Please let me know if you need any additional information to help troubleshoot!

DemoAnnotatedData

Old Demo Folder deleted

New OUTPUT folder: "OutputData\ResultsNSR"
Error on subject nsr001
Error on subject nsr004
Error on subject nsr009
DemoAnnotatedData: TEST FAILED
Error: analysis not performed

DemoRawDataICU

Old Demo Folder deleted
New OUTPUT folder: "OutputData\ResultsICU"
Error using Main_HRV_Analysis (line 108)
Error: imput signal or RR interval time series is shorter than the desired
analysis windows (300 s).
Error in DemoRawDataICU (line 50)
[~, resFilename] = Main_HRV_Analysis(signal(:,1),[],'ECGWaveform',...
Error in run (line 91)
evalin('caller', strcat(script, ';'));

DemoStandardizedData

New OUTPUT folder: "OutputData\ResultsRRgen"
'rrgenV3' is not recognized as an internal or external command,
operable program or batch file.
Array indices must be
positive integers or logical
values.
Error in Main_HRV_Analysis
(line 107)
||
(strcmp(InputFormat,
'RRIntervals') &&
t(end)/HRVparams.Fs<HRVparams.windowlength)
Error in
DemoStandardizedData
(line 51)
[results, resFilename] =
Main_HRV_Analysis(rr,t,'RRIntervals',HRVparams,...
Error in run (line 91)
evalin('caller',
strcat(script, ';'));

DemoRawDataAF - generates a nicely labeled ECG strip / SQI.
TestAFdata_HRV_results_allwindows_20180630.csv is empty with no results, except for two flag values set to 3.

Old Demo Folder deleted
New OUTPUT folder: "OutputData\ResultsAFData"
Creating a new folder: "Annotation", folder is located in C:\01-stp\thirdparty\PhysioNet-Cardiovascular-Signal-Toolbox-master\Demos\OutputData\ResultsAFData\Annotation
AF analysis completed for subject TestAFdata
HRV Analysis completed for subject ID TestAFdata
** DemoRawDataAF: TEST SUCCEEDED **
A file named TestAFdata_HRV_results_allwindows_20180630.csv
has been saved in OutputData\ResultsAFData

Problem with SQI results via .sqiabp, .sqijs, and .sqijw

Describe the bug
In the HRV Outputs file, there are three files that are not showing proper SQI results. The files are .sqiabp, .sqijs, and .sqijw. When I run the mainHRVanalysis for three signals at one time, the resulting HRV output is not showing me an SQI for the ABP onsets.

To Reproduce
Steps to reproduce the behavior:
% import file
A = readtable("A002-0501072681_ARDS_Collection_to_6hr_real_PPG_ECG_ABP_3_var_11_23_21.txt");
A = A{:,:};
disp(length(A(:,1)));
% intialize hrv param

settings = InitializeHRVparams('Testing');
settings.Fs = 240;
disp(settings.Fs);
ECGsig = A(:,2);
abpSig = A(:,3);
ppgSig = A(:,1);
% get sqi
%[HRVout, ResultsFileName ] = Main_HRV_Analysis(A(:,1),[],'PPGWaveform', settings);
[HRVout, ResultsFileName ] = Main_HRV_Analysis(ECGsig,[],'ECGWaveform',settings,'000',[],[], abpSig,'ABP', ppgSig, 'PPG');

%disp(HRVout);

[ppgAnn, ppgSQI, ppgSQInum] = read_ann('000', 'sqippg');
[abpAnn, abpSQI, abpSQInum] = read_ann('000', 'sqiabp');

PPG_onsets = read_ann('000','ppg');
ABP_onsets = read_ann('000','abpm');
QRS_locations = read_ann('000', 'jqrs');

Expected behavior
The abpSQI variable should have SQI but only has N instead of E, Q, or A.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Matlab version and installed toolboxes

Additional context
Add any other context about the problem here.

'readHeader' error

Unrecognized function or variable 'readheader'.

Error in Basic_Demo (line 40)
sigInfo = readheader([InputFolder filesep SigName '.hea']);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.