DocEntry. Now use methods of the Document !
-- BeNours
+2004-12-09 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
+ * src/gdcmPixelReadConvert.cxx : bug fix when would forcing load of a
+ DocEntry. Now use methods of the Document !
+
2004-12-09 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
* Test/ShowDicomSeq.cxx : bug fix
2004-12-09 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
* Test/ShowDicomSeq.cxx : bug fix
Program: gdcm
Module: $RCSfile: gdcmPixelReadConvert.cxx,v $
Language: C++
Program: gdcm
Module: $RCSfile: gdcmPixelReadConvert.cxx,v $
Language: C++
- Date: $Date: 2004/12/03 20:43:37 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2004/12/09 10:11:38 $
+ Version: $Revision: 1.4 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
void PixelReadConvert::GrabInformationsFromHeader( Header* header )
{
void PixelReadConvert::GrabInformationsFromHeader( Header* header )
{
- // Just in case some access to a Header element requires disk access.
- // Note: gdcmDocument::Fp is leaved open after OpenFile.
- std::ifstream* fp = header->OpenFile();
// Number of Bits Allocated for storing a Pixel is defaulted to 16
// when absent from the header.
BitsAllocated = header->GetBitsAllocated();
// Number of Bits Allocated for storing a Pixel is defaulted to 16
// when absent from the header.
BitsAllocated = header->GetBitsAllocated();
HasLUT = header->HasLUT();
if ( HasLUT )
{
HasLUT = header->HasLUT();
if ( HasLUT )
{
+ // Just in case some access to a Header element requires disk access.
+ // Note: gdcmDocument::Fp is leaved open after OpenFile.
LutRedDescriptor = header->GetEntryByNumber( 0x0028, 0x1101 );
LutGreenDescriptor = header->GetEntryByNumber( 0x0028, 0x1102 );
LutBlueDescriptor = header->GetEntryByNumber( 0x0028, 0x1103 );
LutRedDescriptor = header->GetEntryByNumber( 0x0028, 0x1101 );
LutGreenDescriptor = header->GetEntryByNumber( 0x0028, 0x1102 );
LutBlueDescriptor = header->GetEntryByNumber( 0x0028, 0x1103 );
/// is that the [Bin|Val]Entry is unaware of the FILE* is was
/// parsed from. Fix that. FIXME.
/// is that the [Bin|Val]Entry is unaware of the FILE* is was
/// parsed from. Fix that. FIXME.
+ ////// Red round
+ header->LoadEntryBinArea(0x0028, 0x1201);
LutRedData = (uint8_t*)header->GetEntryBinAreaByNumber( 0x0028, 0x1201 );
if ( ! LutRedData )
{
LutRedData = (uint8_t*)header->GetEntryBinAreaByNumber( 0x0028, 0x1201 );
if ( ! LutRedData )
{
- // Read the Lut Data from disk
- DocEntry* lutRedDataEntry = header->GetDocEntryByNumber( 0x0028,
- 0x1201 );
- LutRedData = new uint8_t[ lutRedDataEntry->GetLength() ];
- fp->seekg( lutRedDataEntry->GetOffset() ,std::ios::beg );
- fp->read( (char*)LutRedData, (size_t)lutRedDataEntry->GetLength());
- if ( fp->fail() || fp->eof())//Fp->gcount() == 1
- {
- dbg.Verbose(0, "PixelReadConvert::GrabInformationsFromHeader: "
- "unable to read red LUT data" );
- }
+ dbg.Verbose(0, "PixelReadConvert::GrabInformationsFromHeader: "
+ "unable to read red LUT data" );
+ header->LoadEntryBinArea(0x0028, 0x1202);
LutGreenData = (uint8_t*)header->GetEntryBinAreaByNumber(0x0028, 0x1202 );
if ( ! LutGreenData)
{
LutGreenData = (uint8_t*)header->GetEntryBinAreaByNumber(0x0028, 0x1202 );
if ( ! LutGreenData)
{
- // Read the Lut Data from disk
- DocEntry* lutGreenDataEntry = header->GetDocEntryByNumber( 0x0028,
- 0x1202 );
- LutGreenData = new uint8_t[ lutGreenDataEntry->GetLength() ];
- fp->seekg( lutGreenDataEntry->GetOffset() , std::ios::beg );
- fp->read( (char*)LutGreenData, (size_t)lutGreenDataEntry->GetLength() );
- if ( fp->fail() || fp->eof())//Fp->gcount() == 1
- {
- dbg.Verbose(0, "PixelReadConvert::GrabInformationsFromHeader: "
- "unable to read green LUT data" );
- }
+ dbg.Verbose(0, "PixelReadConvert::GrabInformationsFromHeader: "
+ "unable to read green LUT data" );
+ header->LoadEntryBinArea(0x0028, 0x1203);
LutBlueData = (uint8_t*)header->GetEntryBinAreaByNumber( 0x0028, 0x1203 );
if ( ! LutBlueData )
{
LutBlueData = (uint8_t*)header->GetEntryBinAreaByNumber( 0x0028, 0x1203 );
if ( ! LutBlueData )
{
- // Read the Lut Data from disk
- DocEntry* lutBlueDataEntry = header->GetDocEntryByNumber( 0x0028,
- 0x1203 );
- LutBlueData = new uint8_t[ lutBlueDataEntry->GetLength() ];
- fp->seekg( lutBlueDataEntry->GetOffset() , std::ios::beg );
- fp->read( (char*)LutBlueData, (size_t)lutBlueDataEntry->GetLength() );
- if ( fp->fail() || fp->eof())//Fp->gcount() == 1
- {
- dbg.Verbose(0, "PixelReadConvert::GrabInformationsFromHeader: "
- "unable to read blue LUT data" );
- }
+ dbg.Verbose(0, "PixelReadConvert::GrabInformationsFromHeader: "
+ "unable to read blue LUT data" );
}
}
ComputeDecompressedAndRGBSizes();
}
}
ComputeDecompressedAndRGBSizes();
-
- if(fp)
- {
- header->CloseFile();
- }