diff --git a/ECTrainer2/StimConfig.txt b/ECTrainer2/StimConfig.txt new file mode 100644 index 0000000..e1b539e --- /dev/null +++ b/ECTrainer2/StimConfig.txt @@ -0,0 +1 @@ +2,../movies/visit01_004.avi,30,../movies/visit01_004.csv diff --git a/ECTrainer2/Stimulus.cpp b/ECTrainer2/Stimulus.cpp index 651d6d3..36ba77b 100644 --- a/ECTrainer2/Stimulus.cpp +++ b/ECTrainer2/Stimulus.cpp @@ -26,20 +26,36 @@ bool Stimulus::Init() { SetPage(STIM_PAGE::OPENING); - std::ifstream ifs(DATA_FILE); - if (!ifs) - { - mwut::DebugPrintf(_T("Can't open stim data file.")); + mwut::STR_TABLE table; + if (!mwut::ReadTable(STIM_CONFIG_FILE, table)) { + mwut::DebugPrintf(_T("Can't open config file : %d\n"), STIM_CONFIG_FILE.c_str()); return false; } - while (!ifs.eof()) { + + for (int r = 0; r < table.size(); r++) { + if (table[r].size() != 4 || atoi(table[r][0].c_str()) < 1) continue; StimInfo st; - ifs >> st.type >> st.filename >> st.dulation >> st.csvfile >> st.target; - //std::cout << st.type << "," << st.filename << "," << st.dulation << "," - // << st.csvfile << "," << st.target << std::endl; + st.type = atoi(table[r][0].c_str()); + st.filename = table[r][1]; + st.dulation = (float)atof(table[r][2].c_str()); + st.csvfile = table[r][3]; if (st.filename.size() > 0) _StimInfoSet.push_back(st); } + //std::ifstream ifs(DATA_FILE); + //if (!ifs) + //{ + // mwut::DebugPrintf(_T("Can't open stim data file.")); + // return false; + //} + //while (!ifs.eof()) { + // StimInfo st; + // ifs >> st.type >> st.filename >> st.dulation >> st.csvfile >> st.target; + // //std::cout << st.type << "," << st.filename << "," << st.dulation << "," + // // << st.csvfile << "," << st.target << std::endl; + // if (st.filename.size() > 0) _StimInfoSet.push_back(st); + //} + return true; } diff --git a/ECTrainer2/Stimulus.h b/ECTrainer2/Stimulus.h index 6e7776d..34e20b5 100644 --- a/ECTrainer2/Stimulus.h +++ b/ECTrainer2/Stimulus.h @@ -16,7 +16,6 @@ std::string filename; // �񎦃t�@�C�� float dulation; // ����(sec) std::string csvfile; // �^�[�Q�b�g���W�t�@�C���i�����ꍇ��_�A���_�[�o�[�j - int target; // �^�[�Q�b�g�i�����ꍇ��0�j }; class Stimulus : public BaseProcess @@ -28,7 +27,7 @@ const cv::String CALIB_COMPLETE_FILE = "../images/CalibComplete.png"; const cv::String CALIB_FAILED_FILE = "../images/CalibFailed.png"; const cv::String WHITE_FILE = "../images/white.png"; - const std::string DATA_FILE = "StimDataS.txt"; + const std::string STIM_CONFIG_FILE = "StimConfig.txt"; Marker* _pMarker; cv::Mat _DispBuffer; std::vector _StimInfoSet; @@ -52,6 +51,4 @@ // ������ bool Init(); void SetPage(STIM_PAGE st); - //cv::Point2f GetEyeR() { return _StimImages[_StimNo].eyes[0]; } - //cv::Point2f GetEyeL() { return _StimImages[_StimNo].eyes[1]; } };