From 2fa3d673d3314bb75db8af293c0e1bd6749fa23d Mon Sep 17 00:00:00 2001 From: Julien Michel <julien.michel@c-s.fr> Date: Tue, 30 Jan 2007 13:13:35 +0000 Subject: [PATCH] =?UTF-8?q?Correction=20des=20erreurs=20=C3=A0=20l'=C3=A9x?= =?UTF-8?q?=C3=A9cution=20sur=20les=20it=C3=A9rateurs=20lev=C3=A9es=20pour?= =?UTF-8?q?=20vs8=20en=20mode=20d=C3=A9bug.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Code/Common/otbTestMain.h | 44 +++++++------------ .../otbMorphologicalPyramidAnalyseFilter.cxx | 5 +-- 2 files changed, 18 insertions(+), 31 deletions(-) diff --git a/Code/Common/otbTestMain.h b/Code/Common/otbTestMain.h index bb7bc524ae..4c38850f50 100644 --- a/Code/Common/otbTestMain.h +++ b/Code/Common/otbTestMain.h @@ -80,8 +80,8 @@ int main(int ac, char* av[] ) char *baselineFilenameAscii = NULL; char *testFilenameAscii = NULL; // vector if image filenames to compare - std::vector<char*> baseLineFilenamesImage; - std::vector<char*> testFilenamesImage; + std::vector<std::string> baseLineFilenamesImage; + std::vector<std::string> testFilenamesImage; // On some sgi machines, threads and stl don't mix. @@ -129,6 +129,8 @@ int main(int ac, char* av[] ) if (strcmp(av[1], "--compare-image") == 0) { lToleranceDiffPixelImage = (double)(::atof(av[2])); + baseLineFilenamesImage.reserve(1); + testFilenamesImage.reserve(1); baseLineFilenamesImage.push_back(av[3]); testFilenamesImage.push_back(av[4]); av += 4; @@ -139,6 +141,8 @@ int main(int ac, char* av[] ) lToleranceDiffPixelImage = (double)(::atof(av[2])); // Number of comparisons to do unsigned int nbComparisons=(unsigned int)(::atoi(av[3])); + baseLineFilenamesImage.reserve(nbComparisons); + testFilenamesImage.reserve(nbComparisons); // Retrieve all the file names for(unsigned int i = 0; i<nbComparisons;i++) { @@ -184,46 +188,30 @@ otbMsgDebugMacro(<<"---------------- DEBUT Controle NON-REGRESION --------- if ((baseLineFilenamesImage.size()>0) && (testFilenamesImage.size()>0)) { // Creates iterators on baseline filenames vector and test filenames vector - std::vector<char*>::iterator itBaselineFilenames = baseLineFilenamesImage.begin(); - std::vector<char*>::iterator itTestFilenames = testFilenamesImage.begin(); + std::vector<std::string>::iterator itBaselineFilenames = baseLineFilenamesImage.begin(); + std::vector<std::string>::iterator itTestFilenames = testFilenamesImage.begin(); // For each couple of baseline and test file, do the comparison for(;(itBaselineFilenames != baseLineFilenamesImage.end()) &&(itTestFilenames != testFilenamesImage.end()); ++itBaselineFilenames,++itTestFilenames) { - char * baselineFilenameImage = (*itBaselineFilenames); - char * testFilenameImage = (*itTestFilenames); + std::string baselineFilenameImage = (*itBaselineFilenames); + std::string testFilenameImage = (*itTestFilenames); - std::map<std::string,int> baselines = RegressionTestBaselines(baselineFilenameImage); + std::map<std::string,int> baselines = RegressionTestBaselines(const_cast<char*>(baselineFilenameImage.c_str())); std::map<std::string,int>::iterator baseline = baselines.begin(); - std::string bestBaseline; - int bestBaselineStatus = itk::NumericTraits<int>::max(); - while (baseline != baselines.end()) - { - baseline->second = RegressionTestImage(testFilenameImage, + baseline->second = RegressionTestImage(testFilenameImage.c_str(), (baseline->first).c_str(), 0, lToleranceDiffPixelImage); - if (baseline->second < bestBaselineStatus) - { - bestBaseline = baseline->first; - bestBaselineStatus = baseline->second; - } - if (baseline->second == 0) + if (baseline->second != 0) { - break; - } - ++baseline; - } - // if the best we can do still has errors, generate the error images - if (bestBaselineStatus) - { - baseline->second = RegressionTestImage(testFilenameImage, - bestBaseline.c_str(), + baseline->second = RegressionTestImage(testFilenameImage.c_str(), + (baseline->first).c_str(), 1, lToleranceDiffPixelImage); } - result += bestBaselineStatus; + result += baseline->second; } } // Test de non regression sur des fichiers ascii diff --git a/Testing/Code/MultiScale/otbMorphologicalPyramidAnalyseFilter.cxx b/Testing/Code/MultiScale/otbMorphologicalPyramidAnalyseFilter.cxx index 3da43beb86..c96892712f 100644 --- a/Testing/Code/MultiScale/otbMorphologicalPyramidAnalyseFilter.cxx +++ b/Testing/Code/MultiScale/otbMorphologicalPyramidAnalyseFilter.cxx @@ -69,8 +69,8 @@ int otbMorphologicalPyramidAnalyseFilter(int argc, char * argv[]) ImageListIterator itAnalyse = pyramid->GetOutput()->Begin(); ImageListIterator itSupFiltre = pyramid->GetSupFiltre()->Begin(); ImageListIterator itInfFiltre = pyramid->GetInfFiltre()->Begin(); - ImageListIterator itInfDeci = pyramid->GetSupDeci()->Begin(); - ImageListIterator itSupDeci = pyramid->GetInfDeci()->Begin(); + ImageListIterator itInfDeci = pyramid->GetInfDeci()->Begin(); + ImageListIterator itSupDeci = pyramid->GetSupDeci()->Begin(); WriterType::Pointer writer = WriterType::New(); @@ -78,7 +78,6 @@ int otbMorphologicalPyramidAnalyseFilter(int argc, char * argv[]) // std::stringstream oss; itk::OStringStream oss; // Writing the results images - std::cout<<(itAnalyse!=(pyramid->GetOutput()->End()))<<std::endl; while((itAnalyse!=pyramid->GetOutput()->End()) &&(itSupFiltre!=pyramid->GetSupFiltre()->End()) &&(itInfFiltre!=pyramid->GetInfFiltre()->End()) -- GitLab