Mercurial > hg > orthanc
comparison Core/Toolbox.cpp @ 532:b22312081388 dicom-rt
extract roi geometry
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 30 Aug 2013 16:09:19 +0200 |
parents | 8c3573d28868 |
children | b82292ba2083 |
comparison
equal
deleted
inserted
replaced
529:bd2087bb6450 | 532:b22312081388 |
---|---|
715 | 715 |
716 default: | 716 default: |
717 throw OrthancException(ErrorCode_NotImplemented); | 717 throw OrthancException(ErrorCode_NotImplemented); |
718 } | 718 } |
719 } | 719 } |
720 | |
721 | |
722 | |
723 void Toolbox::Split(std::vector<std::string>& result, | |
724 const std::string& source, | |
725 char delimiter) | |
726 { | |
727 if (source.size() == 0) | |
728 { | |
729 result.clear(); | |
730 return; | |
731 } | |
732 | |
733 size_t count = 1; | |
734 for (size_t i = 0; i < source.size(); i++) | |
735 { | |
736 if (source[i] == delimiter) | |
737 { | |
738 count++; | |
739 } | |
740 } | |
741 | |
742 result.clear(); | |
743 result.resize(count); | |
744 | |
745 size_t pos = 0; | |
746 size_t start = 0; | |
747 while (start < source.size()) | |
748 { | |
749 assert(pos < count); | |
750 | |
751 size_t end = start; | |
752 while (end < source.size() && | |
753 source[end] != delimiter) | |
754 { | |
755 end++; | |
756 } | |
757 | |
758 result[pos++] = source.substr(start, end - start); | |
759 start = end + 1; | |
760 } | |
761 } | |
762 | |
720 } | 763 } |