ikarosilva / wfdb-app-toolbox

The WFDB Toolbox for MATLAB/Octave is a collection of functions for reading, writing, and processing physiologic signals in the formats used by PhysioNet (see README for details).
http://physionet.org/physiotools/matlab/wfdb-app-matlab/
GNU General Public License v3.0
93 stars 46 forks source link

How to use local Data of MIT-BIH Normal Sinus Rhythm Database? #133

Closed sami10007 closed 8 years ago

sami10007 commented 8 years ago

I am trying to use the local data of Physionet MIT-BIH NSRDB at /home/masi/Documents/DI/NSRDB/ with WFDB 0-9-10 installed in /home/masi/Documents/DI/wfdb-app-toolbox/ which tree is here. I downloaded NSRDB datafiles into /home/masi/Documents/DI/NSRDB/ directory which I would like to use with WFDB so saving in the internet connection.

Permission corrections and verified by MATLAB premium service

I edited the file and change the WFDB_PATH variable to the location of your data (line 50) in /home/masi/Documents/DI/mcode/wfdbloadlib.m. By default in the file it is initialized to an empty array. Relevant part of the code

root@masiAsus:/home/masi/Documents/DI/wfdb-app-toolbox/mcode# cat wfdbloadlib.m  | grep WFDB_PATH
%WFDB_PATH: If empty, will use the default given config.WFDB_PATH
WFDB_PATH=['/home/masi/Documents/DI/'];
CACHE_SOURCE=[]; %If empty, defaults to last element of WFDB_PATH
        if(isempty(WFDB_PATH))
            WFDB_PATH=['. ' tmpCache ' http://physionet.org/physiobank/database/'];
        config.WFDB_PATH=WFDB_PATH;
        ind=strfind(config.WFDB_PATH,'http');
            CACHE_SOURCE=config.WFDB_PATH(ind:end);
    setenv('WFDB',config.WFDB_PATH);

Directory content in /home/masi/Documents/DI/NSRDB/

masi@masiAsus:~/Documents/DI/NSRDB$ ls -la
total 596880
drwx------ 2 masi masi     4096 Nov  1 20:37 .
drwx------ 5 masi masi    12288 Nov  8 16:44 ..
-rw-r--r-- 1 masi masi   304326 Nov  1 20:37 16265.atr
-rw-r--r-- 1 masi masi 35192832 Nov  1 20:36 16265.dat
-rw-r--r-- 1 masi masi      118 Nov  1 20:36 16265.hea
-rw-r--r-- 1 masi masi      108 Nov  1 20:37 16265.hea-
-rw-r--r-- 1 masi masi       76 Nov  1 20:37 16265.xws
-rw-r--r-- 1 masi masi   268342 Nov  1 20:37 16272.atr
-rw-r--r-- 1 masi masi 34560000 Nov  1 20:36 16272.dat
-rw-r--r-- 1 masi masi      106 Nov  1 20:37 16272.hea-
-rw-r--r-- 1 masi masi       76 Nov  1 20:37 16272.xws
-rw-r--r-- 1 masi masi   250552 Nov  1 20:37 16273.atr
-rw-r--r-- 1 masi masi   250552 Nov  1 20:37 16273.atr-
-rw-r--r-- 1 masi masi 34062336 Nov  1 20:36 16273.dat
-rw-r--r-- 1 masi masi      107 Nov  1 20:37 16273.hea-
-rw-r--r-- 1 masi masi      107 Nov  1 20:37 16273.hea--
-rw-r--r-- 1 masi masi       76 Nov  1 20:37 16273.xws
-rw-r--r-- 1 masi masi   314364 Nov  1 20:37 16420.atr
-rw-r--r-- 1 masi masi 33153024 Nov  1 20:36 16420.dat
-rw-r--r-- 1 masi masi      106 Nov  1 20:37 16420.hea-
-rw-r--r-- 1 masi masi       76 Nov  1 20:37 16420.xws
-rw-r--r-- 1 masi masi   257534 Nov  1 20:37 16483.atr
-rw-r--r-- 1 masi masi 35880960 Nov  1 20:37 16483.dat
-rw-r--r-- 1 masi masi      107 Nov  1 20:37 16483.hea-
-rw-r--r-- 1 masi masi       76 Nov  1 20:37 16483.xws
-rw-r--r-- 1 masi masi   274178 Nov  1 20:37 16539.atr
-rw-r--r-- 1 masi masi   274218 Nov  1 20:37 16539.atr-
-rw-r--r-- 1 masi masi 33982464 Nov  1 20:37 16539.dat
-rw-r--r-- 1 masi masi      107 Nov  1 20:37 16539.hea-
-rw-r--r-- 1 masi masi       76 Nov  1 20:37 16539.xws
-rw-r--r-- 1 masi masi   461400 Nov  1 20:37 16773.atr
-rw-r--r-- 1 masi masi   461338 Nov  1 20:37 16773.atr-
-rw-r--r-- 1 masi masi 33140736 Nov  1 20:37 16773.dat
-rw-r--r-- 1 masi masi      108 Nov  1 20:37 16773.hea-
-rw-r--r-- 1 masi masi       76 Nov  1 20:37 16773.xws
-rw-r--r-- 1 masi masi   206454 Nov  1 20:37 16786.atr
-rw-r--r-- 1 masi masi 33853440 Nov  1 20:37 16786.dat
-rw-r--r-- 1 masi masi      105 Nov  1 20:37 16786.hea-
-rw-r--r-- 1 masi masi       76 Nov  1 20:37 16786.xws
-rw-r--r-- 1 masi masi   257590 Nov  1 20:37 16795.atr
-rw-r--r-- 1 masi masi 32600064 Nov  1 20:37 16795.dat
-rw-r--r-- 1 masi masi      104 Nov  1 20:37 16795.hea-
-rw-r--r-- 1 masi masi       76 Nov  1 20:37 16795.xws
-rw-r--r-- 1 masi masi   218098 Nov  1 20:37 17052.atr
-rw-r--r-- 1 masi masi 31979520 Nov  1 20:37 17052.dat
-rw-r--r-- 1 masi masi      107 Nov  1 20:37 17052.hea-
-rw-r--r-- 1 masi masi       76 Nov  1 20:37 17052.xws
-rw-r--r-- 1 masi masi   261466 Nov  1 20:37 17453.atr
-rw-r--r-- 1 masi masi 33705984 Nov  1 20:37 17453.dat
-rw-r--r-- 1 masi masi      106 Nov  1 20:37 17453.hea-
-rw-r--r-- 1 masi masi       76 Nov  1 20:37 17453.xws
-rw-r--r-- 1 masi masi   413624 Nov  1 20:37 18177.atr
-rw-r--r-- 1 masi masi 35880960 Nov  1 20:37 18177.dat
-rw-r--r-- 1 masi masi      107 Nov  1 20:37 18177.hea-
-rw-r--r-- 1 masi masi       76 Nov  1 20:37 18177.xws
-rw-r--r-- 1 masi masi   232250 Nov  1 20:37 18184.atr
-rw-r--r-- 1 masi masi 32827392 Nov  1 20:37 18184.dat
-rw-r--r-- 1 masi masi      106 Nov  1 20:37 18184.hea-
-rw-r--r-- 1 masi masi       76 Nov  1 20:37 18184.xws
-rw-r--r-- 1 masi masi   390826 Nov  1 20:37 19088.atr
-rw-r--r-- 1 masi masi 32901120 Nov  1 20:37 19088.dat
-rw-r--r-- 1 masi masi      106 Nov  1 20:37 19088.hea-
-rw-r--r-- 1 masi masi       76 Nov  1 20:37 19088.xws
-rw-r--r-- 1 masi masi   243326 Nov  1 20:37 19090.atr
-rw-r--r-- 1 masi masi 33429504 Nov  1 20:37 19090.dat
-rw-r--r-- 1 masi masi      106 Nov  1 20:37 19090.hea-
-rw-r--r-- 1 masi masi       76 Nov  1 20:37 19090.xws
-rw-r--r-- 1 masi masi   236284 Nov  1 20:37 19093.atr
-rw-r--r-- 1 masi masi 32117760 Nov  1 20:37 19093.dat
-rw-r--r-- 1 masi masi      107 Nov  1 20:37 19093.hea-
-rw-r--r-- 1 masi masi       76 Nov  1 20:37 19093.xws
-rw-r--r-- 1 masi masi   259694 Nov  1 20:37 19140.atr
-rw-r--r-- 1 masi masi 33417216 Nov  1 20:37 19140.dat
-rw-r--r-- 1 masi masi      106 Nov  1 20:37 19140.hea-
-rw-r--r-- 1 masi masi       76 Nov  1 20:37 19140.xws
-rw-r--r-- 1 masi masi   349972 Nov  1 20:37 19830.atr
-rw-r--r-- 1 masi masi 32105472 Nov  1 20:37 19830.dat
-rw-r--r-- 1 masi masi      107 Nov  1 20:37 19830.hea-
-rw-r--r-- 1 masi masi       76 Nov  1 20:37 19830.xws

I am trying to run wfdb rdsamp on those files, just to get the ECG signal for 25 minutes. I tried to access the data similarly as with MIT-BIH Arrhythmia database but unsuccessfully. Code

WFDB_PATH=['/home/masi/Documents/DI/']; % https://github.com/ikarosilva/wfdb-app-toolbox/issues/133
% https://www.physionet.org/physiobank/database/nsrdb/
database = 'nsrdb/'; 
channel = 1; 
patient = 16272; 
[~, cSignal] = rdsamp(strcat(database,num2str(patient)),channel)

Errors

Error using rdsamp (line 203)
Could not find record: NSRDB/16272. Search path is set to: '/home/masi/Documents/DI/'

Error in vertaa (line 164)
        [~, cSignals{cIndex}]=rdsamp(strcat(database,num2str(patient)),channel); % plot(tm,sig);

In some temporal successful attempts earlier, the output of tic; sig=rdsamp('16272'); toc; has been more than 170 seconds when the data locates locally in my machine. This indicates that something has been wrong in my settings so I started everything again now, see Setup 1 and Workaroud, where neither one works.

Setup 1

In Terminal

cd ~/Testfolder/
git clone https://github.com/ikarosilva/wfdb-app-toolbox.git
matlab &

In MATLAB

[old_path]=which('rdsamp');if(~isempty(old_path)) rmpath(old_path(1:end-8)); end
cd wfdb-app-toolbox/mcode
addpath(pwd);savepath

WFDB_PATH=['/home/masi/Documents/DI/']; % https://github.com/ikarosilva/wfdb-app-toolbox/issues/133

I want to run a script now. It asks me to change the location. I change it. I run the script and get the error

Error using rdsamp (line 203)
Could not find record: NSRDB/16272. Search path is set to: '/home/masi/Documents/DI/'

Error in vertaa_kahta_koko_signaalia (line 164)
        [~, cSignals{cIndex}]=rdsamp(strcat(database,num2str(patient)),channel); % plot(tm,sig);

Configs after running the script

>> [~,config]=wfdbloadlib

config = 

  struct with fields:

       MATLAB_VERSION: '9.1.0.441655 (R2016b)'
             inOctave: 0
         WFDB_VERSION: '[10.5.24]'
       WFDB_JAVA_HOME: ' /home/masi/Documents/DI/wfdb-app-toolbox/mcode/'
      WFDB_NATIVE_BIN: ' /home/masi/Documents/DI/wfdb-app-toolbox/mcode/nativelibs/linux/'
        EXECUTING_DIR: ' null'
               osName: 'linux'
           fullOsName: ' Linux'
               osArch: ' amd64'
       customArchFlag: ' false'
            OSVersion: ' 3.16.0-4-amd64'
           JVMVersion: ' 1.7.0_60]'
          MATLAB_PATH: '/home/masi/Documents/DI/wfdb-app-toolbox/mcode/'
    WFDB_JAVA_VERSION: 'wfdb-app-JVM7-0-9-10.jar'
          DEBUG_LEVEL: 0
    NETWORK_WAIT_TIME: 1000
          MATLAB_ARCH: 'glnxa64'
            WFDB_PATH: '/home/masi/Documents/DI/'
              WFDBCAL: ' /home/masi/Documents/DI/wfdb-app-toolbox/mcode//database/wfdbcal'
       WFDB_CUSTOMLIB: 0
         CACHE_SOURCE: []
           CACHE_DEST: []
                CACHE: 0

Configs before running the script is the same as after running the script now after pathdef.m permission change

>> [~,config]=wfdbloadlib

config = 

  struct with fields:

       MATLAB_VERSION: '9.1.0.441655 (R2016b)'
             inOctave: 0
         WFDB_VERSION: '[10.5.24]'
       WFDB_JAVA_HOME: ' /home/masi/Documents/DI/wfdb-app-toolbox/mcode/'
      WFDB_NATIVE_BIN: ' /home/masi/Documents/DI/wfdb-app-toolbox/mcode/nativelibs/linux/'
        EXECUTING_DIR: ' null'
               osName: 'linux'
           fullOsName: ' Linux'
               osArch: ' amd64'
       customArchFlag: ' false'
            OSVersion: ' 3.16.0-4-amd64'
           JVMVersion: ' 1.7.0_60]'
          MATLAB_PATH: '/home/masi/Documents/DI/wfdb-app-toolbox/mcode/'
    WFDB_JAVA_VERSION: 'wfdb-app-JVM7-0-9-10.jar'
          DEBUG_LEVEL: 0
    NETWORK_WAIT_TIME: 1000
          MATLAB_ARCH: 'glnxa64'
            WFDB_PATH: '/home/masi/Documents/DI/'
              WFDBCAL: ' /home/masi/Documents/DI/wfdb-app-toolbox/mcode//database/wfdbcal'
       WFDB_CUSTOMLIB: 0
         CACHE_SOURCE: []
           CACHE_DEST: []
                CACHE: 0

Workaround

Run the following line before each script in MATLAB

home = '/home/masi/';
addpath(fullfile(home, 'Documents/DI/', 'wfdb-app-toolbox', 'mcode'));
WFDB_PATH=['/home/masi/Documents/DI/']; % https://github.com/ikarosilva/wfdb-app-toolbox/issues/133

database = 'nsrdb/'; 
channel = 1; 
patient = 16272; 
[~, cSignal] = rdsamp(strcat(database,num2str(patient)),channel)

Output unsuccessful

Error using rdsamp (line 203)
Could not find record: nsrdb/16272. Search path is set to: '/home/masi/Documents/DI/'

Configs after running the script

>> [~,config]=wfdbloadlib

config = 

  struct with fields:

       MATLAB_VERSION: '9.1.0.441655 (R2016b)'
             inOctave: 0
         WFDB_VERSION: '[10.5.24]'
       WFDB_JAVA_HOME: ' /home/masi/Documents/DI/wfdb-app-toolbox/mcode/'
      WFDB_NATIVE_BIN: ' /home/masi/Documents/DI/wfdb-app-toolbox/mcode/nativelibs/linux/'
        EXECUTING_DIR: ' null'
               osName: 'linux'
           fullOsName: ' Linux'
               osArch: ' amd64'
       customArchFlag: ' false'
            OSVersion: ' 3.16.0-4-amd64'
           JVMVersion: ' 1.7.0_60]'
          MATLAB_PATH: '/home/masi/Documents/DI/wfdb-app-toolbox/mcode/'
    WFDB_JAVA_VERSION: 'wfdb-app-JVM7-0-9-10.jar'
          DEBUG_LEVEL: 0
    NETWORK_WAIT_TIME: 1000
          MATLAB_ARCH: 'glnxa64'
            WFDB_PATH: '/home/masi/Documents/DI/'
              WFDBCAL: ' /home/masi/Documents/DI/wfdb-app-toolbox/mcode//database/wfdbcal'
       WFDB_CUSTOMLIB: 0
         CACHE_SOURCE: []
           CACHE_DEST: []
                CACHE: 0

Workaround 2

By Alistair recommendation, I duplicate all scripts to /home/masi/Documents/DI/NSRDB/ and simplify the main script

masi@masiAsus:~/Documents/DI$ cp vertaa.m getNSRDBecgs.m
masi@masiAsus:~/Documents/DI$ mv getNSRDBecgs.m NSRDB/
masi@masiAsus:~/Documents/DI$ cp -r wfdb-app-toolbox/mcode/* NSRDB/

Complete Script

close all; clear all; clc;
cd '/home/masi/Documents/DI/NSRDB/'
database = 'NSRDB/'; 
interval=10; 
home='/home/masi/';
[~,u]=rdsamp(strcat(database,num2str(201)),1); 

Output

Error using rdsamp (line 203)
Could not find record: NSRDB/201. Search path is set to: '.
/home/masi/Documents/DI/NSRDB/../database/ http://physionet.org/physiobank/database/'

Error in getECGsNSRDB (line 6)
[~, u]=rdsamp(strcat(database,num2str(201)),1);

File tree in /home/masi/Documents/NSRDB/

masi@masiAsus:~/Documents/DI/NSRDB$ tree
.
├── 16265.atr
├── 16265.dat
├── 16265.hea
├── 16265.hea-
├── 16265.xws
├── 16272.atr
├── 16272.dat
├── 16272.hea-
├── 16272.xws
├── 16273.atr
├── 16273.atr-
├── 16273.dat
├── 16273.hea-
├── 16273.hea--
├── 16273.xws
├── 16420.atr
├── 16420.dat
├── 16420.hea-
├── 16420.xws
├── 16483.atr
├── 16483.dat
├── 16483.hea-
├── 16483.xws
├── 16539.atr
├── 16539.atr-
├── 16539.dat
├── 16539.hea-
├── 16539.xws
├── 16773.atr
├── 16773.atr-
├── 16773.dat
├── 16773.hea-
├── 16773.xws
├── 16786.atr
├── 16786.dat
├── 16786.hea-
├── 16786.xws
├── 16795.atr
├── 16795.dat
├── 16795.hea-
├── 16795.xws
├── 17052.atr
├── 17052.dat
├── 17052.hea-
├── 17052.xws
├── 17453.atr
├── 17453.dat
├── 17453.hea-
├── 17453.xws
├── 18177.atr
├── 18177.dat
├── 18177.hea-
├── 18177.xws
├── 18184.atr
├── 18184.dat
├── 18184.hea-
├── 18184.xws
├── 19088.atr
├── 19088.dat
├── 19088.hea-
├── 19088.xws
├── 19090.atr
├── 19090.dat
├── 19090.hea-
├── 19090.xws
├── 19093.atr
├── 19093.dat
├── 19093.hea-
├── 19093.xws
├── 19140.atr
├── 19140.dat
├── 19140.hea-
├── 19140.xws
├── 19830.atr
├── 19830.dat
├── 19830.hea-
├── 19830.xws
├── ann2rr.m
├── bxb.m
├── Contents.m
├── corrint.m
├── createArrays.m
├── dfa.m
├── ecgpuwave.m
├── edr.m
├── example
│   ├── 100a.atr
│   ├── 100a.hea
│   ├── 100s.atr
│   ├── 100s.dat
│   ├── 100s.hea
│   ├── a01.dat
│   ├── a01.entry1
│   ├── a01.fqrs
│   ├── a01.hea
│   ├── f1o02.dat
│   ├── f1o02.ecg
│   ├── f1o02.hea
│   ├── fort.20
│   ├── fort.21
│   └── fort.6
├── getECGsNSRDB.m
├── getNSRDBecgs.m
├── getWfdbClass.m
├── gqrs.m
├── helptoc_template.xml
├── html
│   ├── ann2rr.html
│   ├── bxb.html
│   ├── Contents.html
│   ├── corrint.html
│   ├── dfa.html
│   ├── ecgpuwave.html
│   ├── edr.html
│   ├── getWfdbClass.html
│   ├── gqrs.html
│   ├── helptoc.xml
│   ├── helpwin.css
│   ├── LICENSE.txt
│   ├── lomb.html
│   ├── mat2wfdb.html
│   ├── mrgann.html
│   ├── msentropy.html
│   ├── mxm.html
│   ├── NEWS
│   ├── pbsearch.html
│   ├── physionetdb.html
│   ├── rdann.html
│   ├── rdmat.html
│   ├── rdmimic2wave.html
│   ├── rdsamp.html
│   ├── snip.html
│   ├── sortann.html
│   ├── sqrs.html
│   ├── sumann.html
│   ├── surrogate.html
│   ├── tach.html
│   ├── template_bottom.html
│   ├── template.html
│   ├── visgraph.html
│   ├── wabp.html
│   ├── wfdb2mat.html
│   ├── wfdbdesc.html
│   ├── wfdbdownload.html
│   ├── wfdbexec.html
│   ├── wfdbloadlib.html
│   ├── wfdbtest.html
│   ├── wfdbtime.html
│   ├── wfdbtool.html
│   ├── woody.html
│   ├── wqrs.html
│   ├── wrann.html
│   ├── wrsamp.html
│   └── xform.html
├── info.xml
├── LICENSE.txt
├── lomb.m
├── mat2wfdb.m
├── mrgann.m
├── msentropy.m
├── mxm.m
├── nativelibs
│   ├── custom
│   │   ├── bin
│   │   │   ├── a2m
│   │   │   ├── ad2m
│   │   │   ├── ahaconvert
│   │   │   ├── ahaecg2mit
│   │   │   ├── ann2rr
│   │   │   ├── annxml
│   │   │   ├── bxb
│   │   │   ├── calsig
│   │   │   ├── coherence
│   │   │   ├── ecgeval
│   │   │   ├── edf2mit
│   │   │   ├── epicmp
│   │   │   ├── fft
│   │   │   ├── fir
│   │   │   ├── gqfuse
│   │   │   ├── gqpost
│   │   │   ├── gqrs
│   │   │   ├── heaxml
│   │   │   ├── hrstats
│   │   │   ├── ihr
│   │   │   ├── log10
│   │   │   ├── lomb
│   │   │   ├── m2a
│   │   │   ├── makeid
│   │   │   ├── md2a
│   │   │   ├── memse
│   │   │   ├── mfilt
│   │   │   ├── mit2edf
│   │   │   ├── mit2wav
│   │   │   ├── mrgann
│   │   │   ├── mxm
│   │   │   ├── nguess
│   │   │   ├── nst
│   │   │   ├── plot2d
│   │   │   ├── plot3d
│   │   │   ├── plotstm
│   │   │   ├── pnwlogin
│   │   │   ├── pscgen
│   │   │   ├── pschart
│   │   │   ├── rdann
│   │   │   ├── rdedfann
│   │   │   ├── rdsamp
│   │   │   ├── readid
│   │   │   ├── revise
│   │   │   ├── rr2ann
│   │   │   ├── rxr
│   │   │   ├── sampfreq
│   │   │   ├── setwfdb
│   │   │   ├── sigamp
│   │   │   ├── sigavg
│   │   │   ├── signame
│   │   │   ├── signum
│   │   │   ├── skewedit
│   │   │   ├── snip
│   │   │   ├── sortann
│   │   │   ├── sqrs
│   │   │   ├── sqrs125
│   │   │   ├── sumann
│   │   │   ├── sumstats
│   │   │   ├── tach
│   │   │   ├── time2sec
│   │   │   ├── wabp
│   │   │   ├── wav2mit
│   │   │   ├── wfdb2mat
│   │   │   ├── wfdbcat
│   │   │   ├── wfdbcollate
│   │   │   ├── wfdb-config
│   │   │   ├── wfdbdesc
│   │   │   ├── wfdbmap
│   │   │   ├── wfdbsignals
│   │   │   ├── wfdbtime
│   │   │   ├── wfdbwhich
│   │   │   ├── wqrs
│   │   │   ├── wrann
│   │   │   ├── wrsamp
│   │   │   ├── xform
│   │   │   ├── xmlann
│   │   │   └── xmlhea
│   │   ├── lib
│   │   │   ├── libwfdb.so.10
│   │   │   └── libwfdb.so.10.5
│   │   ├── Makefile
│   │   └── README.txt
│   ├── linux
│   │   ├── bin
│   │   │   ├── 16x1.hea
│   │   │   ├── a2m
│   │   │   ├── ad2m
│   │   │   ├── ahaconvert
│   │   │   ├── ahaecg2mit
│   │   │   ├── ann2rr
│   │   │   ├── annxml
│   │   │   ├── bxb
│   │   │   ├── calsig
│   │   │   ├── coherence
│   │   │   ├── corrint
│   │   │   ├── cshsetwfdb
│   │   │   ├── curl
│   │   │   ├── curl-config
│   │   │   ├── dfa
│   │   │   ├── ecgeval
│   │   │   ├── ecgpuwave
│   │   │   ├── edf2mit
│   │   │   ├── edr
│   │   │   ├── epicmp
│   │   │   ├── fft
│   │   │   ├── fir
│   │   │   ├── gqfuse
│   │   │   ├── gqpost
│   │   │   ├── gqrs
│   │   │   ├── heaxml
│   │   │   ├── hrfft
│   │   │   ├── hrlomb
│   │   │   ├── hrmem
│   │   │   ├── hrplot
│   │   │   ├── hrstats
│   │   │   ├── ihr
│   │   │   ├── log10
│   │   │   ├── lomb
│   │   │   ├── m2a
│   │   │   ├── makeid
│   │   │   ├── md2a
│   │   │   ├── memse
│   │   │   ├── mfilt
│   │   │   ├── mit2edf
│   │   │   ├── mit2wav
│   │   │   ├── mrgann
│   │   │   ├── mse
│   │   │   ├── mxm
│   │   │   ├── nguess
│   │   │   ├── nst
│   │   │   ├── parsescp
│   │   │   ├── plot2d
│   │   │   ├── plot3d
│   │   │   ├── plotstm
│   │   │   ├── pnwlogin
│   │   │   ├── pscgen
│   │   │   ├── pschart
│   │   │   ├── psfd
│   │   │   ├── rdann
│   │   │   ├── rdedfann
│   │   │   ├── rdsamp
│   │   │   ├── readid
│   │   │   ├── revise
│   │   │   ├── rr2ann
│   │   │   ├── rxr
│   │   │   ├── sampfreq
│   │   │   ├── setwfdb
│   │   │   ├── sigamp
│   │   │   ├── sigavg
│   │   │   ├── signame
│   │   │   ├── signum
│   │   │   ├── skewedit
│   │   │   ├── snip
│   │   │   ├── sortann
│   │   │   ├── sqrs
│   │   │   ├── sqrs125
│   │   │   ├── stepdet
│   │   │   ├── sumann
│   │   │   ├── sumstats
│   │   │   ├── tach
│   │   │   ├── time2sec
│   │   │   ├── visbility
│   │   │   ├── wabp
│   │   │   ├── wav2mit
│   │   │   ├── wfdb2mat
│   │   │   ├── wfdbcat
│   │   │   ├── wfdbcollate
│   │   │   ├── wfdb-config
│   │   │   ├── wfdbdesc
│   │   │   ├── wfdbmap
│   │   │   ├── wfdbsignals
│   │   │   ├── wfdbtime
│   │   │   ├── wfdbwhich
│   │   │   ├── wqrs
│   │   │   ├── wrann
│   │   │   ├── wrsamp
│   │   │   ├── xform
│   │   │   ├── xmlann
│   │   │   └── xmlhea
│   │   ├── lib
│   │   │   ├── libgfortran.so.3
│   │   │   ├── libquadmath.so.0
│   │   │   ├── libwfdb.so
│   │   │   ├── libwfdb.so.10
│   │   │   ├── libwfdb.so.10.5
│   │   │   ├── pkgconfig
│   │   │   │   └── libcurl.pc
│   │   │   └── ps
│   │   │       ├── 12lead.pro
│   │   │       ├── pschart.pro
│   │   │       └── psfd.pro
│   │   ├── lib64
│   │   │   ├── librdsampjni.so
│   │   │   ├── libwfdb.so
│   │   │   ├── libwfdb.so.10
│   │   │   ├── libwfdb.so.10.5
│   │   │   └── rdsampjni.so -> librdsampjni.so
│   │   └── Makefile
│   ├── macosx
│   │   ├── bin
│   │   │   ├── a2m
│   │   │   ├── ad2m
│   │   │   ├── ahaconvert
│   │   │   ├── ahaecg2mit
│   │   │   ├── ann2rr
│   │   │   ├── annxml
│   │   │   ├── bxb
│   │   │   ├── calsig
│   │   │   ├── coherence
│   │   │   ├── corrint
│   │   │   ├── cshsetwfdb
│   │   │   ├── curl
│   │   │   ├── curl-config
│   │   │   ├── dfa
│   │   │   ├── ecgeval
│   │   │   ├── ecgpuwave
│   │   │   ├── edf2mit
│   │   │   ├── edr
│   │   │   ├── epicmp
│   │   │   ├── fft
│   │   │   ├── fir
│   │   │   ├── gqfuse
│   │   │   ├── gqpost
│   │   │   ├── gqrs
│   │   │   ├── heaxml
│   │   │   ├── hrfft
│   │   │   ├── hrlomb
│   │   │   ├── hrmem
│   │   │   ├── hrplot
│   │   │   ├── hrstats
│   │   │   ├── ihr
│   │   │   ├── libcurl.4.dylib
│   │   │   ├── libcurl.dylib
│   │   │   ├── libcurl.la
│   │   │   ├── libgfortran.3.dylib
│   │   │   ├── libgfortran.dylib
│   │   │   ├── libquadmath.0.dylib
│   │   │   ├── librdsampjni.dylib
│   │   │   ├── libwfdb.10.5.24.dylib
│   │   │   ├── libwfdb.10.dylib
│   │   │   ├── libwfdb.dylib
│   │   │   ├── log10
│   │   │   ├── lomb
│   │   │   ├── m2a
│   │   │   ├── makeid
│   │   │   ├── md2a
│   │   │   ├── memse
│   │   │   ├── mfilt
│   │   │   ├── mit2edf
│   │   │   ├── mit2wav
│   │   │   ├── mrgann
│   │   │   ├── mse
│   │   │   ├── mxm
│   │   │   ├── nguess
│   │   │   ├── nst
│   │   │   ├── parsescp
│   │   │   ├── patchann
│   │   │   ├── plot2d
│   │   │   ├── plot3d
│   │   │   ├── plotstm
│   │   │   ├── pnwlogin
│   │   │   ├── pscgen
│   │   │   ├── pschart
│   │   │   ├── psfd
│   │   │   ├── rdann
│   │   │   ├── rdedfann
│   │   │   ├── rdsamp
│   │   │   ├── readid
│   │   │   ├── revise
│   │   │   ├── rr2ann
│   │   │   ├── rxr
│   │   │   ├── sampfreq
│   │   │   ├── setwfdb
│   │   │   ├── sigamp
│   │   │   ├── sigavg
│   │   │   ├── signame
│   │   │   ├── signum
│   │   │   ├── skewedit
│   │   │   ├── snip
│   │   │   ├── sortann
│   │   │   ├── sqrs
│   │   │   ├── sqrs125
│   │   │   ├── stepdet
│   │   │   ├── sumann
│   │   │   ├── sumstats
│   │   │   ├── tach
│   │   │   ├── time2sec
│   │   │   ├── visbility
│   │   │   ├── wabp
│   │   │   ├── wav2mit
│   │   │   ├── wfdb2mat
│   │   │   ├── wfdbcat
│   │   │   ├── wfdbcollate
│   │   │   ├── wfdb-config
│   │   │   ├── wfdbdesc
│   │   │   ├── wfdbmap
│   │   │   ├── wfdbsignals
│   │   │   ├── wfdbtime
│   │   │   ├── wfdbwhich
│   │   │   ├── wqrs
│   │   │   ├── wrann
│   │   │   ├── wrsamp
│   │   │   ├── xform
│   │   │   ├── xmlann
│   │   │   └── xmlhea
│   │   └── Makefile
│   └── windows
│       ├── bin
│       │   ├── a2m.exe
│       │   ├── ad2m.exe
│       │   ├── ahaconvert
│       │   ├── ahaecg2mit.exe
│       │   ├── ann2rr.exe
│       │   ├── bxb.exe
│       │   ├── calsig.exe
│       │   ├── coherence.exe
│       │   ├── corrint.exe
│       │   ├── cshsetwfdb
│       │   ├── curl-config
│       │   ├── curl.exe
│       │   ├── dfa.exe
│       │   ├── ecgeval.exe
│       │   ├── ecgpuwave.exe
│       │   ├── edf2mit.exe
│       │   ├── edr.exe
│       │   ├── epicmp.exe
│       │   ├── fft.exe
│       │   ├── fir.exe
│       │   ├── gqfuse.exe
│       │   ├── gqpost.exe
│       │   ├── gqrs.exe
│       │   ├── hrfft
│       │   ├── hrlomb
│       │   ├── hrmem
│       │   ├── hrplot
│       │   ├── hrstats.exe
│       │   ├── ihr.exe
│       │   ├── libcurl-4.dll
│       │   ├── libgcc_s_dw2-1.dll
│       │   ├── libgfortran-3.dll
│       │   ├── libquadmath-0.dll
│       │   ├── librdsampjni.exe.exe
│       │   ├── libwfdb.dll
│       │   ├── libwfdb.dll.a
│       │   ├── libwfdb.dll.a.10
│       │   ├── libwfdb.dll.a.10.5
│       │   ├── log10.exe
│       │   ├── lomb.exe
│       │   ├── m2a.exe
│       │   ├── makeid.exe
│       │   ├── md2a.exe
│       │   ├── memse.exe
│       │   ├── mfilt.exe
│       │   ├── mit2edf.exe
│       │   ├── mit2wav.exe
│       │   ├── mrgann.exe
│       │   ├── mse.exe
│       │   ├── mxm.exe
│       │   ├── nguess.exe
│       │   ├── nst.exe
│       │   ├── parsescp.exe
│       │   ├── plot2d
│       │   ├── plot3d
│       │   ├── plotstm.exe
│       │   ├── pnwlogin
│       │   ├── pscgen.exe
│       │   ├── pschart.exe
│       │   ├── psfd.exe
│       │   ├── rdann.exe
│       │   ├── rdedfann.exe
│       │   ├── rdsamp.exe
│       │   ├── rdsampjni.o
│       │   ├── readid.exe
│       │   ├── revise.exe
│       │   ├── rr2ann.exe
│       │   ├── rxr.exe
│       │   ├── sampfreq.exe
│       │   ├── setwfdb
│       │   ├── sigamp.exe
│       │   ├── sigavg.exe
│       │   ├── signame.exe
│       │   ├── signum.exe
│       │   ├── skewedit.exe
│       │   ├── snip.exe
│       │   ├── sortann.exe
│       │   ├── sqrs125.exe
│       │   ├── sqrs.exe
│       │   ├── stepdet.exe
│       │   ├── sumann.exe
│       │   ├── sumstats.exe
│       │   ├── tach.exe
│       │   ├── time2sec.exe
│       │   ├── visbility.exe
│       │   ├── wabp.exe
│       │   ├── wav2mit.exe
│       │   ├── wfdb-10.5.dll
│       │   ├── wfdb2mat.exe
│       │   ├── wfdbcat.exe
│       │   ├── wfdbcollate.exe
│       │   ├── wfdb-config.exe
│       │   ├── wfdbdesc.exe
│       │   ├── wfdb.dll
│       │   ├── wfdbmap.exe
│       │   ├── wfdbsignals.exe
│       │   ├── wfdbtime.exe
│       │   ├── wfdbwhich.exe
│       │   ├── wqrs.exe
│       │   ├── wrann.exe
│       │   ├── wrsamp.exe
│       │   └── xform.exe
│       ├── lib
│       │   ├── libcurl.dll.a
│       │   ├── libgcc_s_dw2-1.dll
│       │   ├── libgfortran-3.dll
│       │   └── libquadmath-0.dll
│       └── Makefile
├── NEWS
├── pbsearch.m
├── physionetdb.m
├── rdann.m
├── rdmat.m
├── rdmimic2wave.m
├── rdsamp.m
├── README.txt
├── snip.m
├── sortann.m
├── sqrs.m
├── sumann.m
├── surrogate.m
├── tach.m
├── visgraph.m
├── wabp.m
├── wfdb2mat.m
├── wfdb-app-JVM7-0-9-10.jar
├── wfdb-app-JVM8-0-9-10.jar
├── wfdbdemo.m
├── wfdbdesc.m
├── wfdbdownload.m
├── wfdbexec.m
├── wfdbloadlib.m
├── wfdb.m
├── wfdbRecordViewer.fig
├── wfdbRecordViewer.m
├── wfdbtest.m
├── wfdbtime.m
├── wfdbtool.m
├── woody.m
├── wqrs.m
├── wrann.m
├── wrsamp.m
└── xform.m

17 directories, 599 files

Configs

>> [~,config]=wfdbloadlib

config = 

  struct with fields:

       MATLAB_VERSION: '9.1.0.441655 (R2016b)'
             inOctave: 0
         WFDB_VERSION: '[10.5.24]'
       WFDB_JAVA_HOME: ' /home/masi/Documents/DI/NSRDB/'
      WFDB_NATIVE_BIN: ' /home/masi/Documents/DI/NSRDB/nativelibs/linux/'
        EXECUTING_DIR: ' null'
               osName: 'linux'
           fullOsName: ' Linux'
               osArch: ' amd64'
       customArchFlag: ' false'
            OSVersion: ' 3.16.0-4-amd64'
           JVMVersion: ' 1.7.0_60]'
          MATLAB_PATH: '/home/masi/Documents/DI/NSRDB/'
    WFDB_JAVA_VERSION: 'wfdb-app-JVM7-0-9-10.jar'
          DEBUG_LEVEL: 0
    NETWORK_WAIT_TIME: 1000
          MATLAB_ARCH: 'glnxa64'
            WFDB_PATH: '. /home/masi/Documents/DI/NSRDB/../database/ http://physionet…'
              WFDBCAL: ' /home/masi/Documents/DI/NSRDB//database/wfdbcal'
       WFDB_CUSTOMLIB: 0
         CACHE_SOURCE: 'http://physionet.org/physiobank/database/'
           CACHE_DEST: '/home/masi/Documents/DI/NSRDB/../database/'
                CACHE: 1

OS: Debian 8.5 64 bit
Linux kernel: 4.6 backports
WFDB: 0-9-10
MATLAB: 2016b
Related: http://biology.stackexchange.com/q/52955/86 Hardware: Asus Zenbook UX303UA i7 CPU, 12 GB RAM, 35 GB Swap, integrated Intel graphics
Window manager: Gnome 3.14
Related thread in MATLAB Ask: https://se.mathworks.com/matlabcentral/answers/310851-set-path-won-t-save-on-debian-8-5
MATLAB Service Request about the pathdef.m issue: #02259304

cx1111 commented 8 years ago

sig=rdsamp(strcat(database,num2str(patient)),channel);

Does this not work?

cx1111 commented 8 years ago

I'm using the latest github development version although rdsamp hasn't been changed since June 2015 so 0-9-10 should have the same rdsamp as the one I'm using.

sig=rdsamp('nsrdb/16265');

Gives me

-0.165000000000000  -0.325000000000000
-0.155000000000000  -0.325000000000000
-0.195000000000000  -0.305000000000000
-0.205000000000000  -0.305000000000000
...

sig=rdsamp('nsrdb/16265', 1);

Gives me

-0.165000000000000  
-0.155000000000000  
-0.195000000000000  
-0.205000000000000  
...

Can you try that command and tell me what it gives you, or try 0-9-10?

cx1111 commented 8 years ago

sig=rdsamp('16265'); size(sig)

ans =

11730944           2

Quite a large signal. The file is downloaded and cached in the database directory before it is read. Perhaps your connection to PhysioNet was slow, If you manually download the file (or use rsync) and then call rdsamp on it, how long does it take? Also the java wrapper via rdsamp is rather slow when reading large arrays into memory but that shouldn't be the rate determining step.

>> tic;sig=rdsamp('16265');toc;
Elapsed time is 1.465067 seconds.

On my 2GHz computer.

ikarosilva commented 8 years ago

Hi Sami Can you paste your WFDB configuration for both systems:

[~,config]=wfdbloadlib

sami10007 commented 8 years ago

@cx1111 @ikarosilva Can you please read the body. I have to get this issue solved as fast as possible.

alistairewj commented 8 years ago
Error using rdsamp (line 203)
Could not find record: NSRDB/16272. Search path is set to: '.
/home/masi/Documents/DI/wfdb-app-toolbox/mcode/../database/ http://physionet.org/physiobank/database/'

Error in vertaa (line 165)
        [~, cSignals{cIndex}]=rdsamp(strcat(database,num2str(patient)),channel); % plot(tm,sig);

... implies that it can't find the data on your path. Have you edited the WFDB_PATH variable in wfdbloadlib.m to include /home/masi/Documents/DI/?

alistairewj commented 8 years ago

Please reproduce exactly the script and the error.

On Nov 8, 2016 10:38 AM, "Masi" notifications@github.com wrote:

I tried this WFDB_PATH=['/home/masi/Documents/DI/']; at the beginning of the script but I keep getting the errors. I also tried it in the workaround. Can you please propose how to do it correctly?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ikarosilva/wfdb-app-toolbox/issues/133#issuecomment-259170233, or mute the thread https://github.com/notifications/unsubscribe-auth/ABOSdKXySlDcFrWytj4uo-B8OKPWoCgYks5q8JdvgaJpZM4KkLRs .

alistairewj commented 8 years ago

The config from your workaround does not reflect a change of WFDB_PATH to my recommendation. Is that the output after changing the WFDB_PATH to '/home/masi/Documents/DI/'? Perhaps you have two folders with the toolbox?

alistairewj commented 8 years ago

Your WFDB_PATH variable still does not seem updated. If you update it in wfdbloadlib.m, it should take on that value. It should not be the default. A workaround for this is to work in the same directory as the data - so work in /home/masi/Documents/DI/NSRDB/ and call [~, cSignal] = rdsamp(num2str(patient),channel).

alistairewj commented 8 years ago

Edit the file and change the WFDB_PATH variable to the location of your data (line 50). By default in the file it is initialized to an empty array.

On Wed, Nov 9, 2016 at 12:09 AM, Masi notifications@github.com wrote:

@alistairewj https://github.com/alistairewj

How can you change wfdbloadlib.m?

Mine is

function [varargout]=wfdbloadlib(varargin) % % [isloaded,config]=wfdbloadlib(debugLevel,networkWaitTime) % % Loads the WDFDB libarary if it has not been loaded already into the % MATLAB classpath. And optionally prints configuration environment and debug information % regarding the settings used by the classes in the JAR file. % % Inputs: % % debugLevel % (Optional) 1x1 integer between 0 and 5 represeting the level of debug information to output from % Java class when output configuration information. Level 0 (no debug information), % level =5 is maximum level of information output by the class (logger set to finest). Default is level 0. % % networkWaitTime % (Optional) 1x1 integer representing the longest time in % milliseconds for which the JVM should wait for a data stream from % PhysioNet (default is =1000 , ie one second). If you need to change this time to a % longer value across the entire toolbox, it is better modify to default value in the source % code below and restart MATLAB. % % % Written by Ikaro Silva, 2013 % Last Modified: April 7, 2015 % Since 0.0.1 % %

I will try the workaround because I just need the data.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ikarosilva/wfdb-app-toolbox/issues/133#issuecomment-259335126, or mute the thread https://github.com/notifications/unsubscribe-auth/ABOSdDDoxeu7KD96XiIKTu_HyZJZXd4jks5q8VV5gaJpZM4KkLRs .

alistairewj commented 8 years ago

I don't believe you have done what I asked you to try. You stated that you added the variable at the top of the script you are running - but I asked you to change the variable set at line 50 of the wfdbloadlib.m file. Can you confirm that?

On Nov 9, 2016 12:42 AM, "Masi" notifications@github.com wrote:

@alistairewj https://github.com/alistairewj Please, see the body. First proposal fails.

Let's try the differential solution because I just need the data [5,30] min channel 1 as fast as possible. I duplicate everything to the data directory, see Workaround 2 with the minimal script, but it fails. Do you know why?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ikarosilva/wfdb-app-toolbox/issues/133#issuecomment-259338045, or mute the thread https://github.com/notifications/unsubscribe-auth/ABOSdCsRUDZuEHgpk1ua08xnTZTFTgiCks5q8V0xgaJpZM4KkLRs .

sami10007 commented 8 years ago

@alistairewj I did it already, please see the beginning of the body. Here also the reproduction of the thing

root@masiAsus:/home/masi/Documents/DI/wfdb-app-toolbox/mcode# cat wfdbloadlib.m  | grep WFDB_PATH
%WFDB_PATH: If empty, will use the default given config.WFDB_PATH
WFDB_PATH=['/home/masi/Documents/DI/'];
CACHE_SOURCE=[]; %If empty, defaults to last element of WFDB_PATH
        if(isempty(WFDB_PATH))
            WFDB_PATH=['. ' tmpCache ' http://physionet.org/physiobank/database/'];
        config.WFDB_PATH=WFDB_PATH;
        ind=strfind(config.WFDB_PATH,'http');
            CACHE_SOURCE=config.WFDB_PATH(ind:end);
    setenv('WFDB',config.WFDB_PATH); 

MATLAB premium service correction in the permission of pathdef.m to 666/644 solves one problem. All configs changed more logical now but there is some problem with WFDB finding the data in /home/masi/Documents/DI/NSRDB/.

Why WFDB does not use the local data at /home/masi/Documents/DI/NSRDB/?

alistairewj commented 8 years ago

It's really confusing that you delete your posts and edit your first post. It's hard to see what you have tried and what you haven't tried. In the future, with issues, I would recommend just posting new comments when you try something new. Note that for setup 2, you need to load in just the record name (16265), not the database name and the record name.

As an alternative workaround, you can install the WFDB toolbox (https://physionet.org/physiotools/wfdb-darwin-quick-start.shtml) and use the shell commands to export the data as text or in .mat format: https://physionet.org/tutorials/physiobank-text.shtml

It seems that this is a very specific issue to your setup and not a general issue with the toolbox since no one else can reproduce it - @cx1111 this issue should probably be closed. @sami10007 - maybe you can find someone at your local institution who can provide you with technical advice in person - unfortunately first-line support is not something we can provide to the users of the toolbox.

cx1111 commented 8 years ago

Not an issue with the toolbox. Personal environment troubleshooting.

sami10007 commented 8 years ago

Solved!

  1. Just install WFDB for Debian as instructed here https://www.physionet.org/physiotools/wfdb-linux-quick-start.shtml
  2. See the possible syntaxes here https://physionet.org/tutorials/physiobank-text.shtml and George's new manual here https://www.physionet.org/physiotools/wag/wag.pdf
  3. Run the following bash script to get all NSRDB signals where the total size is about 350*15 MB
#!/bin/bash
ids=("16272" "16273" "16420" "16483" "16539" "16773" "16786" "16795" "17052" "17453" "18177" "18184" "19088" "19090" "19093" "19140" "19830")
for id in ${ids[@]}
do
        rdsamp -r nsrdb/"$id" > /tmp/"$id".txt
done