Beispiel #1
0
MainWindow::~MainWindow() {
  destroyGrid();
  delete ui;
  delete boggle_board;
  delete comp_boggle_player;
  delete ui->gridLayout;
}
Beispiel #2
0
vector<double> EKGImageP::proccessor()
{
    if (scanImage.height() < 1)
        return vector<double>();
    //Find Grid
    scanImage = crop2grid(scanImage);
    //Destroy Grid
    QColor replace_color = QColor(255,255,255);
    destroyGrid(replace_color);
    //Crop
    vector<QImage> ghataat = HSegmentation(scanImage);
    bSignal = vector<double> (0);

    //End Ghate ghate kardan Signal

    if (ghataat.size() < 1)
        return bSignal;
    //Read Signal
    int j = ghataat.size()-1;
    int vBuffer = ghataat[j].height() - maxCount[j];
    int nBuffer = vBuffer;
    ghataat[j] = bijooFilter(ghataat[j]);
    for (int column = 0 ; column < ghataat[j].width() ; column++)
    {
        nBuffer = findNazdik(column,vBuffer,ghataat[j]);
        if(nBuffer != 0)
        {
            vBuffer = nBuffer;
            bSignal.push_back(vBuffer);
            //Chech End Signal
            nBuffer = ghataat[j].height() - vBuffer;
        }
    }
    //End Read Signal
    if (bSignal.size() < 300)
        return bSignal;
    //Delete False
    bSignal.erase(bSignal.begin(),bSignal.begin()+100);
    bSignal.erase(bSignal.end()-100,bSignal.end());
    //Find Base Line
    int maingin = 0;
    for(int k = 0 ; k < bSignal.size();k++)
    {
        maingin += bSignal[k];
    }
    maingin /= bSignal.size();
    for(int k = 0 ; k < bSignal.size();k++)
    {
        bSignal[k] -= maingin;
    }
    //Scale to real (mV) value
    double Pixel2mV = Pixel2mm * mm2mV * 5;
    for(int k = 0 ; k < bSignal.size();k++)
    {
        bSignal[k] *= Pixel2mV;
    }
    return bSignal;
}
void GridPlugin::setupGrid(int left, int low, int xWidth, int yWidth, int Nx, int Ny)
{
        destroyGrid(); // make sure previous grid is gone if any

	// (left, low) is the lower left corner of the grid
	// xWidth and yWidth are the side lengths of the rectangles
	// Nx and Ny are the number of rectangles in each direction

	// set the class variables
	nCols = Nx;
	nStripes = Ny;

	// allocate memory in first dimension (x direction) as pointers to hold the memory in the other dimension
	// for each x location, a strip of of rectangles will be used
	vertices = new GLint*[Nx];
	colors = new GLfloat*[Nx];

	// allocate memory in the second dimension (y direction)
	for( int i=0; i<Nx; i++ ){
		vertices[i] = new GLint[Ny*4+4+3];
		// vertices[i] is an array of integers for the (i+1)-th strip along the x direction
		// it contains alternating values for x and y coordinates of vertices
		// the first rectangle needs 4 specified vertices
		// every subsequent vertex needs 2 additional vertices
		// thus Ny*4+4 integers are required

		// set x-coordinates of vertices:
		for( int j=0; j<Ny+1; j++ ){
			vertices[i][j*4] = left + i*xWidth;
			vertices[i][j*4+2] = left + (i+1)*xWidth;
		}
		// set y-coordinates of vertices:
		for( int j=0; j<Ny+1; j++ )
			vertices[i][j*4+1] = vertices[i][j*4+3] = low + j*yWidth;

		// allocate memory for colors of the vertices
		colors[i] = new GLfloat[Ny*6+6];
		for( int j=0; j<Ny*6+6; j++ )
			colors[i][j] = 0.5; // set all colors to gray
	}

        glEnableClientState(GL_COLOR_ARRAY);
        glEnableClientState(GL_VERTEX_ARRAY);
}
void GridPlugin::stop(bool doSave, bool use_gui, bool softStop) { StimPlugin::stop(doSave,use_gui,softStop); destroyGrid(); }
GridPlugin::~GridPlugin() { destroyGrid(); }