| 430 | } |
| 431 | |
| 432 | double mitk::DICOMImageBlockDescriptor::stringtodouble( const std::string& str ) const |
| 433 | { |
| 434 | double d; |
| 435 | std::string trimmedstring( str ); |
| 436 | try |
| 437 | { |
| 438 | trimmedstring = trimmedstring.erase( trimmedstring.find_last_not_of( " \n\r\t" ) + 1 ); |
| 439 | } |
| 440 | catch ( ... ) |
| 441 | { |
| 442 | // no last not of |
| 443 | } |
| 444 | |
| 445 | std::string firstcomponent( trimmedstring ); |
| 446 | try |
| 447 | { |
| 448 | firstcomponent = trimmedstring.erase( trimmedstring.find_first_of( "\\" ) ); |
| 449 | } |
| 450 | catch ( ... ) |
| 451 | { |
| 452 | // no last not of |
| 453 | } |
| 454 | |
| 455 | std::istringstream converter( firstcomponent ); |
| 456 | if ( !firstcomponent.empty() && ( converter >> d ) && converter.eof() ) |
| 457 | { |
| 458 | return d; |
| 459 | } |
| 460 | else |
| 461 | { |
| 462 | throw std::invalid_argument( "Argument is not a convertible number" ); |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | mitk::Image::Pointer mitk::DICOMImageBlockDescriptor::DescribeImageWithProperties( Image* mitkImage ) |
| 467 | { |