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)
+ if(line.find('[') != std::string::npos)
{
unsigned int pos1 = line.find('[');
unsigned int pos2 = line.find(']');
section = line.substr(pos1+1, pos2-pos1-1);
}
- if(line.find('=')!=std::string::npos)
+ if(line.find('=') != std::string::npos)
{
unsigned int pos = line.find('=');
std::string paramName = line.substr(0,pos);
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
}
}
- SetComponentType(itk::ImageIOBase::FLOAT);
} ////
//--------------------------------------------------------------------
// Adapted from itkRawImageIO
{
+#if ( ITK_VERSION_MAJOR < 5 )
using namespace itk;
// Swap bytes if necessary
if itkReadRawBytesAfterSwappingMacro( unsigned short, USHORT )
else if itkReadRawBytesAfterSwappingMacro( unsigned char, UCHAR )
else if itkReadRawBytesAfterSwappingMacro( unsigned int, UINT )
else if itkReadRawBytesAfterSwappingMacro( int, INT )
- else if itkReadRawBytesAfterSwappingMacro( unsigned int, ULONG )
- else if itkReadRawBytesAfterSwappingMacro( int, LONG )
else if itkReadRawBytesAfterSwappingMacro( float, FLOAT )
else if itkReadRawBytesAfterSwappingMacro( double, DOUBLE );
+#else
+ #define itkReadRawBytesAfterSwappingMacro(StrongType, WeakType) \
+ ( this->GetComponentType() == WeakType ) \
+ { \
+ using InternalByteSwapperType = itk::ByteSwapper<StrongType>; \
+ if ( m_ByteOrder == LittleEndian ) \
+ { \
+ InternalByteSwapperType::SwapRangeFromSystemToLittleEndian( \
+ (StrongType *)buffer, this->GetImageSizeInComponents() ); \
+ } \
+ else if ( m_ByteOrder == BigEndian ) \
+ { \
+ InternalByteSwapperType::SwapRangeFromSystemToBigEndian( \
+ (StrongType *)buffer, this->GetImageSizeInComponents() ); \
+ } \
+ }
+
+ // Swap bytes if necessary
+ if itkReadRawBytesAfterSwappingMacro( unsigned short, USHORT )
+ else if itkReadRawBytesAfterSwappingMacro( short, SHORT )
+ else if itkReadRawBytesAfterSwappingMacro( char, CHAR )
+ else if itkReadRawBytesAfterSwappingMacro( unsigned char, UCHAR )
+ else if itkReadRawBytesAfterSwappingMacro( unsigned int, UINT )
+ else if itkReadRawBytesAfterSwappingMacro( int, INT )
+ else if itkReadRawBytesAfterSwappingMacro( float, FLOAT )
+ else if itkReadRawBytesAfterSwappingMacro( double, DOUBLE );
+#endif
}
}
//--------------------------------------------------------------------
// Write Image Information
-void rtk::XRadImageIO::WriteImageInformation(bool keepOfStream)
+void rtk::XRadImageIO::WriteImageInformation(bool itkNotUsed(keepOfStream))
{
}
//--------------------------------------------------------------------
// Write Image Information
-bool rtk::XRadImageIO::CanWriteFile(const char* FileNameToWrite)
+bool rtk::XRadImageIO::CanWriteFile(const char* itkNotUsed(FileNameToWrite))
{
return false;
}
//--------------------------------------------------------------------
// Write Image
-void rtk::XRadImageIO::Write(const void * buffer)
+void rtk::XRadImageIO::Write(const void * itkNotUsed(buffer))
{
} ////