Exemplo n.º 1
0
	void loadProfiles()
	{
		for(auto filePath : getScan<Mode::Single, Type::File, Pick::ByExt>("Profiles/", ".json"))
		{
			string fileName{getNameFromPath(filePath, "Profiles/", ".json")};

			ProfileData profileData{loadProfileFromJson(getRootFromFile(filePath))};
			profileDataMap.insert(make_pair(profileData.getName(), profileData));
		}
	}
Exemplo n.º 2
0
	void loadMusic(const string& mPath)
	{
		for(auto filePath : getScan<Mode::Single, Type::File, Pick::ByExt>(mPath + "Music/", ".ogg"))
		{
			string fileName{getNameFromPath(filePath, mPath + "Music/", ".ogg")};

			auto& music(assetManager.loadMusic(fileName, filePath));
			music.openFromFile(filePath);
			music.setVolume(getMusicVolume());
			music.setLoop(true);
		}
	}
Exemplo n.º 3
0
AudioFile::AudioFile(std::string inputString){
    // Format is 209;May 27 21:13:19 2016;./jc.png;1;
    std::string temp;
    // Get size
    int mark = inputString.find(";");
    sizeKB = atoi(inputString.substr(0,mark).c_str());
    temp = inputString.substr(mark+1);
    mark = temp.find(";");
    // Get date and path
    createdDate = temp.substr(0,mark);
    createdDate = formatDate(createdDate);
    temp = temp.substr(mark+1);
    mark = temp.find(";");
    pathFile = temp.substr(0,mark);
    nameFile = getNameFromPath(pathFile);
    // Get conflict status
    temp = temp.substr(mark+1);
    mark = temp.find(";");
    conflict = atoi(temp.substr(0,mark).c_str());
}
Exemplo n.º 4
0
AudioFile::AudioFile(std::string inputPathFile, int inputSizeKB, std::string inputDate){
    pathFile = inputPathFile;
    nameFile = getNameFromPath(inputPathFile);
    sizeKB = inputSizeKB;
    createdDate = inputDate;
}
Exemplo n.º 5
0
Cube_C::Cube_C(string filenameParams) : Cube_P()
{
  v_r = 1.0;
  v_g = 1.0;
  v_b = 1.0;

  string extension = getExtension(filenameParams);
  directory = getDirectoryFromPath(filenameParams);
  if(extension=="tiff" || extension=="TIFF" ||
     extension=="tif" || extension=="TIF"){
    loadFromTIFFImage(filenameParams);
  }
  else{
    printf("Loading cube_C\n");
    std::ifstream file(filenameParams.c_str());
    if(!file.good())
      printf("Cube_C::load_parameters: error loading the file %s\n", filenameParams.c_str());

    string name;
    string attribute;
    while(file.good())
      {
        file >> name;
        file >> attribute;
        if(!strcmp(name.c_str(), "filenameVoxelDataR"))
          filenameVoxelDataR = attribute;
        else if(!strcmp(name.c_str(), "filenameVoxelDataG"))
          filenameVoxelDataG = attribute;
        else if(!strcmp(name.c_str(), "filenameVoxelDataB"))
          filenameVoxelDataB = attribute;
        else if(!strcmp(name.c_str(), "type"))
          type = attribute;
        else
          printf("Cube_C::load_parameters: Attribute %s and value %s not known\n",
                 name.c_str(), attribute.c_str());
      }
    if(type != "color"){
      printf("Cube_C called to load an nfo file that is not a Cube_C... exiting\n");
      exit(0);
    }
    if ( (filenameVoxelDataR == "") || (filenameVoxelDataG == "") ||
         (filenameVoxelDataB == "") )
      {
        printf("Cube_C one of the color channels is not defined... exiting\n");
        exit(0);
      }
    data.resize(0);
    if(fileExists(filenameVoxelDataR))
      data.push_back(new Cube<uchar, ulong>(filenameVoxelDataR));
    else if (fileExists(directory + "/" + filenameVoxelDataR))
      data.push_back(new Cube<uchar, ulong>(directory + "/" + filenameVoxelDataR));
    if(fileExists(filenameVoxelDataG))
      data.push_back(new Cube<uchar, ulong>(filenameVoxelDataG));
    else if (fileExists(directory + "/" + filenameVoxelDataG))
      data.push_back(new Cube<uchar, ulong>(directory + "/" + filenameVoxelDataG));
    if(fileExists(filenameVoxelDataB))
      data.push_back(new Cube<uchar, ulong>(filenameVoxelDataB));
    else if (fileExists(directory + "/" + filenameVoxelDataB))
      data.push_back(new Cube<uchar, ulong>(directory + "/" + filenameVoxelDataB));
  } //not .tiff

  printf("Now all the cubes should be loaded -> %i\n", data.size());

  this->cubeHeight  = data[0]->cubeHeight;
  this->cubeDepth   = data[0]->cubeDepth;
  this->cubeWidth   = data[0]->cubeWidth;
  this->voxelHeight = data[0]->voxelHeight;
  this->voxelDepth  = data[0]->voxelDepth;
  this->voxelWidth  = data[0]->voxelWidth;
  // this->r_max       = data[0]->r_max;
  // this->s_max       = data[0]->s_max;
  // this->t_max       = data[0]->t_max;
  // this->nColToDraw  = data[0]->nColToDraw;
  // this->nRowToDraw  = data[0]->nRowToDraw;
  this->filenameVoxelData = "";
  this->directory          = getDirectoryFromPath(filenameParams);
  this->filenameParameters = getNameFromPath(filenameParams);
  this->type               = "color";


  // glGenTextures(1, &wholeTexture);

  // this->x_offset = data[0]->x_offset;
  // this->y_offset = data[0]->y_offset;
  // this->z_offset = data[0]->z_offset;
}
Exemplo n.º 6
0
Cube_T::Cube_T(string filename){

  printf("Cube_T::loading from %s\n", filename.c_str());
  timeStep = 0;
  d_halo = false;
  d_gt = false;

  cubes.resize(0);
  string extension = getExtension(filename);
  if(extension != "cbt"){
    printf("Cube_T::error::the file %s does not end with cbt\n", filename.c_str());
    exit(0);
  }
  std::ifstream in(filename.c_str());
  if(!in.good())
    {
      printf("Cube_T::error::The file %s can not be opened\n",filename.c_str());
      exit(0);
    }
  string s;
  while(getline(in,s)){
    Cube_P* cb;
    if(fileExists(s))
      cb = CubeFactory::load(s);
    else if(fileExists(getDirectoryFromPath(filename) + "/" + getNameFromPath(s)))
      cb = CubeFactory::load(getDirectoryFromPath(filename) +
                             "/" + getNameFromPath(s));
    else{
      printf("Cube_T::The file %s does not exist, exiting\n", s.c_str());
    }
    if(!cb){
      printf("Cube_T::error::The cubee %s can not be loaded\n",s.c_str());
      exit(0);
    }
    cubes.push_back(cb);
  }
  in.close();
  if(cubes.size()==0){
      printf("Cube_T::error::There is no cube loaded from %s\n",s.c_str());
      exit(0);
  }

  // Get all the information from cubes[0] (we assume all the cubes are the same and
  //   do not check for that (check needed if we want to make the code robust)
  this->voxelWidth  = cubes[0]->voxelWidth;
  this->voxelHeight = cubes[0]->voxelHeight;
  this->voxelDepth  = cubes[0]->voxelDepth;
  this->cubeWidth   = cubes[0]->cubeWidth;
  this->cubeHeight  = cubes[0]->cubeHeight;
  this->cubeDepth   = cubes[0]->cubeDepth;
  this->r_max       = cubes[0]->r_max;
  this->s_max       = cubes[0]->s_max;
  this->t_max       = cubes[0]->t_max;
  this->nColToDraw  = cubes[0]->nColToDraw;
  this->nRowToDraw  = cubes[0]->nRowToDraw;
  this->filenameVoxelData = "";
  this->directory          = getDirectoryFromPath(filename);
  this->filenameParameters = getNameFromPath(filename);
  this->type               = cubes[0]->type;

  string noExt = getNameFromPathWithoutExtension(filename);
  string gtName = getDirectoryFromPath(filename) +  noExt + ".gt";
  printf("The ground truth data should be in %s\n", gtName.c_str());
  if(fileExists(gtName)){
    gtData = loadMatrix(gtName);
  }
  printf("ans it's size is %i\n", (int)gtData.size());

}