Program: gdcm
Module: $RCSfile: gdcmPixelReadConvert.cxx,v $
Language: C++
- Date: $Date: 2005/01/06 20:03:28 $
- Version: $Revision: 1.14 $
+ Date: $Date: 2005/01/08 15:03:59 $
+ Version: $Revision: 1.20 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
if ( numberOfReadBytes > fragmentSize )
{
- dbg.Verbose(0, "PixelReadConvert::ReadAndDecompressRLEFragment: we "
- "read more bytes than the segment size.");
+ gdcmVerboseMacro( "Read more bytes than the segment size.");
return false;
}
}
}
break;
default:
- dbg.Verbose( 0, "PixelReadConvert::ConvertSwapZone: SwapCode value "
- "(16 bits) not allowed." );
+ gdcmVerboseMacro("SwapCode value (16 bits) not allowed.");
}
}
else if( BitsAllocated == 32 )
}
break;
default:
- dbg.Verbose( 0, "PixelReadConvert::ConvertSwapZone: SwapCode value "
- "(32 bits) not allowed." );
+ gdcmVerboseMacro("SwapCode value (32 bits) not allowed." );
}
}
}
{
return false;
}
- //assert( IsJPEGLossless );
+ //gdcmAssertMacro( IsJPEGLossless );
}
else
{
// other JPEG lossy not supported
- dbg.Error("PixelReadConvert::ReadAndDecompressJPEGFile: unknown "
- "jpeg lossy compression ");
+ gdcmErrorMacro( "Unknown jpeg lossy compression ");
return false;
}
if ( ! gdcm_read_JPEG_memory8( buffer, totalLength, Raw,
&howManyRead, &howManyWritten ) )
{
- dbg.Error(
- "PixelConvert::ReadAndDecompressJPEGFile: failed to read jpeg8 "
- );
+ gdcmErrorMacro( "Failed to read jpeg8 ");
delete [] buffer;
return false;
}
if ( ! gdcm_read_JPEG_memory12( buffer, totalLength, Raw,
&howManyRead, &howManyWritten ) )
{
- dbg.Error(
- "PixelConvert::ReadAndDecompressJPEGFile: failed to read jpeg12 "
- );
+ gdcmErrorMacro( "Failed to read jpeg12 ");
delete [] buffer;
return false;
}
if ( ! gdcm_read_JPEG_memory16( buffer, totalLength, Raw,
&howManyRead, &howManyWritten ) )
{
- dbg.Error(
- "PixelConvert::ReadAndDecompressJPEGFile: failed to read jpeg16 "
- );
+ gdcmErrorMacro( "Failed to read jpeg16 ");
delete [] buffer;
return false;
}
else
{
// other JPEG lossy not supported
- dbg.Error("PixelConvert::ReadAndDecompressJPEGFile: unknown "
- "jpeg lossy compression ");
+ gdcmErrorMacro( "Unknown jpeg lossy compression ");
delete [] buffer;
return false;
}
Raw+howManyWritten,
&howManyRead, &howManyWritten ) )
{
- dbg.Error("PixelConvert::ReadAndDecompressJPEGFile: failed to read jpeg8 ");
+ gdcmErrorMacro( "Failed to read jpeg8");
delete [] buffer;
return false;
}
Raw+howManyWritten,
&howManyRead, &howManyWritten ) )
{
- dbg.Error("PixelConvert::ReadAndDecompressJPEGFile: failed to read jpeg12 ");
+ gdcmErrorMacro( "Failed to read jpeg12");
delete [] buffer;
return false;
}
Raw+howManyWritten,
&howManyRead, &howManyWritten ) )
{
- dbg.Error("PixelConvert::ReadAndDecompressJPEGFile: failed to read jpeg16 ");
+ gdcmErrorMacro( "Failed to read jpeg16 ");
delete [] buffer;
return false;
}
else
{
// other JPEG lossy not supported
- dbg.Error("PixelConvert::ReadAndDecompressJPEGFile: unknown "
- "jpeg lossy compression ");
+ gdcmErrorMacro( "Unknown jpeg lossy compression ");
delete [] buffer;
return false;
}
}
else
{
- dbg.Verbose(0, "PixelReadConvert::ConvertReArrangeBits: weird image");
- throw FormatError( "PixelReadConvert::ConvertReArrangeBits()",
- "weird image !?" );
+ gdcmVerboseMacro("Weird image");
+ throw FormatError( "Weird image !?" );
}
}
return true;
//// First stage: get our hands on the Pixel Data.
if ( !fp )
{
- dbg.Verbose( 0, "PixelReadConvert::ReadAndDecompressPixelData: "
- "unavailable file pointer." );
+ gdcmVerboseMacro( "Unavailable file pointer." );
return false;
}
fp->seekg( PixelOffset, std::ios::beg );
- if( fp->fail() || fp->eof()) //Fp->gcount() == 1
+ if( fp->fail() || fp->eof())
{
- dbg.Verbose( 0, "PixelReadConvert::ReadAndDecompressPixelData: "
- "unable to find PixelOffset in file." );
+ gdcmVerboseMacro( "Unable to find PixelOffset in file." );
return false;
}
// variable). But RawSize is the right size of the image !
if( PixelDataLength != RawSize)
{
- dbg.Verbose( 0, "PixelReadConvert::ReadAndDecompressPixelData: "
- "Mismatch between PixelReadConvert and RawSize." );
+ gdcmVerboseMacro( "Mismatch between PixelReadConvert and RawSize." );
}
if( PixelDataLength > RawSize)
{
fp->read( (char*)Raw, PixelDataLength);
}
- if ( fp->fail() || fp->eof())//Fp->gcount() == 1
+ if ( fp->fail() || fp->eof())
{
- dbg.Verbose( 0, "PixelReadConvert::ReadAndDecompressPixelData: "
- "reading of Raw pixel data failed." );
+ gdcmVerboseMacro( "Reading of Raw pixel data failed." );
return false;
}
}
{
if ( ! ReadAndDecompressRLEFile( fp ) )
{
- dbg.Verbose( 0, "PixelReadConvert::ReadAndDecompressPixelData: "
- "RLE decompressor failed." );
+ gdcmVerboseMacro( "RLE decompressor failed." );
return false;
}
}
// Default case concerns JPEG family
if ( ! ReadAndDecompressJPEGFile( fp ) )
{
- dbg.Verbose( 0, "PixelReadConvert::ReadAndDecompressPixelData: "
- "JPEG decompressor failed." );
+ gdcmVerboseMacro( "JPEG decompressor failed." );
return false;
}
}
if ( HasLUT )
{
// Just in case some access to a Header element requires disk access.
- LutRedDescriptor = header->GetEntryByNumber( 0x0028, 0x1101 );
- LutGreenDescriptor = header->GetEntryByNumber( 0x0028, 0x1102 );
- LutBlueDescriptor = header->GetEntryByNumber( 0x0028, 0x1103 );
+ LutRedDescriptor = header->GetEntry( 0x0028, 0x1101 );
+ LutGreenDescriptor = header->GetEntry( 0x0028, 0x1102 );
+ LutBlueDescriptor = header->GetEntry( 0x0028, 0x1103 );
// Depending on the value of Document::MAX_SIZE_LOAD_ELEMENT_VALUE
// [ refer to invocation of Document::SetMaxSizeLoadEntry() in
////// Red round
header->LoadEntryBinArea(0x0028, 0x1201);
- LutRedData = (uint8_t*)header->GetEntryBinAreaByNumber( 0x0028, 0x1201 );
+ LutRedData = (uint8_t*)header->GetEntryBinArea( 0x0028, 0x1201 );
if ( ! LutRedData )
{
- dbg.Verbose(0, "PixelReadConvert::GrabInformationsFromHeader: "
- "unable to read red LUT data" );
+ gdcmVerboseMacro( "Unable to read red LUT data" );
}
////// Green round:
header->LoadEntryBinArea(0x0028, 0x1202);
- LutGreenData = (uint8_t*)header->GetEntryBinAreaByNumber(0x0028, 0x1202 );
+ LutGreenData = (uint8_t*)header->GetEntryBinArea(0x0028, 0x1202 );
if ( ! LutGreenData)
{
- dbg.Verbose(0, "PixelReadConvert::GrabInformationsFromHeader: "
- "unable to read green LUT data" );
+ gdcmVerboseMacro( "Unable to read green LUT data" );
}
////// Blue round:
header->LoadEntryBinArea(0x0028, 0x1203);
- LutBlueData = (uint8_t*)header->GetEntryBinAreaByNumber( 0x0028, 0x1203 );
+ LutBlueData = (uint8_t*)header->GetEntryBinArea( 0x0028, 0x1203 );
if ( ! LutBlueData )
{
- dbg.Verbose(0, "PixelReadConvert::GrabInformationsFromHeader: "
- "unable to read blue LUT data" );
+ gdcmVerboseMacro( "Unable to read blue LUT data" );
}
}
&lengthR, &debR, &nbitsR );
if( nbRead != 3 )
{
- dbg.Verbose(0, "PixelReadConvert::BuildLUTRGBA: wrong red LUT descriptor");
+ gdcmVerboseMacro( "Wrong red LUT descriptor" );
}
int lengthG; // Green LUT length in Bytes
&lengthG, &debG, &nbitsG );
if( nbRead != 3 )
{
- dbg.Verbose(0, "PixelReadConvert::BuildLUTRGBA: wrong green LUT descriptor");
+ gdcmVerboseMacro( "Wrong green LUT descriptor" );
}
int lengthB; // Blue LUT length in Bytes
&lengthB, &debB, &nbitsB );
if( nbRead != 3 )
{
- dbg.Verbose(0, "PixelReadConvert::BuildLUTRGBA: wrong blue LUT descriptor");
+ gdcmVerboseMacro( "Wrong blue LUT descriptor" );
}
////////////////////////////////////////////////////////
}
else
{
- dbg.Verbose(0, "PixelReadConvert::Print: set as RLE file "
- "but NO RLEinfo present.");
+ gdcmVerboseMacro("Set as RLE file but NO RLEinfo present.");
}
}
}
else
{
- dbg.Verbose(0, "PixelReadConvert::Print: set as JPEG file "
- "but NO JPEGinfo present.");
+ gdcmVerboseMacro("Set as JPEG file but NO JPEGinfo present.");
}
}
}