void TCGADataNormalizer::exportToFile(double positiveValue, double negativeValue) { ptrToData->buildDataMatrix(); std::ofstream outputStreamSamples(HEINZ_SAMPLES_LIST); const auto &dataMatrix = ptrToData->getDataMatrixHandler(); unsigned int N = dataMatrix.cols(); for (unsigned int i = 0; i < N; ++i) { std::string outputFilename = ptrToData->getPatientsHandler()[i].toString(); outputStreamSamples << outputFilename << std::endl; std::ofstream outputStream( HEINZ_INPUT_DIRECTORY + removeTrailingZeros( std::to_string(std::fabs(negativeValue))) + '_' + outputFilename + ".txt"); for (unsigned int j = 0; j < dataMatrix.rows(); ++j) { outputStream << ptrToData->getGeneListHandler()[j].first << " "; if (dataMatrix(j, i) > 0.5) { outputStream << positiveValue << std::endl; } else { outputStream << negativeValue << std::endl; } } ClusterXX::Utilities::printAdvancement(i, N); } }
void HomogMatrixPub::onNewData() { int found = in_found.read(); out_found.write(found); plik.open( "/home/mwegiere/DCL/ServoVisionObjectRecognition/src/Components/HomogMatrixPub/T_DC.txt", std::ios::app | ios::out); Types::HomogMatrix homogMatrix; float tmp[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; if(!in_matrix.empty()){ int k = 0; homogMatrix = in_matrix.read(); cv::Matx44d dataMatrix = (cv::Matx44d)homogMatrix; for (int i=0; i<4; ++i) for (int j=0; j<4; ++j){ tmp[k] = (float)dataMatrix(i,j); plik<<tmp[k]; plik<<'\n'; ++k; } } struct timespec currentTime; currentTime.tv_nsec = 0; currentTime.tv_sec = 0; if(clock_gettime(CLOCK_REALTIME, ¤tTime) == -1){ LOG(LFATAL) << "clock_gettime() failed. " << strerror(errno); } //long int time_nsec_pocz = in_time_nsec_pocz.read(); //long int time_sec_pocz = in_time_sec_pocz.read(); /*registerStream("out_time_nsec_pocz", &out_time_nsec_pocz); registerStream("out_time_sec_pocz", &out_time_sec_pocz); registerStream("out_time_nsec_kon", &out_time_nsec_kon); registerStream("out_time_sec_kon", &out_time_sec_kon);*/ //uwzglÄ™dnienie czasu triggera //long int trigger_nsec = 25000000; //time_nsec_pocz += trigger_nsec; //out_time_nsec_pocz.write(time_nsec_pocz); //out_time_sec_pocz.write(time_sec_pocz); //out_time_nsec_kon.write(currentTime.tv_nsec); //out_time_sec_kon.write(currentTime.tv_sec); long int sec = static_cast<long int>(currentTime.tv_sec); std::vector<float> out_homogMatrix (tmp, tmp + sizeof(tmp) / sizeof(float) ); out_matrix.write(out_homogMatrix); plik.close(); //CLOG(LINFO) << "time_nsec_pocz: " << time_nsec_pocz; //CLOG(LINFO) << "time_sec_pocz: " << time_sec_pocz; //CLOG(LINFO) << "time_nsec_kon: " << currentTime.tv_nsec; //CLOG(LINFO) << "time_sec_kon: " << sec; }