# HG changeset patch # User Sebastien Jodogne # Date 1559024941 -7200 # Node ID 9f68155c75b025cdb56747976aefe99b93620de7 # Parent 5aa7285005868638bc58b6b63a1b4b837c92a5a5 speeding up LinearAlgebra::ParseVector() diff -r 5aa728500586 -r 9f68155c75b0 Framework/Toolbox/DicomStructureSet.cpp --- a/Framework/Toolbox/DicomStructureSet.cpp Tue May 28 07:48:57 2019 +0200 +++ b/Framework/Toolbox/DicomStructureSet.cpp Tue May 28 08:29:01 2019 +0200 @@ -31,7 +31,6 @@ #include #include -#include #include #include #include @@ -422,7 +421,6 @@ << static_cast(structures_[i].green_) << "," << static_cast(structures_[i].blue_) << ")"; - // These temporary variables avoid allocating many vectors in the loop below OrthancPlugins::DicomPath countPointsPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, i, DICOM_TAG_CONTOUR_SEQUENCE, 0, diff -r 5aa728500586 -r 9f68155c75b0 Framework/Toolbox/LinearAlgebra.cpp --- a/Framework/Toolbox/LinearAlgebra.cpp Tue May 28 07:48:57 2019 +0200 +++ b/Framework/Toolbox/LinearAlgebra.cpp Tue May 28 08:29:01 2019 +0200 @@ -26,7 +26,6 @@ #include #include -#include #include namespace OrthancStone @@ -71,9 +70,16 @@ { try { - target[i] = boost::lexical_cast(items[i]); + /** + * We don't use "boost::lexical_cast<>" here, as it is very + * slow. As we are parsing many doubles, we prefer to use + * the standard "std::stod" function: + * http://www.cplusplus.com/reference/string/stod/ + **/ + + target[i] = std::stod(items[i]); } - catch (boost::bad_lexical_cast&) + catch (std::exception&) { target.clear(); return false;