Commit ecab63d7 authored by Alexander Wiebel's avatar Alexander Wiebel

[FIX #33 (old #520)] handle wrong label file format correctly

parent e02a81ae
......@@ -367,23 +367,35 @@ void WMAtlasSurfaces::loadLabels( std::string fileName )
std::vector<std::string>svec;
for( size_t i = 0; i < lines.size(); ++i )
try
{
svec.clear();
boost::regex reg( "," );
boost::sregex_token_iterator it( lines[i].begin(), lines[i].end(), reg, -1 );
boost::sregex_token_iterator end;
while( it != end )
for( size_t i = 0; i < lines.size(); ++i )
{
svec.push_back( *it++ );
}
if( svec.size() == 3 )
{
std::pair< std::string, std::string >newLabel( svec[1], svec[2] );
m_labels[boost::lexical_cast<size_t>( svec[0] )] = newLabel;
svec.clear();
boost::regex reg( "," );
boost::sregex_token_iterator it( lines[i].begin(), lines[i].end(), reg, -1 );
boost::sregex_token_iterator end;
while( it != end )
{
svec.push_back( *it++ );
}
if( svec.size() == 3 )
{
std::pair< std::string, std::string >newLabel( svec[1], svec[2] );
m_labels[boost::lexical_cast<size_t>( svec[0] )] = newLabel;
}
}
m_labelsLoaded = true;
}
catch( const std::exception& e )
{
// print this message AFTER creation of WException to have the backtrace before the message
WLogger::getLogger()->addLogMessage(
std::string( "Problem while loading label file. Probably not suitable content. Message: " ) + e.what(),
"Module (" + getName() + ")", LL_ERROR );
m_labels.clear();
m_labelsLoaded = false;
}
m_labelsLoaded = true;
}
void WMAtlasSurfaces::createRoi()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment