From: Claire Mouton <claire.mouton@creatis.insa-lyon.fr>
Date: Wed, 23 Jan 2013 11:40:27 +0000 (+0100)
Subject: bbstdReadColumnsDouble adds an extra line at the end of the read file.
X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=8cd6cec80f0aa98b6ccc740342eae8a0792b3770;p=bbtk.git

bbstdReadColumnsDouble adds an extra line at the end of the read file.
Bug #1897
---

diff --git a/packages/std/src/bbstdReadColumnsDouble.cxx b/packages/std/src/bbstdReadColumnsDouble.cxx
index 95a8576..c74a39f 100644
--- a/packages/std/src/bbstdReadColumnsDouble.cxx
+++ b/packages/std/src/bbstdReadColumnsDouble.cxx
@@ -56,13 +56,16 @@ void ReadColumnsDouble::Process()
 	FILE *ff1 = fopen( bbGetInputFileName().c_str() , "r+" );
 	if (ff1!=NULL)
 	{
+                if (!feof(ff1))
+                        fscanf(ff1,"%s",tmpValue);
+
 		while (!feof(ff1))
 		{
 			for( i=0 ;  i<bbGetInputDimension() ; i++)
 			{
-				fscanf(ff1,"%s",tmpValue);
 				vecData=tlst[i];
 				vecData->push_back( atof(tmpValue) );
+                                fscanf(ff1,"%s",tmpValue);
 			}	
 			numberOfLines++;			
 		}	
diff --git a/packages/vtk/src/bbvtkSphereList.cxx b/packages/vtk/src/bbvtkSphereList.cxx
index 8d5cfe7..50889bd 100644
--- a/packages/vtk/src/bbvtkSphereList.cxx
+++ b/packages/vtk/src/bbvtkSphereList.cxx
@@ -82,8 +82,7 @@ void SphereList::Process()
                         std::cout << "CM SphereList::Process i=" <<  i  << " bbGetInputlstPointZ()[i]=" << bbGetInputlstPointZ()[i] << std::endl;
                       }
                     // If the vector Y or respectively the vector Z has a different size from the vector X, the position value py or respectively pz is set to 0.
-                    // Stops at iMax - 1 because of a bug of the box stdReadColumnsDouble creating an extra line at the end of the file.
-                    for ( int i=iMin ; i<iMax-1; i=i+1 )
+                    for ( int i=iMin ; i<iMax; i=i+1 )
                     {
 			px = bbGetInputlstPointX()[i]*spc[0];
 			if (bbGetInputlstPointY().size() == bbGetInputlstPointX().size() )