X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkCommon.cxx;h=57be29e5297f833d53769818b0aa097cb3d93a6c;hb=1dfeba065d7121eb27aa44a792095af817652683;hp=b12f6f5d4b64eb17add326e8ae6dfd69e26d2c2d;hpb=765020625fbc092d283e221e36c83e60a1844cb7;p=clitk.git diff --git a/common/clitkCommon.cxx b/common/clitkCommon.cxx index b12f6f5..57be29e 100644 --- a/common/clitkCommon.cxx +++ b/common/clitkCommon.cxx @@ -41,7 +41,8 @@ void clitk::skipComment(std::istream & is) is >> c; if (is.eof()) return; } - is.unget(); + if (!(is.fail()) && c != '\n') + is.unget(); } //// //------------------------------------------------------------------ @@ -103,6 +104,15 @@ float clitk::PixelTypeDownCast(const double & x) } //------------------------------------------------------------------ +//------------------------------------------------------------------ +// Convert a pixel type without casting +template<> +double clitk::PixelTypeDownCast(const double & x) +{ + return x; +} +//------------------------------------------------------------------ + //------------------------------------------------------------------ double clitk::rad2deg(const double anglerad) { @@ -242,7 +252,7 @@ double clitk::ComputeEuclideanDistanceFromPointToPlane(const itk::ContinuousInde // Open a file for reading void clitk::openFileForReading(std::ifstream & is, const std::string & filename) { - is.open(filename.c_str(), std::ios::in); + is.open(filename.c_str(), std::ios::in | std::ios::binary); if ( is.fail() ) { clitkExceptionMacro("Could not open file for reading: " << filename << ". Error is : <"