HRVKit
HRV Analysis for iOS
 All Classes Functions Properties
/HRVKit/HRVAnalysis.h
00001 //
00002 //  HRVAnalysis.h
00003 //  HRVAnalysis
00004 //
00005 //  Created by Alex Shaykevich on 17/03/12.
00006 //  Copyright (c) 2012 YOM. All rights reserved.
00007 //
00008 
00013 #import <Foundation/Foundation.h>
00014 #import <Accelerate/Accelerate.h>
00015 
00016 #define R_FFT_LENGTH 256
00017 #define R_DETRENDDIMENSION 256
00018 #define R_SR 4
00019 #define SLIDE_LENGTH 12
00020 
00021 #define HRV_KEY @"hf_key"
00022 #define AVG_HRV_KEY @"avg_hf_key"
00023 #define HRV_DICT_KEY @"r_dict_key"
00024 
00025 #define R_AVG_NUM 7
00026 
00027 #define R_DEF_MHR 70
00028 #define TOL 10
00029 
00030 
00031 @class OrderedDictionary;
00032 @class HRVResult;
00033 @interface HRVAnalysis : NSObject {
00034     FFTSetupD mFftSetup; 
00035         DSPDoubleSplitComplex mFftComplexBuffer;
00036     double* hamming;
00037     double* detrendMatrix;
00038     
00039     int log2n;
00040     
00041     OrderedDictionary* data;
00042     double* buffer;
00043     double* rbuffer;
00044     double* results;
00045     double* totalResults;
00046     
00047     int avgCount;
00048     NSMutableArray* avgArray;
00049     
00050     double totalTime; // in seconds
00051     double windowLength;
00052     double slideLength;
00053     double nextInterestingTime;
00054     BOOL first;
00055     
00056     // for the ectopic beat detection
00057     float mhr;
00058     float ihrp;
00059     
00060     int resultIndex;
00061     int avgResultIndex;
00062     
00063     NSMutableArray* rrArray;
00064     
00065     BOOL filter;
00066     
00067         dispatch_queue_t hrvQue;
00068     NSTimer* timer;
00069 }
00070 
00074 @property float mhr;
00075 
00079 @property BOOL filter;
00080 
00085 -(void)addRR:(double)rr;
00086 
00090 -(NSArray*)rr;
00091 
00095 -(HRVResult*)calculateResult;
00096 
00097 
00098 @end