Program: gdcm
Module: $RCSfile: gdcmPixelConvert.cxx,v $
Language: C++
- Date: $Date: 2004/10/14 05:33:14 $
- Version: $Revision: 1.12 $
+ Date: $Date: 2004/10/14 22:35:02 $
+ Version: $Revision: 1.13 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDebug.h"
#include "gdcmPixelConvert.h"
-// External JPEG decompression
-
-// for JPEGLosslessDecodeImage
-#include "jpeg/ljpg/jpegless.h"
-
namespace gdcm
{
bool gdcm_read_JPEG2000_file (FILE* fp, void* image_buffer);
// For JPEG 8 Bits, body in file gdcmJpeg8.cxx
-bool gdcm_read_JPEG_file (FILE* fp, void* image_buffer);
+bool gdcm_read_JPEG_file8 (FILE* fp, void* image_buffer);
// For JPEG 12 Bits, body in file gdcmJpeg12.cxx
bool gdcm_read_JPEG_file12 (FILE* fp, void* image_buffer);
+// For JPEG 16 Bits, body in file gdcmJpeg16.cxx
+// Beware this is misleading there is no 16bits DCT algorithm, only
+// jpeg lossless compression exist in 16bits.
+bool gdcm_read_JPEG_file16 (FILE* fp, void* image_buffer);
//-----------------------------------------------------------------------------
{
uint8_t* im = (uint8_t*)image_buffer;
long uncompressedSegmentSize = XSize * YSize;
-
-
+
// Loop on the frame[s]
for( RLEFramesInfo::RLEFrameList::iterator
it = RLEInfo->Frames.begin();
{
SwapZone( pixelZone );
}
-
+
// Special kludge in order to deal with xmedcon broken images:
if ( ( BitsAllocated == 16 )
&& ( BitsStored < BitsAllocated )
++it )
{
fseek( fp, (*it)->Offset, SEEK_SET );
-
+
if ( IsJPEG2000 )
{
if ( ! gdcm_read_JPEG2000_file( fp, destination ) )
return false;
}
}
- else if ( IsJPEGLossless )
- {
- // JPEG LossLess : call to xmedcom Lossless JPEG
- JPEGLosslessDecodeImage( fp,
- (uint16_t*)destination,
- PixelSize * 8 * SamplesPerPixel,
- (*it)->Length );
- }
else if ( BitsStored == 8)
{
// JPEG Lossy : call to IJG 6b
- if ( ! gdcm_read_JPEG_file ( fp, destination ) )
+ if ( ! gdcm_read_JPEG_file8( fp, destination ) )
{
return false;
}
return false;
}
}
+ else if ( BitsStored == 16)
+ {
+ // Reading Fragment pixels
+ if ( ! gdcm_read_JPEG_file16 ( fp, destination ) )
+ {
+ return false;
+ }
+ //assert( IsJPEGLossless );
+ }
else
{
// other JPEG lossy not supported
// for next fragment decompression (if any)
int length = XSize * YSize * SamplesPerPixel;
int numberBytes = BitsAllocated / 8;
-
- destination = (uint8_t*)destination + length * numberBytes;
-
+
+ destination += length * numberBytes;
}
return true;
}
"weird image !?" );
}
}
- return true; //???
+ return true;
}
/**