Program: gdcm
Module: $RCSfile: gdcmJPEGFragment.cxx,v $
Language: C++
- Date: $Date: 2005/01/24 14:52:50 $
- Version: $Revision: 1.6 $
+ Date: $Date: 2005/01/24 16:03:58 $
+ Version: $Revision: 1.7 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
{
// For JPEG 2000, body in file gdcmJpeg2000.cxx
+// Not yet made
bool gdcm_read_JPEG2000_file (std::ifstream* fp, void* image_buffer);
+// For JPEG-LS, body in file gdcmJpegLS.cxx
+// Not yet made
+bool gdcm_read_JPEGLS_file (std::ifstream* fp, void* image_buffer);
+
// For JPEG 8 Bits, body in file gdcmJpeg8.cxx
//bool gdcm_read_JPEG_file8 (JPEGFragment *frag, std::ifstream *fp, void *image_buffer);
bool gdcm_read_JPEG_memory8 (const JOCTET *buffer, const size_t buflen,
* @param buffer output (data decompress)
* @param nBits 8/12 or 16 bits jpeg
*/
-void JPEGFragment::DecompressJPEGFramesFromFile(std::ifstream *fp, uint8_t *buffer, int nBits, int & statesuspension)
+void JPEGFragment::DecompressJPEGFramesFromFile(std::ifstream *fp,
+ uint8_t *buffer, int nBits,
+ int & statesuspension)
{
// First thing need to reset file to proper position:
fp->seekg( Offset, std::ios::beg);
}
else
{
+ // FIXME : only the bits number is checked,
+ // NOT the compression method
+
// other JPEG lossy not supported
gdcmErrorMacro( "Unknown jpeg lossy compression ");
//return false;
}
-void JPEGFragment::DecompressJPEGSingleFrameFragmentsFromFile(JOCTET *buffer, size_t totalLength, uint8_t* raw, int nBits)
+void JPEGFragment::DecompressJPEGSingleFrameFragmentsFromFile(JOCTET *buffer,
+ size_t totalLength, uint8_t *raw, int nBits)
{
size_t howManyRead = 0;
size_t howManyWritten = 0;
}
else
{
+ // FIXME : only the bits number is checked,
+ // NOT the compression method
+
// other JPEG lossy not supported
gdcmErrorMacro( "Unsupported jpeg lossy compression ");
delete [] buffer;
}
-void JPEGFragment::DecompressJPEGFragmentedFramesFromFile(JOCTET *buffer, uint8_t* raw, int nBits, size_t &howManyRead, size_t &howManyWritten, size_t totalLength)
+void JPEGFragment::DecompressJPEGFragmentedFramesFromFile(JOCTET *buffer,
+ uint8_t* raw, int nBits, size_t &howManyRead,
+ size_t &howManyWritten, size_t totalLength)
{
if ( nBits == 8 )
{
}
else
{
+ // FIXME : only the bits number is checked,
+ // NOT the compression method
+
// other JPEG lossy not supported
gdcmErrorMacro( "Unsupported jpeg lossy compression ");
//delete [] buffer;
--- /dev/null
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: gdcmJpegLS.cxx,v $
+ Language: C++
+ Date: $Date: 2005/01/24 16:03:58 $
+ Version: $Revision: 1.1 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+//-----------------------------------------------------------------------------
+#include "gdcmFileHelper.h"
+
+#include <iostream>
+#include <fstream>
+
+namespace gdcm
+{
+
+//-----------------------------------------------------------------------------
+ /**
+ * \brief routine for JPEG decompression
+ * @param fp pointer to an already open file descriptor
+ * JPEG-LS encoded image
+ * @param image_buffer to receive uncompressed pixels
+ * @return 1 on success, 0 on error
+ * @warning : not yet made
+ */
+
+bool gdcm_read_JPEGLS_file (std::ifstream* fp,void* image_buffer) {
+ (void)fp; //FIXME
+ (void)image_buffer; //FIXME
+ std::cout << "Sorry JPEG-LS File not yet taken into account" << std::endl;
+ return false;
+}
+} // end namespace gdcm
+
+//-----------------------------------------------------------------------------
+
Program: gdcm
Module: $RCSfile: gdcmPixelReadConvert.cxx,v $
Language: C++
- Date: $Date: 2005/01/24 14:52:50 $
- Version: $Revision: 1.33 $
+ Date: $Date: 2005/01/24 16:03:58 $
+ Version: $Revision: 1.34 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
{
if ( IsJPEG2000 )
{
+ gdcmVerboseMacro( "Sorry, JPEG2000 not yet taken into account" );
fp->seekg( (*JPEGInfo->Fragments.begin())->Offset, std::ios::beg);
-// if ( ! gdcm_read_JPEG2000_file( fp,Raw ) )
+// if ( ! gdcm_read_JPEG2000_file( fp,Raw ) )
+ gdcmVerboseMacro( "Wrong Blue LUT descriptor" );
+ return false;
+ }
+
+ if ( IsJPEGLS )
+ {
+ gdcmVerboseMacro( "Sorry, JPEG-LS not yet taken into account" );
+ fp->seekg( (*JPEGInfo->Fragments.begin())->Offset, std::ios::beg);
+// if ( ! gdcm_read_JPEGLS_file( fp,Raw ) )
return false;
}
+ if ( ( ZSize == 1 ) && ( JPEGInfo->Fragments.size() > 1 ) )
+ {
+ // we have one frame split into several fragments
+ // we will pack those fragments into a single buffer and
+ // read from it
+ return ReadAndDecompressJPEGSingleFrameFragmentsFromFile( fp );
+ }
+ else if (JPEGInfo->Fragments.size() == (size_t)ZSize)
+ {
+ }
// if ( ( ZSize == 1 ) && ( JPEGInfo->Fragments.size() > 1 ) )
// {
// // we have one frame split into several fragments
if ( HasLUT )
{
// Just in case some access to a File element requires disk access.
- LutRedDescriptor = header->GetEntry( 0x0028, 0x1101 );
- LutGreenDescriptor = header->GetEntry( 0x0028, 0x1102 );
- LutBlueDescriptor = header->GetEntry( 0x0028, 0x1103 );
+ LutRedDescriptor = header->GetEntryValue( 0x0028, 0x1101 );
+ LutGreenDescriptor = header->GetEntryValue( 0x0028, 0x1102 );
+ LutBlueDescriptor = header->GetEntryValue( 0x0028, 0x1103 );
// Depending on the value of Document::MAX_SIZE_LOAD_ELEMENT_VALUE
// [ refer to invocation of Document::SetMaxSizeLoadEntry() in