X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FrtkHisImageIO.cxx;h=af0cc585ad79dcc5735eb7c9b3efefa23ac280e9;hb=942db0e6f00e876ac6fbea41076db2ff703010a5;hp=04a6e46144d6829b01ca317714b759cfe7886357;hpb=0eee78cb7631a3d8d0d6685fda487de2a29ad5e7;p=clitk.git diff --git a/common/rtkHisImageIO.cxx b/common/rtkHisImageIO.cxx index 04a6e46..af0cc58 100644 --- a/common/rtkHisImageIO.cxx +++ b/common/rtkHisImageIO.cxx @@ -128,66 +128,13 @@ void rtk::HisImageIO::Read(void * buffer) } //-------------------------------------------------------------------- -bool rtk::HisImageIO::CanWriteFile(const char* FileNameToWrite) +bool rtk::HisImageIO::CanWriteFile( const char* itkNotUsed(FileNameToWrite) ) { - return CanReadFile(FileNameToWrite); + return false; } //-------------------------------------------------------------------- // Write Image -void rtk::HisImageIO::Write(const void* buffer) +void rtk::HisImageIO::Write( const void* itkNotUsed(buffer) ) { - std::ofstream file(m_FileName.c_str(), std::ios::out | std::ios::binary); - - if ( file.fail() ) - itkGenericExceptionMacro(<< "Could not open file (for writing): " << m_FileName); - - m_HeaderSize = HEADER_INFO_SIZE + 32; - unsigned char szHeader[HEADER_INFO_SIZE + 32] = { - 0x00, 0x70, 0x44, 0x00, 0x64, 0x00, 0x64, 0x00, 0x20, 0x00, 0x20, 0x00, 0x01, 0x00, 0x01, 0x00, - 0x00, 0x04, 0x00, 0x04, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6A, 0x18, 0x41, - 0x04, 0x00, 0x40, 0x5F, 0x48, 0x01, 0x40, 0x00, 0x86, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x63, 0x13, 0x00, 0xE8, 0x51, 0x13, 0x00, 0x5C, 0xE7, 0x12, 0x00, - 0xFE, 0x2A, 0x49, 0x5F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 - }; - - /* Fill into the header the essentials - The 'iheader' in previous module is fixed to 0x20, and is included in szHeader. - The 'ulx' and 'uly' are fixed to 0x01, so that 'brx' and 'bry' reflect the dimensions of - the image. - */ - const unsigned int ndim = GetNumberOfDimensions(); - if ( (ndim < 2) || (ndim > 3) ) - itkExceptionMacro( <<"Only 2D or 3D support"); - - szHeader[16] = (char)(GetDimensions(0) % 256); // X-size lsb - szHeader[17] = (char)(GetDimensions(0) / 256); // X-size msb - szHeader[18] = (char)(GetDimensions(1) % 256); // Y-size lsb - szHeader[19] = (char)(GetDimensions(1) / 256); // Y-size msb - if (ndim == 3) { - szHeader[20] = (char)(GetDimensions(0) % 256); // NbFrames lsb - szHeader[21] = (char)(GetDimensions(0) / 256); // NbFrames msb - } - - switch (GetComponentType()) - { - case itk::ImageIOBase::USHORT: - szHeader[32] = 4; - break; - //case AVS_TYPE_INTEGER: - // szHeader[32] = 8; - // break; - //case AVS_TYPE_REAL: - // szHeader[32] = 16; - // break; - default: - itkExceptionMacro(<< "Unsupported field type"); - break; - } - - file.write((const char *)szHeader, m_HeaderSize); - file.write( (const char *)buffer, GetImageSizeInBytes() ); - file.close(); } ////