debug/src/positionsprovider.h

00001 /***************************************************************************
00002                           positionsprovider.h  -  description
00003                              -------------------
00004     begin                : Tue Jul 20 2004
00005     copyright            : (C) 2004 by Lynn Hazan
00006     email                : lynn.hazan.myrealbox.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef POSITIONSPROVIDER_H
00019 #define POSITIONSPROVIDER_H
00020 
00021 //include files for the application
00022 #include <dataprovider.h>
00023 #include <array.h>
00024 #include <types.h>
00025 
00026 // include files for QT
00027 #include <qwidget.h>
00028 
00029 //include files for c/c++ libraries
00030 #include <math.h>
00031 
00036 class PositionsProvider : public DataProvider  {
00037    Q_OBJECT
00038 public: 
00047   PositionsProvider(KURL fileUrl,double samplingRate,int width,int height,int rotation,int flip);
00048   
00049   ~PositionsProvider();
00050 
00052   enum loadReturnMessage {OK=0,OPEN_ERROR=1,MISSING_FILE=3,COUNT_ERROR=4,INCORRECT_CONTENT=5};
00053     
00059   void requestData(long startTime,long endTime,QObject* initiator);
00060 
00061   
00065   void retrieveAllData(QObject* initiator); 
00066   
00070   int loadData();
00071 
00075   inline QString getName() const {return name;}
00076 
00080   inline QString getFilePath() const {return fileName;}
00081   
00082   inline void updateVideoInformation(double videoSamplingRate,int rotation,int flip,int videoWidth,int videoHeight){
00083     samplingRate = videoSamplingRate;
00084     width = videoWidth;
00085     height= videoHeight;
00086     this->flip = flip;
00087     this->rotation = rotation;
00088   };
00089 
00093   inline int getNbSpots()const {return nbCoordinates / 2;};
00094   
00097   inline double getSamplingRate() const {return samplingRate;};
00098   
00099 signals:
00105   void dataReady(Array<dataType>& data,QObject* initiator);
00106 
00107 
00108 private:
00109 
00111   QString name;
00112 
00114   double samplingRate;
00115   
00116   /* n column array containing the position of the animal. The two first columns contain
00117   * the position of the first spot and following optional pair of columns two contain the position of optional spots.*/
00118   Array<dataType> positions;
00119 
00121   long previousStartTime;
00122 
00124   long previousEndTime;
00125 
00127   long previousStartIndex;
00128 
00130   long previousEndIndex;
00131 
00133   long nbPositions;
00134 
00136   long fileMaxTime;
00137 
00139   int width;
00141   int height;
00142 
00144   int nbCoordinates;
00145 
00147   int rotation;
00148 
00150   int flip;
00151 
00152   //Functions
00153 
00159   void retrieveData(long startTime,long endTime,QObject* initiator);
00160   
00161 };
00162 
00163 #endif

Generated on Mon Sep 17 20:47:31 2007 for NeuroScope by  doxygen 1.5.1