+2004-11-10 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
+ * src/gdcmDocument.cxx : Set the file pointer TP to 0 in the constructors.
+ Verify the file pointer value before open the file, and if it's not null,
+ a verbose message is generated.
+ Close correctly the file when the file isn't considered dicom-like. The
+ correctly close is a call to CloseFile.
+ When closing the file pointer, test if its not null to close the file.
+ * src/gdcmPixelConvert.cxx : bug fix for the SIEMENS_GBS_III-16-ACR_NEMA_1.acr
+ file. For an uncompressed image, the copied datas correspond in the least
+ case to the image size (calculated) or the image size specified in the
+ header. A verbose is generated if these two size mismatch
+
2004-11-09 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
- * src/TestAllReadCompareDicom.cxx : test the existence of the directory
+ * Test/TestAllReadCompareDicom.cxx : test the existence of the directory
using an 'ifstream' other than a 'FILE *'. The previous solution ('FILE *')
break under windows (with msvc6 compilation).
little endian. This should -heopfully- fix some tests
2004-11-03 Mathieu Malaterre <Mathieu.Malaterre@creatis.insa-lyon.fr>
- * Now the dictionary is compiled into gdcm lib. This is a default
+ * Now the dictionary is compiled into gdcm lib. This is a default
behavior, thus any dic file specified is picked before failback to
the one comiled into lib
Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2004/11/09 21:55:55 $
- Version: $Revision: 1.119 $
+ Date: $Date: 2004/11/10 16:13:18 $
+ Version: $Revision: 1.120 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
Filename = filename;
Initialise();
+ Fp = 0;
if ( !OpenFile() )
{
return;
*/
Document::Document() : ElementSet(-1)
{
+ Fp = 0;
+
SetMaxSizeLoadEntry(MAX_SIZE_LOAD_ELEMENT_VALUE);
Initialise();
PrintLevel = 1; // 'Medium' print level by default
*/
std::ifstream* Document::OpenFile()
{
+ if(Fp)
+ {
+ dbg.Verbose( 0,
+ "Document::OpenFile is already opened when opening: ",
+ Filename.c_str());
+ }
+
Fp = new std::ifstream(Filename.c_str(), std::ios::in | std::ios::binary);
if(!Fp)
return Fp;
}
- Fp->close();
+ CloseFile();
dbg.Verbose( 0,
"Document::OpenFile not DICOM/ACR (missing preamble)",
Filename.c_str());
*/
bool Document::CloseFile()
{
- Fp->close();
- delete Fp;
- Fp = 0;
+ if( Fp )
+ {
+ Fp->close();
+ delete Fp;
+ Fp = 0;
+ }
- return true; //FIXME how do we detect a non-close ifstream ?
+ return true; //FIXME how do we detect a non-close ifstream ?
}
/**
Program: gdcm
Module: $RCSfile: gdcmPixelConvert.cxx,v $
Language: C++
- Date: $Date: 2004/11/09 21:55:56 $
- Version: $Revision: 1.26 $
+ Date: $Date: 2004/11/10 16:13:18 $
+ Version: $Revision: 1.27 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
//// First stage: get our hands on the Pixel Data.
if ( !fp )
{
- dbg.Verbose( 0, "PixelConvert::ReadAndDecompressPixelData: "
- "unavailable file pointer." );
+ dbg.Verbose( 0, "PixelConvert::ReadAndDecompressPixelData: "
+ "unavailable file pointer." );
return false;
}
fp->seekg( PixelOffset, std::ios_base::beg );
if( fp->fail() || fp->eof()) //Fp->gcount() == 1
{
- dbg.Verbose( 0, "PixelConvert::ReadAndDecompressPixelData: "
- "unable to find PixelOffset in file." );
+ dbg.Verbose( 0, "PixelConvert::ReadAndDecompressPixelData: "
+ "unable to find PixelOffset in file." );
return false;
}
}
else if ( IsDecompressed )
{
- fp->read( (char*)Decompressed, PixelDataLength);
+ if( PixelDataLength != DecompressedSize)
+ {
+ dbg.Verbose( 0, "PixelConvert::ReadAndDecompressPixelData: "
+ "Mismatch between PixelConvert and DecompressedSize." );
+ }
+ if( PixelDataLength > DecompressedSize)
+ {
+ fp->read( (char*)Decompressed, DecompressedSize);
+ }
+ else
+ {
+ fp->read( (char*)Decompressed, PixelDataLength);
+ }
+
if ( fp->fail() || fp->eof())//Fp->gcount() == 1
{
dbg.Verbose( 0, "PixelConvert::ReadAndDecompressPixelData: "