MCPcopy Create free account
hub / github.com/MITK/MITK / stringtodouble

Method stringtodouble

Modules/DICOM/src/mitkDICOMImageBlockDescriptor.cpp:432–464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430}
431
432double 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
466mitk::Image::Pointer mitk::DICOMImageBlockDescriptor::DescribeImageWithProperties( Image* mitkImage )
467{

Callers

nothing calls this directly

Calls 2

eraseMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected