X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvMeshReader.cxx;h=152a9a3860e1758ebf74abb64ee22b0b6f7e0a93;hb=74568fd461746fc0c842960277174df43050a935;hp=d5100b1e336218485b608022da329ade80515765;hpb=1e034c70105f0926939acaaa27ddb46e904ae8bf;p=clitk.git diff --git a/vv/vvMeshReader.cxx b/vv/vvMeshReader.cxx index d5100b1..152a9a3 100644 --- a/vv/vvMeshReader.cxx +++ b/vv/vvMeshReader.cxx @@ -35,6 +35,7 @@ #include "clitkCommon.h" #include "vvMeshReader.h" #include "vvProgressDialog.h" +#include vvMeshReader::vvMeshReader() : vtk_mode(false) @@ -76,28 +77,6 @@ void vvMeshReader::run() } } -template -ElementType parse_value(std::string str) -{ - std::istringstream parser(str); - ElementType value; - parser >> value; - assert(!parser.fail()); - return value; -} - -template -std::vector parse_string(std::string str,char delim) -{ - std::istringstream ss(str); - std::string token; - std::vector result; - while (getline(ss,token,delim)) { - result.push_back(parse_value(token)); - } - return result; -} - std::vector > vvMeshReader::GetROINames() { assert(filename!=""); @@ -137,7 +116,7 @@ std::vector vvMeshReader::readSelectedContours() ss >> roi_number; if (std::find(selected_contours.begin(),selected_contours.end(),roi_number) != selected_contours.end()) { //Only read selected ROIs vvMesh::Pointer current_roi=vvMesh::New(); - std::vector rgb=parse_string(i->GetEntryValue(0x3006,0x002a),'\\'); + std::vector rgb=clitk::parse_string(i->GetEntryValue(0x3006,0x002a),'\\'); assert(rgb.size()==3); current_roi->r=rgb[0]/255; current_roi->g=rgb[1]/255; @@ -148,8 +127,8 @@ std::vector vvMeshReader::readSelectedContours() for(gdcm::SQItem* j=contours->GetFirstSQItem(); j!=0; j=contours->GetNextSQItem()) { //loop over 2D contours std::string contour_type=j->GetEntryValue(0x3006,0x0042); if (contour_type=="CLOSED_PLANAR ") { - int point_number=parse_value(j->GetEntryValue(0x3006,0x0046)); - std::vector points=parse_string(j->GetEntryValue(0x3006,0x0050),'\\'); + int point_number=clitk::parse_value(j->GetEntryValue(0x3006,0x0046)); + std::vector points=clitk::parse_string(j->GetEntryValue(0x3006,0x0050),'\\'); assert(points.size() == static_cast(point_number)*3); if (z0 == -1) //First contour z0=points[2];