]> Creatis software - clitk.git/blobdiff - common/rtkXRadImageIO.cxx
Merge branch 'master' of git.creatis.insa-lyon.fr:clitk
[clitk.git] / common / rtkXRadImageIO.cxx
index f7903569e43ec8139a001190ea2c5ca7d92e4a4e..db5eb72fe6861c24c22759f155e1ae12d749a81b 100644 (file)
@@ -32,10 +32,10 @@ void rtk::XRadImageIO::ReadImageInformation()
     itkExceptionMacro(<<"Could not open file " << m_FileName);
 
   SetNumberOfDimensions(3);
+  std::string section="";
   while(!is.eof())
     {
     std::string line;
-    std::string section;
     std::getline(is, line);
     if(line.find('[')!=std::string::npos)
       {
@@ -57,24 +57,24 @@ void rtk::XRadImageIO::ReadImageInformation()
         SetDimensions(2, atoi(paramValue.c_str()));
       else if(paramName == std::string("CBCT.DimensionalAttributes.DataSize"))
         {
-        if(atoi(paramValue.c_str())!=3)
-          {
-          itkExceptionMacro(<<"Was expecting CBCT.DimensionalAttributes.DataSize==3");
-          }
+        if(atoi(paramValue.c_str())==3)
+          SetComponentType(itk::ImageIOBase::FLOAT);
+        if(atoi(paramValue.c_str())==6)
+          SetComponentType(itk::ImageIOBase::USHORT);
         }
       else if(paramName == std::string("CBCT.DimensionalAttributes.PixelDimension_I_cm"))
         {
-        double spacing = 0.1*atof(paramValue.c_str());
+        double spacing = 10*atof(paramValue.c_str());
         SetSpacing(0, (spacing==0.)?1.:spacing);
         }
       else if(paramName == std::string("CBCT.DimensionalAttributes.PixelDimension_J_cm"))
         {
-        double spacing = 0.1*atof(paramValue.c_str());
+        double spacing = 10*atof(paramValue.c_str());
         SetSpacing(1, (spacing==0.)?1.:spacing);
         }
       else if(paramName == std::string("CBCT.DimensionalAttributes.PixelDimension_K_cm"))
         {
-        double spacing = 0.1*atof(paramValue.c_str());
+        double spacing = 10*atof(paramValue.c_str());
         SetSpacing(2, (spacing==0.)?1.:spacing);
         }
       else
@@ -87,7 +87,6 @@ void rtk::XRadImageIO::ReadImageInformation()
       }
 
     }
-  SetComponentType(itk::ImageIOBase::FLOAT);
 } ////
 
 //--------------------------------------------------------------------