+
+ std::ifstream file;
+ file.open( (const char*) (filename.c_str()) );
+ double gv=-1;
+ int in=-1,red=-1,gr=-1,bl=-1;
+
+ std::cout<<filename<<std::endl;
+ itembitmaps.clear();
+ if(file.is_open())
+ {
+ bool add = false;
+ HistogramDialogComboBoxItem* item=NULL;
+ while(!file.eof())
+ {
+ std::string line;
+ std::getline(file,line);
+
+ if( (int)(line.find("<Colors>")!=-1))
+ {
+ item = new HistogramDialogComboBoxItem();
+ }else if( (int)(line.find("RGBgreyValue"))!=-1)
+ {
+ int pos1=line.find(">");
+ int pos2=line.find("<",pos1+1);
+ std::string x=line.substr(pos1+1,pos2-pos1-1);
+ gv=atof(x.c_str());
+
+ }
+ else if( (int)(line.find("red"))!=-1)
+ {
+ int pos1=line.find(">");
+ int pos2=line.find("<",pos1+1);
+ std::string x=line.substr(pos1+1,pos2-pos1-1);
+ red=atoi(x.c_str());
+
+ }
+ else if( (int)(line.find("green"))!=-1)
+ {
+ int pos1=line.find(">");
+ int pos2=line.find("<",pos1+1);
+ std::string x=line.substr(pos1+1,pos2-pos1-1);
+ gr=atoi(x.c_str());
+ }
+ else if( (int)(line.find("blue"))!=-1 )
+ {
+ int pos1=line.find(">");
+ int pos2=line.find("<",pos1+1);
+ std::string x=line.substr(pos1+1,pos2-pos1-1);
+ bl=atoi(x.c_str());
+ greyvect.push_back(gv);
+ redvect.push_back(red);
+ greenvect.push_back(gr);
+ bluevect.push_back(bl);
+ }else if( (int)(line.find("</Colors>"))!=-1 ){
+
+ item->SetColors(greyvect,redvect,greenvect,bluevect);
+
+ itembitmaps.push_back(item);
+
+ greyvect.clear();
+ redvect.clear();
+ greenvect.clear();
+ bluevect.clear();
+
+ }
+
+ line.clear();
+ }
+ file.close();
+ std::cout<<itembitmaps.size()<<std::endl;
+ }
+
+}