]> Creatis software - clitk.git/blobdiff - common/clitkCommon.cxx
Add clitkSUVPeak & clitkRTStructStatistics
[clitk.git] / common / clitkCommon.cxx
index 3c16d879e7a39c055b26690b4c27676919c5a182..57be29e5297f833d53769818b0aa097cb3d93a6c 100644 (file)
@@ -41,7 +41,7 @@ void clitk::skipComment(std::istream & is)
     is >> c;
     if (is.eof()) return;
   }
-  if (!(is.fail()) || c != '\n')
+  if (!(is.fail()) && c != '\n')
     is.unget();
 } ////
 //------------------------------------------------------------------
@@ -104,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)
 {
@@ -243,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 : <"