예제 #1
0
// Inizializza gli stream, apre il file per poi scriverci
void initStreams()
{
	// Initializza il file parametri partendo dal file parameters.txt, se il file non esiste te lo dice
	ifstream parametersFile;
	parametersFile.open("parametersShapeSizeConstancyRtG.txt");
	parameters.loadParameterFile(parametersFile);

	// Subject name
	string subjectName = parameters.find("SubjectName");

	//Subject's ReportFile
	ifstream subjParametersFile;
	string reportFile  = subjectName + "Est.txt";
	subjParametersFile.open(reportFile.c_str());
	subjParams.loadParameterFile(subjParametersFile);

	// Principal streams file
	string markersFileName  = "markersFile_" + subjectName + ".txt";
	string responseFileName =	"responseFile_"	+ subjectName + ".txt";

	// Check for output file existence
	/// Response file
	if ( !fileExists(responseFileName) )
		responseFile.open(responseFileName.c_str());
	if ( !fileExists(markersFileName) )
		markersFile.open(markersFileName.c_str());

	responseFile << fixed << "NTrial\tIOD\tEstSize\tEstDepth\tAbsDepth\tTime\tStimTime" << endl;

}
예제 #2
0
// Inizializza gli stream, apre il file per poi scriverci
void initStreams()
{
	// Initializza il file parametri partendo dal file parameters.txt, se il file non esiste te lo dice
	ifstream parametersFile;
	parametersFile.open("C:/workspace/cncsvisioncmake/experimentsbrown/parameters/parameterspointPerceive_pointing.txt");
	parameters.loadParameterFile(parametersFile);

	// Subject name
    string subjectName = parameters.find("SubjectName");

	//subj parameters
	ifstream subjParametersFile;
	string reportFile  = "C:/workspace/cncsvisioncmake/experimentsbrown/estimates/" + subjectName + ".txt";
	subjParametersFile.open(reportFile.c_str());
	subjParams.loadParameterFile(subjParametersFile);

	// Principal streams file
	string markersFileName  = "pointPerceive_pointing_markersFile_" + subjectName + ".txt";
    string responseFileName =  "pointPerceive_pointing_"   + subjectName + ".txt";

	// Check for output file existence
	/// Response file
    if ( !fileExists((responseFileName)) )
        responseFile.open((responseFileName).c_str());
	if ( !fileExists(markersFileName) )
		markersFile.open(markersFileName.c_str());

	responseFile << fixed << "NSubjName\tIOD\ttrialN\tAbsDepth\tRelDepthObj\tzedge\tAdjDepth\tjitter\tConstStim\tjudgment\testdepth\testsd\tframe\ttrialDuration" << endl;

	velocityFile.open("testVelocity.txt");

	globalTimer.start();
}
// Inizializza gli stream, apre il file per poi scriverci
void initStreams()
{
	// Initializza il file parametri partendo dal file parameters.txt, se il file non esiste te lo dice
	ifstream parametersFile;
	parametersFile.open("C:/cncsvisiondata/parametersFiles/Campagnoli/parametersstaircasePointing2.txt");
	parameters.loadParameterFile(parametersFile);

	/*
	// Principal streams file
	string markersFileName  = "C:/Users/visionlab/Dropbox/Shape Lab Shared/Carlo/spring13-pointingEquilateralTriangle/Staircase/twoBlocks2/staircasePointing2_markersFile_" + subjectName + ".txt";
    string responseFileName =  "C:/Users/visionlab/Dropbox/Shape Lab Shared/Carlo/spring13-pointingEquilateralTriangle/Staircase/twoBlocks2/staircasePointing2_"   + subjectName + ".txt";
	*/
	// Base directory, full path
    string baseDir = parameters.find("BaseDir");
	// Subject name
    string subjectName = parameters.find("SubjectName");
    // Principal streams file
    string markersFileName  = baseDir + "markersFile_" + subjectName + ".txt";
	string responseFileName = baseDir + "responseFile_"+ subjectName + ".txt";
	// Check for output file existence
	/// Response file
    if ( !fileExists((responseFileName)) )
        responseFile.open((responseFileName).c_str());
	if ( !fileExists(markersFileName) )
		markersFile.open(markersFileName.c_str());

	responseFile << fixed << "subjName\tIOD\ttrialN\tRelDepthObj\tStairID\tStairState\tReversals\tAscending\tresponsekey\tresp\tjitter\ttime\tstepsDone\tobjdepth\tCondition\tsequence\ttimeToFHP\tjitterObj\tstimulus" << endl;

	globalTimer.start();
}
예제 #4
0
void initStreams()
{
	// Initializza il file parametri partendo dal file parameters.txt, se il file non esiste te lo dice
	ifstream parametersFile;
	parametersFile.open("C:/workspace/cncsvisioncmake/experimentsbrown/parameters/parametersSizeWeightIllusion.txt");
	parameters.loadParameterFile(parametersFile);

	// Subject name
    string subjectName = parameters.find("SubjectName");
	
	// Markersfile directory
	string dirName  = "C:/Users/visionlab/Google Drive/DATA/SizeWeightIllusion/" + subjectName;
	mkdir(dirName.c_str());

	// Principal streams file
    string responseFileName =  "C:/Users/visionlab/Google Drive/DATA/SizeWeightIllusion/" + subjectName + "/SizeWeight_" + subjectName + ".txt";

	// Check for output file existence
	/// Response file
    if ( !fileExists((responseFileName)) )
        responseFile.open((responseFileName).c_str());

	responseFile << fixed << "subjName" << "\t" <<
							"IOD" << "\t" <<
							"trialN" << "\t" <<
							"AbsDepth" << "\t" <<
							"Size" << "\t" <<
							"Diameter" << "\t" <<
							"trialDuration" << "\t" <<
							"training" << "\t" <<
							"round" <<
							endl;

	globalTimer.start();
}
// Inizializza gli stream, apre il file per poi scriverci
void initStreams()
{
	// Initializza il file parametri partendo dal file parameters.txt, se il file non esiste te lo dice
	ifstream parametersFile;
	parametersFile.open("C:/cncsvisiondata/parametersFiles/Evan/platoGraspRovereto/parametersPlatoGraspRovereto.c"); //is this correct?
	parameters.loadParameterFile(parametersFile);

	// Subject name
    string subjectName = parameters.find("SubjectName");
	
	// Output files directory
	string dirName  = "C:/Documents and Settings/Fulvio/My Documents/Google Drive/platoGraspRovereto/" + subjectName;
	mkdir(dirName.c_str());

	// Response file
	string controlResponseFileName = "C:/Documents and Settings/Fulvio/My Documents/Google Drive/platoGraspRovereto/" + subjectName + "/platoGraspRovereto_control_" + subjectName + ".txt";
    string responseFileName =  "C:/Documents and Settings/Fulvio/My Documents/Google Drive/platoGraspRovereto/" + subjectName + "/platoGraspRovereto_" + subjectName + ".txt";

	// Check for output file existence 
	/// Response file
	if ( !fileExists((responseFileName)) ) {
        responseFile.open((responseFileName).c_str());
	}
	if ( !fileExists((controlResponseFileName)) ) {
        controlResponseFile.open((controlResponseFileName).c_str());
	}

	responseFile << fixed << "subjName\ttrialN\ttrialDuration\ttargetObj\tsm_lg\tcon_inc" << endl;
	controlResponseFile << fixed << "subjName\ttrialN\ttrialDuration\ttargetObj\tsm_lg\tcon_inc" << endl;
	globalTimer.start();
}
// Inizializza gli stream, apre il file per poi scriverci
void initStreams()
{
	// Initializza il file parametri partendo dal file parameters.txt, se il file non esiste te lo dice
	ifstream parametersFile;
	parametersFile.open("C:/workspace/cncsvisioncmake/experimentsbrown/parameters/parametersEvanHaptic.txt");
	parameters.loadParameterFile(parametersFile);

	// Subject name
    string subjectName = parameters.find("SubjectName");
	
	// Markersfile directory
	string dirName  = "C:/Users/visionlab/Google Drive/DATA/Evan-haptic/spatial/" + subjectName;
	mkdir(dirName.c_str());

	// Principal streams file
    string responseFileName =  "C:/Users/visionlab/Google Drive/DATA/Evan-haptic/spatial/" + parameters.find("SubjectName") + "/evan-haptic_" + subjectName + ".txt";

	// Check for output file existence 
	/// Response file
    if ( !fileExists((responseFileName)) )
        responseFile.open((responseFileName).c_str());

	responseFile << fixed << "subjName\ttrialN\tstimPosn\tAbsDepth\tObjHeight\ttrialDuration\tcondition\tpulsingColors" << endl; //\tHapticFB\trandCond\trandIncrement" << endl;

	globalTimer.start();
}
예제 #7
0
void initStreams()
{   /*ifstream inputParameters;
    inputParameters.open(parametersFileNames[paramIndex]);
    if ( !inputParameters.good() )
    {   cerr << "File doesn't exist" << endl;
    //exit(0);
    }*/
    parameters.loadParameterFile("C:/cncsvisioncmake/build/Debug/parametersExpFingerTrieste.txt");
    // WARNING:
    // Base directory and subject name, if are not
    // present in the parameters file, the program will stop suddenly!!!
    // Base directory where the files will be stored
    cerr << "Folders creation..." ;
    string baseDir = parameters.find("BaseDir");
    if ( !boost::filesystem::exists(baseDir) )
        boost::filesystem::create_directory(baseDir);
    // Subject name
    string subjectName = parameters.find("SubjectName");

    // Principal streams file
    string markersFileName  = "markersFile_" + subjectName + ".txt";

    // Check for output file existence
    if ( !fileExists((baseDir+markersFileName)) )
        markersFile.open((baseDir+markersFileName).c_str());
    cerr << " OK!" << endl;
}
예제 #8
0
// Inizializza gli stream, apre il file per poi scriverci
void initStreams()
{
	// Initializza il file parametri partendo dal file parameters.txt, se il file non esiste te lo dice
	ifstream parametersFile;
	parametersFile.open(parametersFile_directory.c_str());
	parameters.loadParameterFile(parametersFile);

	// Subject name
	string subjectName = parameters.find("SubjectName");

	// Principal streams files

	// response file (if haptic)
	string responseFileName = experiment_directory + responseFile_name + subjectName + ".txt";

	// Check for output file existence
	if (util::fileExists(responseFileName))
	{
		string error_on_file_io = responseFileName + string(" already exists");
		cerr << error_on_file_io << endl;
#ifndef SIMULATION
		MessageBox(NULL, (LPCSTR)"FILE ALREADY EXISTS\n Please check the parameters file.",NULL, NULL);
#endif
		exit(0);
	}
	else
	{
		responseFile.open(responseFileName.c_str());
		cerr << "File " << responseFileName << " loaded successfully" << endl;
	}

	responseFile << fixed << responseFile_headers << endl;

}
예제 #9
0
void initStreams()
{
#ifdef _WIN32
    string parametersFileName("parametersExpTexturingParabolicCylinderAdjustment.txt");
#endif
#ifdef __linux__
    string parametersFileName("/home/carlo/Desktop/params/parametersExpTexturingParabolicCylinderAdjustment.txt");
#endif
    inputParameters.open(parametersFileName.c_str());
    if ( !inputParameters.good() )
    {
        cerr << "File " << parametersFileName << " doesn't exist, enter a valid path, press Enter to exit" << endl;
        std::cin.ignore( std::numeric_limits <std::streamsize> ::max(), '\n' );
        exit(0);
    }
    parameters.loadParameterFile(inputParameters);

    string subjectName = parameters.find("SubjectName");
    string outputFilename = parameters.find("BaseDir")+string("responseFileAdjustment_") + subjectName + string(".txt");
    if ( util::fileExists(outputFilename) )
    {
        int i=0;
        cerr << "file " << outputFilename << "already exists, press Enter to quit" << endl;
        std::cin.ignore( std::numeric_limits <std::streamsize> ::max(), '\n' );
        exit(0);
    }
    else
    {
        responseFile.open( outputFilename.c_str() );
        responseFile << "TrialNumber\tCurrCurvature\tIODFactor\tAdjustedCurvatureZ" << endl;
    }
}
예제 #10
0
void initStreams()
{   ifstream inputParameters;
    inputParameters.open("parametersRobertGrasping_v4_thumb_training.txt");
    if ( !inputParameters.good() )
    {   cerr << "File doesn't exist" << endl;
//exit(0);
    }
    parameters.loadParameterFile(inputParameters);
	interoculardistance = util::str2num<double>(parameters.find("IOD"));
// WARNING:
// Base directory and subject name, if are not
// present in the parameters file, the program will stop suddenly!!!
// Base directory where the files will be stored
    string baseDir = parameters.find("BaseDir");
    if ( !boost::filesystem::exists(baseDir) )
        boost::filesystem::create_directory(baseDir);
// Subject name
    string subjectName = parameters.find("SubjectName");

// Principal streams file
    string markersFileName  = "markersFile_" + subjectName + ".txt";

// Check for output file existence
    if ( !fileExists((baseDir+markersFileName)) )
        markersFile.open((baseDir+markersFileName).c_str());
}
예제 #11
0
/**
* @brief initStreams
**/
void initStreams()
{
    ifstream inputParameters;
	inputParameters.open(parametersFileNames[paramIndex]);
	parameters.loadParameterFile(inputParameters);
	interoculardistance = util::str2num<double>(parameters.find("IOD"));
    // Base directory, full path
    string baseDir = parameters.find("BaseDir");
    // Subject name
    string subjectName = parameters.find("SubjectName");
    // Principal streams file
    string markersFileName  = baseDir + "markersFile_" + subjectName + ".txt";

    // Check for output file existence
	if (util::fileExists(markersFileName ))
	{
		string error_on_file_io = markersFileName + string(" already exists");
		cerr << error_on_file_io << endl;
		MessageBox(NULL, (LPCSTR)"MARKER FILE ALREADY EXIST\n",NULL, NULL);
		exit(0);
	}
	else
	{
        markersFile.open(( markersFileName ).c_str());
		cerr << "File " << markersFileName << " loaded successfully" << endl;
	    markersFile << fixed << setprecision(3) << "SubjectName\tFingerDist\tTrialNumber\tTrialFrame\tTotTime\tVisualStimX\tVisualStimY\tVisualStimZ\tfStimulusRadius\tfDistances\tfGain\tDisappearRadius\tEyeLeftXraw\tEyeLeftYraw\tEyeLeftZraw\tEyeRightXraw\tEyeRightYraw\tEyeRightZraw\tWristXraw\tWristYraw\tWristZraw\tThumbXraw\tThumbYraw\tThumbZraw\tIndexXraw\tIndexYraw\tIndexZraw\tVisualThumbXraw\tVisualThumbYraw\tVisualThumbZraw\tVisualIndexXraw\tVisualIndexYraw\tVisualIndexZraw\tIsDrawing\tIsThumbProjected\tIsIndexProjected\tFingersLeaning" << endl;
	}
}
// Inizializza gli stream, apre il file per poi scriverci
void initStreams()
{
	// Initializza il file parametri partendo dal file parameters.txt, se il file non esiste te lo dice
	ifstream parametersFile;
	parametersFile.open("C:/workspace/cncsvisioncmake/experimentsbrown/parameters/parametersstaircasePointing2.txt");
	parameters.loadParameterFile(parametersFile);

	// Subject name
    string subjectName = parameters.find("SubjectName");
	
	string dirName  = "C:/Users/visionlab/Dropbox/Shape Lab Shared/Carlo/spring13-pointingEquilateralTriangle/Staircase/twoBlocks2/" + subjectName;
	mkdir(dirName.c_str());

		// Principal streams file
    string responseFileName =  "C:/Users/visionlab/Dropbox/Shape Lab Shared/Carlo/spring13-pointingEquilateralTriangle/Staircase/twoBlocks2/" + parameters.find("SubjectName") + "/staircaseGrasping2_"   + subjectName + ".txt";

	// Check for output file existence
	/// Response file
    if ( !fileExists((responseFileName)) )
        responseFile.open((responseFileName).c_str());

	responseFile << fixed << "subjName\tIOD\ttrialN\tAbsDepth\tRelDepthObj\tStairID\tStairState\tReversals\tAscending\tresponsekey\tresp\tjitter\ttime\tstepsDone\tobjdepth\tCondition\tsequence\ttimeToFHP" << endl;

	globalTimer.start();
}
예제 #13
0
// Inizializza gli stream, apre il file per poi scriverci
void initStreams()
{
	// Initializza il file parametri partendo dal file parameters.txt, se il file non esiste te lo dice
	ifstream parametersFile;
	parametersFile.open(parametersFile_directory.c_str());
	parameters.loadParameterFile(parametersFile);

	// Subject name
	string subjectName = parameters.find("SubjectName");

	initVariables();

	// Principal streams files

	// response file (if haptic)
	if(condition == 1)
	{
		string responseFileName = experiment_directory + responseFile_name + subjectName + "_" + stringify<int>(condition) + "_" + stringify<int>(stimulus_noise) + ".txt";
	
		if ( !util::fileExists(responseFileName) )
	        responseFile.open(responseFileName.c_str());

		responseFile << fixed << responseFile_headers << endl;
	}

	// summary file
	string summaryFileName = experiment_directory + responseFile_name + subjectName + "_" + stringify<int>(condition) + "_" + stringify<int>(stimulus_noise) + "_summary.txt";

	/// Summary file
	if ( !util::fileExists(summaryFileName) )
	        summaryFile.open(summaryFileName.c_str());

	summaryFile << fixed << summaryFile_headers << endl;
}
예제 #14
0
void initStreams()
{
    ifstream inputParameters;
    string parametersPassiveFileName("parametersPointsStrip.txt");
    inputParameters.open(parametersPassiveFileName.c_str());
    if ( !inputParameters.good() )
    {
        cerr << "File " << parametersPassiveFileName << " doesn't exist, enter a valid path" << endl;
        exit(0);
    }
    parameters.loadParameterFile(inputParameters);

    // WARNING:
    // Base directory and subject name, if are not
    // present in the parameters file, the program will stop suddenly!!!
    // Base directory where the files will be stored
    string baseDir = parameters.find("BaseDir");
    if ( !boost::filesystem::exists(baseDir) )
        boost::filesystem::create_directory(baseDir);

    string responseFileName = baseDir + "responseFileStripAdapt_" + parameters.find("SubjectName") +".txt";
    responseFile.open(responseFileName.c_str());

    responseFile << setw(6) << left <<
                 "Trial\tTilt\tSlant\tDef\tFlowDir\tFlowIncrement" << endl;
}
예제 #15
0
// Inizializza gli stream, apre il file per poi scriverci
void initStreams()
{
	// Initializza il file parametri partendo dal file parameters.txt, se il file non esiste te lo dice
	ifstream parametersFile;
	parametersFile.open("C:/workspace/cncsvisioncmake/experimentsbrown/parameters/parametersClaireHandOcclusionTraining.txt");
	parameters.loadParameterFile(parametersFile);

	globalTimer.start();
}
예제 #16
0
/**
 * @brief initializeExperiment
 */
void initializeExperiment()
{
    // MUST BE CALLED WITHIN A VALID OPENGL CONTEXT
    //Screen screen(SCREEN_WIDE_SIZE, SCREEN_WIDE_SIZE*SCREEN_HEIGHT/SCREEN_WIDTH, alignmentX, alignmentY, focalDistance );
	screen.init(SCREEN_WIDE_SIZE, SCREEN_WIDE_SIZE*SCREEN_HEIGHT/SCREEN_WIDTH, alignmentX, alignmentY, focalDistance );
	screen.setOffset(alignmentX,alignmentY);
    screen.setFocalDistance(focalDistance);
    cam.init(screen);

    // Initialize all the streams for file output eccetera
	parameters.loadParameterFile("C:/cncsvisiondata/parametersFiles/Fulvio/expMicroHeadMovements/parametersExpMicroHeadMovementsActive.txt");
	// Initialize focal distance and interocular distance from parameter file
    focalDistance = parameters.get("FocalDistance");
    interocularDistance = parameters.get("IOD");
    infoDraw = (int)parameters.get("DrawInfo");
	useCircularOcclusor = (int)parameters.get("UseCircularOcclusor");
    // Initialize trials balance factors
    trial.init(parameters);
	trial.next();
    // Base directory, full path
    string baseDir = parameters.find("BaseDir");
    // Subject name
    string subjectName = parameters.find("SubjectName");
    // Principal streams file

	string markersFileName = baseDir + "markersFile_MicroHeadMovementsActive_" + subjectName  + ".txt";
    string outputFileName  = baseDir + "responseFile_MicroHeadMovementsActive_" + subjectName +".txt";
    string timingFileName  = baseDir + "timingFile_MicroHeadMovementsActive_" + subjectName   + ".txt";
    // Check for output file existence
    if ( !util::fileExists((outputFileName)) )
        responseFile.open(outputFileName.c_str());
    cerr << "File " << outputFileName << " loaded successfully" << endl;

	// Check for output markers file existence
    if ( !util::fileExists((markersFileName)) )
        markersFile.open(markersFileName.c_str());
   cerr << "File " << markersFileName << " loaded successfully" << endl;

	// Check for output timing file existence
    if ( !util::fileExists((timingFileName)) )
        timingFile.open(( timingFileName ).c_str());
    cerr << "File " << timingFileName << " opened successfully" << endl;

	// Write the response file header
    responseFile << "# SubjectName\tTrialNumber\tFocalDistance\tKeyPressed\tResponseTime\tfZWidth\tfSlant\tfTilt\tfStimAnchored" << endl;

  // Finished loading parameter files

    // Update the stimulus
    updateStimulus();

    trialTimer.start();
    globalTimer.start();
}
예제 #17
0
void initStreams()
{
    string parametersPassiveFileName("../OpenGL/parametersPassiveCdef.txt");
    inputParameters.open(parametersPassiveFileName);
    if ( !inputParameters.good() )
    {
        cerr << "File " << parametersPassiveFileName << " doesn't exist, enter a valid path" << endl;
        cin.ignore(1E6,'\n');
        exit(0);
    }
    parameters.loadParameterFile(inputParameters);
#ifdef _WIN32
    // WARNING:
    // Base directory and subject name, if are not
    // present in the parameters file, the program will stop suddenly!!!
    // Base directory where the files will be stored
    string baseDir = parameters.find("BaseDir");
    if ( !exists(baseDir) )
        create_directory(baseDir);

    // Subject name
    string subjectName = parameters.find("SubjectName");

    // Principal streams file
    string transformationFileName("transformationFile_");
    string trialFileName("trialFile_");
    string anglesFileName("anglesFile_");
    string responseFileName("responseFile_");

    // Add the subject name to file extension
    transformationFileName	+=string(subjectName)+".txt";
    trialFileName			+=string(subjectName)+".txt";
    anglesFileName			+=string(subjectName)+".txt";
    responseFileName		+=string(subjectName)+".txt";

    // Check for output file existence
    /** Transformation file **/
    if ( !fileExists((baseDir+transformationFileName)) )
        transformationFile.open((baseDir+transformationFileName).c_str() );

    /** Trial file **/
    if ( !fileExists((baseDir+trialFileName)) )
        trialFile.open((baseDir+trialFileName).c_str());

    /** Angles file **/
    if ( !fileExists((baseDir+anglesFileName)) )
        anglesFile.open((baseDir+anglesFileName).c_str());

    /** Response file **/
    if ( !fileExists((baseDir+responseFileName)) )
        responseFile.open((baseDir+responseFileName).c_str());
#endif
    cerr << "streams end" << endl;
}
예제 #18
0
void initStreams()
{
    ifstream inputParameters;
    string parametersPassiveFileName("paramsPointsStrip.txt");
    inputParameters.open(parametersPassiveFileName.c_str());
    if ( !inputParameters.good() )
    {
        cerr << "File " << parametersPassiveFileName << " doesn't exist, enter a valid path" << endl;
        exit(0);
    }
    parameters.loadParameterFile(inputParameters);
}
예제 #19
0
void initStreams()
{
    inputParameters.open("parametersActiveZFixed.txt");
    if ( !inputParameters.good() )
    {
        cerr << "File doesn't exist" << endl;
        exit(0);
    }
    parameters.loadParameterFile(inputParameters);

    // WARNING:
    // Base directory and subject name, if are not
    // present in the parameters file, the program will stop suddenly!!!
    // Base directory where the files will be stored
    string baseDir = parameters.find("BaseDir");
    if ( !exists(baseDir) )
        create_directory(baseDir);
    // Subject name
    string subjectName = parameters.find("SubjectName");

    // Principal streams file
    string responseFileName =	"responseFile_"	+ subjectName + ".txt";
    string markersFileName =	"markersFile_"	+ subjectName + ".txt";
    string anglesFileName =		"anglesFile_"	+ subjectName + ".txt";
    string trajFileName =		"trajFile_"		+ subjectName + ".txt";
    string matrixFileName =		"matrixFile_"	+ subjectName + ".txt";
    string stimFileName	  =		"stimFile_"		+ subjectName + ".txt";
    // Check for output file existence
    /** Response file **/
    if ( !fileExists((baseDir+responseFileName)) )
        responseFile.open((baseDir+responseFileName).c_str());

    if (!fileExists((baseDir+markersFileName)) )
        markersFile.open((baseDir+markersFileName).c_str());

    if (!fileExists((baseDir+anglesFileName)) )
        anglesFile.open((baseDir+anglesFileName).c_str());

    if (!fileExists((baseDir+trajFileName)) )
        trajFile.open((baseDir+trajFileName).c_str());

    if ( !fileExists(baseDir+matrixFileName))
        matrixFile.open((baseDir+matrixFileName).c_str());

    if ( !fileExists(baseDir+stimFileName))
        stimFile.open((baseDir+stimFileName).c_str());
}
예제 #20
0
/*** Output files and streams ***/
void initStreams()
{
	// Initializza il file parametri partendo dal file parameters.txt, se il file non esiste te lo dice
	ifstream parametersFile;
	parametersFile.open(parametersFile_directory.c_str());
	parameters.loadParameterFile(parametersFile);

	initVariables();

	// Subject name
	subjectName = parameters.find("SubjectName");

	string student_folder = experiment_directory + student_directory;

	mkdir(student_folder.c_str(), 777); // linux syntax

	// Subject folder
	string dirName  = student_folder + "/" + subjectName;

	mkdir(dirName.c_str(), 777); // linux syntax

	// Principal streams files

	// response file
	string responseFileName = student_folder + "/" + responseFile_name + subjectName + ".txt";

	// Check for output file existence
	if (util::fileExists(responseFileName))
	{
		string error_on_file_io = responseFileName + string(" already exists\n");
		cerr << error_on_file_io << endl;
		cerr << "FILE ALREADY EXISTS\n\nPlease check the subject's name in the parameters file.\n" << endl;

		exit(0);
	}
	else
	{
		responseFile.open(responseFileName.c_str());
		cerr << "File " << responseFileName << " loaded successfully" << endl;
	}

	responseFile << fixed << responseFile_headers << endl;
}
예제 #21
0
void initStreams()
{   // Load the parameters file
    string parametersFileName = "C:/cncsvisiondata/parametersFiles/parametersActiveTwoPlanesOccRandTrain.txt";
    inputParameters.open(parametersFileName.c_str());
    if ( !inputParameters.good() )
        cerr << "File " << parametersFileName << " doesn't exist, CTRL+C to exit" << endl;

    parameters.loadParameterFile(inputParameters);

    // WARNING:
    // Base directory and subject name, if are not
    // present in the parameters file, the program will stop suddenly!!!
    // Base directory where the files will be stored
    string baseDir = parameters.find("BaseDir");
    if ( !boost::filesystem::exists(baseDir) )
        boost::filesystem::create_directory(baseDir);

    // Subject name
    string subjectName = parameters.find("SubjectName");

    string responseFileName = baseDir + "responseFilePassive_" + subjectName +".txt";
    //string markersFileName = baseDir + "markersFile_" + subjectName + "_filtered.txt";
    string markersFileName = baseDir + "markersFile_" + subjectName + ".txt";
    string flowsFileMovingName = baseDir + "flowsFileMoving_"+subjectName +".txt";
    string flowsFileStillName = baseDir + "flowsFileStill_"+subjectName +".txt";
    // Open the full input stream
#ifdef _WIN32
    inputStream.open(markersFileName.c_str());
    if ( inputStream.good() )
    {   cerr << "Markers file " << markersFileName << " ok" << endl;
    }
    else
        cerr << "Can't open " << markersFileName << endl;

    // Open the response file in write mode
    if ( !fileExists((responseFileName)) )
        responseFile.open((responseFileName).c_str());
    if ( !fileExists((flowsFileMovingName)) )
        flowsFileMoving.open((flowsFileMovingName).c_str());
    if ( !fileExists((flowsFileStillName)) )
        flowsFileStill.open((flowsFileStillName).c_str());
#endif
}
예제 #22
0
void initStreams()
{
    string parametersFileName = "../../data/parametersFiles/parametersExpDPrimeTMSoverMT.txt";
    ifstream inputParameters;
    inputParameters.open(parametersFileName.c_str());
    if ( !inputParameters.good() )
    {
        cerr << "File " << parametersFileName  << "doesn't exist" << endl;
        exit(0);
    }
    parameters.loadParameterFile(inputParameters);

    // WARNING:
    // Base directory and subject name, if are not
    // present in the parameters file, the program will stop suddenly!!!
    // Base directory where the files will be stored
    string baseDir = parameters.find("BaseDir");
    if ( !boost::filesystem::exists(baseDir) )
        boost::filesystem::create_directory(baseDir);

    // Principal streams file
    string markersFileName =	"markersFile_"	+ parameters.find("SubjectName") + ".txt";
    string responseFileName =	"responseFile_" + parameters.find("SubjectName") + ".txt";
    string matrixFileName = "matrixFile_" + parameters.find("SubjectName") + ".txt";
    string flowsFileName = "flowsFile_" + parameters.find("SubjectName") + ".txt";

    // Check for output file existence
    if (!util::fileExists((baseDir+markersFileName)) )
        markersFile.open((baseDir+markersFileName).c_str());

    if (!util::fileExists( (baseDir+responseFileName) ) )
        responseFile.open( (baseDir+responseFileName).c_str() );

    if (!util::fileExists((baseDir+matrixFileName)) )
        matrixFile.open((baseDir+matrixFileName).c_str());

    if (!util::fileExists((baseDir+flowsFileName)) )
        flowsFile.open((baseDir+flowsFileName).c_str());

}
예제 #23
0
// Inizializza gli stream, apre il file per poi scriverci
void initStreams()
{
	// Initializza il file parametri partendo dal file parameters.txt, se il file non esiste te lo dice
	ifstream parametersFile;
	parametersFile.open("C:/cygwin/home/visionlab/workspace/cncsvisionwin/parametersFiles/parametersExpAmanda.txt");
	parameters.loadParameterFile(parametersFile);
	// Subject name
    string subjectName = parameters.find("SubjectName");

	// Principal streams file
    string responseFileName =  "SSC3DrespFile_"   + subjectName + ".txt";

	// Check for output file existence
	/// Response file
    if ( !fileExists((responseFileName)) )
        responseFile.open((responseFileName).c_str());

	responseFile << fixed << "NSubjName\tIOD\ttrialN\tAbsDepth\tRelDepthObj\txedge\tEstSize\tzedge\tEstDepth\tjitter\ttrialDuration" << endl;

	timeFile.open("timeFile.txt");	// XXX aggiunto da Nicolini
	globalTimer.start();
}
void initStreams()
{
    // Load the parameters file
    inputParameters.open("parametersActiveRotationYaw.txt");
    if ( !inputParameters.good() )
    {
        cerr << "File doesn't exist" << endl;
        exit(0);
    }
    parameters.loadParameterFile(inputParameters);

    // WARNING:
    // Base directory and subject name, if are not
    // present in the parameters file, the program will stop suddenly!!!
    // Base directory where the files will be stored
    string baseDir = parameters.find("BaseDir");
    if ( !exists(baseDir) )
    	create_directory(baseDir);

    // Subject name
    string subjectName = parameters.find("SubjectName");

    string responseFileName = baseDir + "responseFilePassive_" + subjectName +".txt";
    string markersFileName = baseDir + "markersFile_" + subjectName + "_filtered.txt";
    // Open the full input stream
    inputStream.open(markersFileName.c_str());
    
	if ( inputStream.good() )
    {
        cerr << "Markers file " << markersFileName << " ok" << endl;
    }
    else
        cerr << "Can't open " << markersFileName << endl;

    // Open the response file in write mode 
	if ( !fileExists((responseFileName)) )
		responseFile.open((responseFileName).c_str());
	
}
void initStreams()
{
	// Initializza il file parametri partendo dal file parameters.txt, se il file non esiste te lo dice
	ifstream parametersFile;
	parametersFile.open(parametersFile_directory.c_str());
	parameters.loadParameterFile(parametersFile);

	// Subject name
	string subjectName = parameters.find("SubjectName");

	// Principal streams file
	string responseFileName =  experiment_directory + responseFile_name + subjectName + ".txt";

	// Check for output file existence
	/// Response file
	if ( !util::fileExists(responseFileName) )
	        responseFile.open((responseFileName).c_str());


	responseFile << fixed << responseFile_headers << endl;

}
// Inizializza gli stream, apre il file per poi scriverci
void initStreams()
{
	// Initializza il file parametri partendo dal file parameters.txt, se il file non esiste te lo dice
	ifstream parametersFile;
	parametersFile.open("C:/workspace/cncsvisioncmake/experimentsbrown/parameters/parametersstaircaseAdjustment.txt");
	parameters.loadParameterFile(parametersFile);
	
	// Subject name
    string subjectName = parameters.find("SubjectName");

	// Principal streams file
    string responseFileName =  "staircaseAdjustment_"   + subjectName + ".txt";

	// Check for output file existence
	/// Response file
    if ( !fileExists((responseFileName)) )
        responseFile.open((responseFileName).c_str());

	responseFile << fixed << "subjName\tIOD\ttrialN\tRelDepthObj\tStairID\tStairState\tReversals\tAscending\tresponsekey\tresp\tjitter\ttime\tstepsDone\tobjdepth" << endl;

	globalTimer.start();
}
예제 #27
0
int main(void)
{  randomizeSeed();
   /*
   BalanceFactor<int> balance;
   map<string,int> factors;
   balance.init(1,true);
   vector<int> f;
   for (int i=0; i<10; i++)
   f.push_back(i);

   balance.addFactor( "Slant",  f );
   while ( !balance.isEmpty() )
   {
       factors = balance.getNext();
       cout << factors["Slant"] << endl;
   }
   balance.init(1,true);
   cerr << "==========" << endl;
   f.clear();
   for (int i=0; i<10; i++)
   f.push_back(i);

   balance.addFactor( "Slant",  f );
   while ( !balance.isEmpty() )
   {
       factors = balance.getNext();
       cout << factors["Slant"] << endl;
   }
   */
   /*
   balance.addFactor( "Tilt", vlist_of<int>(90) );
   balance.addFactor( "Anchored", vlist_of<int>(0)(1)(2)(3));

   //balance.print();

   while ( !balance.isEmpty() )
   {
         map<string, int> tmp2 = balance.getNext() ;
         for ( map<string, int>::iterator iter = tmp2.begin(); iter!=tmp2.end(); ++iter)
         cout << iter->first << " " << iter->second << " ";
         cout << endl;
   }

   cerr << isnan(1.0/0.0) << " " << isinf(1.0/0.0) << endl;
    return 0;
    */
   map<string,int> factors;
   ifstream paramFile;
   paramFile.open("prova.exp");

   ParametersLoader params;
   params.loadParameterFile(paramFile);
   BalanceFactor<int> bfact;
   bfact.init(params);
   while (!bfact.isEmpty())
   {  factors = bfact.getNext();
      cout << factors["StimSpeed"] << endl;
   }
   //bfact.print();

   bfact.init(params);

   while (!bfact.isEmpty())
   {  factors = bfact.getNext();
      cout << factors["StimSpeed"] << endl;
   }
   /*
   BalanceFactor<int> balance;
   balance.init(params);
   balance.print();

   while ( !balance.isEmpty() )
   {
        map<string,int> vals = balance.getNext();
        for ( map<string,int>::iterator iter = vals.begin(); iter!=vals.end(); ++iter )
        {
        cout << iter->first << " " << iter->second << endl;
        }
        cout << endl << endl;

   }
   */

   return 0;
}