metaImage * sag2coron (metaImage * imageS) { double conf[12]; double dim[3], dimNew[3]; int dimInt[3]; metaImage imageTemp; int i,j,k; dim[0] = imageS->dimx; dim[1] = imageS->dimy; dim[2] = imageS->slices; double matrixOut[9]; for(i = 0; i < 12; i++) { if (i<9) matrixOut[i] = 0; conf[i] = 0; } //Rotation around X of -90 degrees (positive is counterclockwise) conf[5] = -M_PI*0.5; //Zooming should be 1 conf[6] = conf[8] = 1; conf[7] = 1; forwardMatrix(matrixOut, conf); transformLight(dim, matrixOut, dimNew, conf); for(i =0; i<3; i++) { dimInt[i] = rint(abs(dimNew[i])); } printf("%d %d %d\n",dimInt[2], dimInt[0], dimInt[1]); // printf("%f %f %f\n",imageTemp->resolution[2], imageTemp->resolution[0], imageTemp->resolution[1]); initImage(dimInt[2], dimInt[0], dimInt[1], &imageTemp, BACKGROUND); setResolution(&imageTemp, imageS->resolution); inverseMappingNewLight(imageS, &imageTemp, conf, metaWriteMatrix, trilinearInterp); metaImage * pointer = &imageTemp; // deInit(imageS); return pointer; }
/** * @brief likelyhood : method to compute the log * likeyhood of observed sequence * @param sequence :input observation sequence * @return */ float ocv::CHMM::likelyhood(Mat sequence) { float prob=0; //computing the probability of observed sequence //using forward algorithm forwardMatrix(sequence); //computing the log probability of observed sequence for(int i=0;i<sequence.rows;i++) { //for(int j=0;j<_nstates;j++) { prob=prob+std::log(_scale(0,i)); } } return -prob; }