* src/gdcmException.h: introduced new gdcmFormatUnexpected class
(gdcmFormatError now inherits from gdcmFormatUnexpected).
* TODO updated
+ * gdcmPython/testSuite.py checks on CR-MONO1-10-chest.dcm moved to
+ gdcmData/TestAllEntryVerifyReference.txt
+ * Test/TestAllEntryVerify.cxx is now effective (used allways return true)
+ * src/gdcmDocument.[cxx|h]: constructors no longer use the bool
+ exception_on_error parameter.
+ - src/gdcmFile.[cxx|h], src/gdcmHeader.[cxx|h] changed accordingly,
+ - vtk/vtkGdcmReader.cxx changed accordingly,
+ - Example/*.cxx and Test/*.cxx changed accordingly.
2004-07-06 Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
* src/gdcmDicomDir.cxx, gdcmDocEntrySet.cxx: removed inclusion of errno.h
fileName += "/test.acr";
}
- e1= new gdcmHeader( fileName.c_str(), false );
+ e1= new gdcmHeader( fileName.c_str() );
e1->SetPrintLevel(2);
fileName += "/test.acr";
}
- e1= new gdcmHeader( fileName.c_str(), false );
+ e1= new gdcmHeader( fileName.c_str() );
f1 = new gdcmFile(e1);
fileName += "/test.acr";
}
- gdcmFile *e2 = new gdcmFile( fileName.c_str(), false );
+ gdcmFile *e2 = new gdcmFile( fileName.c_str() );
gdcmHeader *e1 = e2->GetHeader();
if (argc > 2) {
toto = argv[1];
- e1 = new gdcmHeader( toto.c_str(), false );
+ e1 = new gdcmHeader( toto.c_str() );
if (!e1->IsReadable())
{
std::cerr << "Sorry, not a Readable DICOM / ACR File" <<std::endl;
toto = argv[1];
- e1 = new gdcmHeader( toto.c_str(), false );
+ e1 = new gdcmHeader( toto.c_str() );
if (!e1->IsReadable()) {
std::cerr << "Sorry, not a Readable DICOM / ACR File" <<std::endl;
return 0;
std::cout << argv[1] << std::endl;
- e1 = new gdcmHeader( toto, false );
+ e1 = new gdcmHeader( toto );
if (!e1->IsReadable()) {
std::cerr << "Sorry, " << toto <<" not a Readable DICOM / ACR File"
<<std::endl;
// --------------------- we read the written image
- e2 = new gdcmHeader( zozo, false );
+ e2 = new gdcmHeader( zozo );
if (!e2->IsReadable()) {
std::cerr << "Sorry, " << zozo << " not a Readable DICOM / ACR File"
<<std::endl;
{
string fileName = DataPath + i->first;
cout << Indent << "FileName: " << fileName << endl;
- gdcmHeader* tested = new gdcmHeader( fileName.c_str(), false );
+ gdcmHeader* tested = new gdcmHeader( fileName.c_str() );
if( !tested->IsReadable() )
{
cerr << Indent << "Image not gdcm compatible:"
cout << Indent << " OK" << endl;
}
cout << Indent << endl;
- return true; //???
+ return true;
}
istream& ReferenceFileParser::eatwhite( istream& is )
Parser.Open(referenceFilename);
Parser.SetDataPath(referenceDir);
// Parser.Print();
- Parser.Check();
-/*
- int i = 0;
- while( gdcmDataImages[i] != 0 )
- {
- string filename = GDCM_DATA_ROOT;
- filename += "/"; //doh!
- filename += gdcmDataImages[i++];
-
- cout << " Testing: " << filename << endl;
-
- gdcmHeader* tested = new gdcmHeader( filename.c_str(), false, true );
- if( !tested->GetHeader()->IsReadable() )
- {
- cout << " Image not gdcm compatible:"
- << filename << endl;
- delete tested;
- return 1;
- }
-
- //////////////// Clean up:
- delete tested;
- }
-*/
-
- return 0;
+ if ( Parser.Check() )
+ return 0;
+ return 1;
}
{
std::cout << " Testing: " << filename << std::endl;
- gdcmFile* tested = new gdcmFile( filename, false );
+ gdcmFile* tested = new gdcmFile( filename );
if( !tested->GetHeader()->IsReadable() )
{
std::cout << " Image not gdcm compatible:"
////// When reference file is not gdcm readable test is failed:
- gdcmFile* reference = new gdcmFile( referenceFileName.c_str(), false );
+ gdcmFile* reference = new gdcmFile( referenceFileName.c_str() );
if( !reference->GetHeader()->IsReadable() )
{
std::cout << " Reference image " << std::endl
//////////////// Step 1 (see above description):
- gdcmHeader *header = new gdcmHeader( filename, false );
+ gdcmHeader *header = new gdcmHeader( filename );
if( !header->IsReadable() )
{
std::cerr << "Test::TestReadWriteReadCompare: Image not gdcm compatible:"
//////////////// Step 3:
- gdcmFile* reread = new gdcmFile( "TestReadWriteReadCompare.dcm", false );
+ gdcmFile* reread = new gdcmFile( "TestReadWriteReadCompare.dcm" );
if( !reread->GetHeader()->IsReadable() )
{
std::cerr << "Test::TestReadWriteReadCompare: Could not reread image "
# http://www.barre.nom.fr/medical/samples/index.html
BarreFiles = [
####################################
- # CR modality examples:
- ####################################
- ["CR-MONO1-10-chest.dcm",
- [ ["Modality", "CR"],
- #"Transfer Syntax UID" is absent.
- ["Rows", "440"],
- ["Columns", "440"],
- ["Bits Stored", "10"],
- ["Bits Allocated", "16"],
- ["High Bit", "9"],
- ["Pixel Representation", "0"],
- ["Manufacturer", "FUJI PHOTO FILM CO. LTD."],
- ["Manufacturer's Model Name", "9000"],
- ["Pixel Data", "gdcm::NotLoaded. Address:776 Length:387200 x(5e880)"]
- ] ],
- ####################################
# CT modality examples:
####################################
- ["CT-MONO2-16-brain.dcm",
- [ ["Transfer Syntax UID", "1.2.840.10008.1.2.1"], # Explicit VR, LE
- ["Modality", "CT"],
- ["Rows", "512"],
- ["Columns", "512"],
- ["Bits Stored", "16"],
- ["Bits Allocated", "16"],
- ["High Bit", "15"],
- ["Pixel Representation", "1"],
- ["Manufacturer", "Picker International, Inc."],
- ["Manufacturer's Model Name", "PQ5000"],
- ["Pixel Data", "gdcm::NotLoaded. Address:1680 Length:524288 x(80000)"]
- ] ],
["CT-MONO2-16-ort.dcm",
[ ["Transfer Syntax UID", "1.2.840.10008.1.2"], # Implicit VR, LE
["Modality", "CT"],
Program: gdcm
Module: $RCSfile: gdcmDicomDir.cxx,v $
Language: C++
- Date: $Date: 2004/08/01 02:39:09 $
- Version: $Revision: 1.62 $
+ Date: $Date: 2004/08/02 16:42:14 $
+ Version: $Revision: 1.63 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/**
* \ingroup gdcmDicomDir
* \brief Constructor : creates an empty gdcmDicomDir
- * @param exception_on_error whether we want to throw an exception or not
*/
-gdcmDicomDir::gdcmDicomDir(bool exception_on_error):
- gdcmDocument( exception_on_error )
+gdcmDicomDir::gdcmDicomDir()
+ :gdcmDocument( )
{
Initialize();
* and wants to explore recursively the directories
* - false if user passed an already built DICOMDIR file
* and wants to use it
- * @param exception_on_error whether we want to throw an exception or not
*/
-gdcmDicomDir::gdcmDicomDir(std::string const & fileName, bool parseDir,
- bool exception_on_error):
- gdcmDocument( fileName, exception_on_error)
+gdcmDicomDir::gdcmDicomDir(std::string const & fileName, bool parseDir ):
+ gdcmDocument( fileName )
{
// que l'on ai passe un root directory ou un DICOMDIR
// et quelle que soit la valeur de parseDir,
break;
}
- header = new gdcmHeader( it->c_str(),false );
+ header = new gdcmHeader( it->c_str() );
if( !header )
{
dbg.Verbose( 1,
Program: gdcm
Module: $RCSfile: gdcmDicomDir.h,v $
Language: C++
- Date: $Date: 2004/07/19 03:34:11 $
- Version: $Revision: 1.25 $
+ Date: $Date: 2004/08/02 16:42:14 $
+ Version: $Revision: 1.26 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
class GDCM_EXPORT gdcmDicomDir: public gdcmDocument
{
public:
- gdcmDicomDir(std::string const & fileName,
- bool parseDir = false,
- bool exception_on_error = false);
- gdcmDicomDir(bool exception_on_error = false);
+ gdcmDicomDir( std::string const & fileName, bool parseDir = false );
+ gdcmDicomDir();
~gdcmDicomDir();
Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2004/08/02 14:06:57 $
- Version: $Revision: 1.64 $
+ Date: $Date: 2004/08/02 16:42:14 $
+ Version: $Revision: 1.65 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/**
* \brief constructor
* @param inFilename file to be opened for parsing
- * @param exception_on_error whether we throw an exception or not
*/
-gdcmDocument::gdcmDocument( std::string const & filename,
- bool exception_on_error)
+gdcmDocument::gdcmDocument( std::string const & filename )
: gdcmElementSet(-1)
{
SetMaxSizeLoadEntry(MAX_SIZE_LOAD_ELEMENT_VALUE);
Filename = filename;
Initialise();
- if ( !OpenFile(exception_on_error))
+ if ( !OpenFile() )
{
return;
}
CloseFile();
// --------------------------------------------------------------
- // Special Patch to allow gdcm to read ACR-LibIDO formated images
+ // Specific code to allow gdcm to read ACR-LibIDO formated images
+ // Note: ACR-LibIDO is an extension of the ACR standard that was
+ // used at CREATIS. For the time being (say a couple years)
+ // we keep this kludge to allow a smooth move to gdcm for
+ // CREATIS developpers (sorry folks).
//
// if recognition code tells us we deal with a LibIDO image
// we switch lineNumber and columnNumber
SetEntryByNumber(columns, 0x0028, 0x0010);
SetEntryByNumber(rows , 0x0028, 0x0011);
}
- // ----------------- End of Special Patch ----------------
+ // ----------------- End of ACR-LibIDO kludge ------------------
PrintLevel = 1; // 'Medium' print level by default
}
/**
- * \brief constructor
- * @param exception_on_error
+ * \brief This default constructor doesn't parse the file. You should
+ * then invoke \ref gdcmDocument::SetFileName and then the parsing.
*/
-gdcmDocument::gdcmDocument(bool exception_on_error)
+gdcmDocument::gdcmDocument()
:gdcmElementSet(-1)
{
- (void)exception_on_error;
-
SetMaxSizeLoadEntry(MAX_SIZE_LOAD_ELEMENT_VALUE);
Initialise();
-
PrintLevel = 1; // 'Medium' print level by default
}
}
/**
- * \brief opens the file
- * @param exception_on_error
- * @return
+ * \brief Tries to open the file \ref gdcmDocument::Filename and
+ * checks the preamble when existing.
+ * @return The FILE pointer on success.
*/
-FILE *gdcmDocument::OpenFile(bool exception_on_error)
- throw(gdcmFileError)
+FILE* gdcmDocument::OpenFile()
{
- Fp = fopen(Filename.c_str(),"rb");
+ Fp = fopen(Filename.c_str(),"rb");
- if(!Fp)
- {
- if(exception_on_error)
- {
- throw gdcmFileError("gdcmDocument::gdcmDocument(const char *, bool)");
- }
- else
- {
- dbg.Verbose(0, "gdcmDocument::OpenFile cannot open file: ",
- Filename.c_str());
- return NULL;
- }
- }
-
- if ( Fp )
- {
- uint16_t zero;
- fread(&zero, (size_t)2, (size_t)1, Fp);
-
- //ACR -- or DICOM with no Preamble --
- if( zero == 0x0008 || zero == 0x0800 || zero == 0x0002 || zero == 0x0200 )
- {
- return Fp;
- }
-
- //DICOM
- fseek(Fp, 126L, SEEK_CUR);
- char dicm[4];
- fread(dicm, (size_t)4, (size_t)1, Fp);
- if( memcmp(dicm, "DICM", 4) == 0 )
- {
- return Fp;
- }
-
- fclose(Fp);
- dbg.Verbose(0, "gdcmDocument::OpenFile not DICOM/ACR", Filename.c_str());
- }
- else
- {
- dbg.Verbose(0, "gdcmDocument::OpenFile cannot open file", Filename.c_str());
- }
-
- return 0;
+ if(!Fp)
+ {
+ dbg.Verbose( 0,
+ "gdcmDocument::OpenFile cannot open file: ",
+ Filename.c_str());
+ return 0;
+ }
+
+ uint16_t zero;
+ fread(&zero, (size_t)2, (size_t)1, Fp);
+
+ //ACR -- or DICOM with no Preamble --
+ if( zero == 0x0008 || zero == 0x0800 || zero == 0x0002 || zero == 0x0200 )
+ {
+ return Fp;
+ }
+
+ //DICOM
+ fseek(Fp, 126L, SEEK_CUR);
+ char dicm[4];
+ fread(dicm, (size_t)4, (size_t)1, Fp);
+ if( memcmp(dicm, "DICM", 4) == 0 )
+ {
+ return Fp;
+ }
+
+ fclose(Fp);
+ dbg.Verbose( 0,
+ "gdcmDocument::OpenFile not DICOM/ACR (missing preamble)",
+ Filename.c_str());
+
+ return 0;
}
/**
Program: gdcm
Module: $RCSfile: gdcmDocument.h,v $
Language: C++
- Date: $Date: 2004/08/02 14:06:58 $
- Version: $Revision: 1.29 $
+ Date: $Date: 2004/08/02 16:42:14 $
+ Version: $Revision: 1.30 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
FileType GetFileType();
- FILE* OpenFile(bool exception_on_error = false) throw( gdcmFileError );
+ FILE* OpenFile();
bool CloseFile();
void Write(FILE* fp, FileType type);
gdcmBinEntry* ReplaceOrCreateByNumber(void *voidArea, int lgth,
uint16_t group, uint16_t elem);
- bool ReplaceIfExistByNumber (std::string const & value, uint16_t group, uint16_t elem);
+ bool ReplaceIfExistByNumber ( std::string const & value,
+ uint16_t group,
+ uint16_t elem );
virtual void* LoadEntryVoidArea(uint16_t group, uint16_t elem);
virtual void* LoadEntryVoidArea(gdcmBinEntry* entry);
- // System access
+ // System access (meaning endian related !?)
uint16_t SwapShort(uint16_t); // needed by gdcmFile
uint32_t SwapLong(uint32_t); // needed by gdcmFile
uint16_t UnswapShort(uint16_t); // needed by gdcmFile
// Constructor and destructor are protected to forbid end user
// to instanciate from this class gdcmDocument (only gdcmHeader and
// gdcmDicomDir are meaningfull).
- gdcmDocument(bool exception_on_error = false);
- gdcmDocument(std::string const & filename,
- bool exception_on_error = false);
+ gdcmDocument();
+ gdcmDocument( std::string const & filename );
virtual ~gdcmDocument();
void Parse7FE0 ();
Program: gdcm
Module: $RCSfile: gdcmFile.cxx,v $
Language: C++
- Date: $Date: 2004/07/31 23:30:04 $
- Version: $Revision: 1.119 $
+ Date: $Date: 2004/08/02 16:42:14 $
+ 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
* one sets an a posteriori shadow dictionary (efficiency can be
* seen as a side effect).
* @param filename file to be opened for parsing
- * @param exception_on_error whether we throw an exception or not
*/
-gdcmFile::gdcmFile(std::string const & filename,
- bool exception_on_error )
+gdcmFile::gdcmFile(std::string const & filename )
{
- Header = new gdcmHeader( filename, exception_on_error );
+ Header = new gdcmHeader( filename );
SelfHeader = true;
PixelRead = -1; // no ImageData read yet.
Program: gdcm
Module: $RCSfile: gdcmFile.h,v $
Language: C++
- Date: $Date: 2004/07/31 23:30:04 $
- Version: $Revision: 1.41 $
+ Date: $Date: 2004/08/02 16:42:14 $
+ Version: $Revision: 1.42 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
class GDCM_EXPORT gdcmFile
{
public:
- gdcmFile(gdcmHeader *header);
- gdcmFile(std::string const & filename,
- bool exception_on_error = false);
+ gdcmFile( gdcmHeader *header );
+ gdcmFile( std::string const & filename );
virtual ~gdcmFile();
Program: gdcm
Module: $RCSfile: gdcmHeader.cxx,v $
Language: C++
- Date: $Date: 2004/07/31 23:30:04 $
- Version: $Revision: 1.181 $
+ Date: $Date: 2004/08/02 16:42:14 $
+ Version: $Revision: 1.182 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/**
* \brief Constructor
* @param filename name of the file whose header we want to analyze
- * @param exception_on_error whether we want to throw an exception or not
*/
-gdcmHeader::gdcmHeader( std::string const & filename,
- bool exception_on_error ):
- gdcmDocument( filename,
- exception_on_error )
+gdcmHeader::gdcmHeader( std::string const & filename ):
+ gdcmDocument( filename )
{
// for some ACR-NEMA images GrPixel, NumPixel is *not* 7fe0,0010
// We may encounter the 'RETired' (0x0028, 0x0200) tag
/**
* \brief Constructor
- * @param exception_on_error whether we want to throw an exception or not
*/
-gdcmHeader::gdcmHeader(bool exception_on_error) :
- gdcmDocument( exception_on_error )
+gdcmHeader::gdcmHeader()
+ :gdcmDocument()
{
}
Program: gdcm
Module: $RCSfile: gdcmHeader.h,v $
Language: C++
- Date: $Date: 2004/07/31 23:30:04 $
- Version: $Revision: 1.85 $
+ Date: $Date: 2004/08/02 16:42:14 $
+ Version: $Revision: 1.86 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
uint16_t GrPixel;
public:
- gdcmHeader(bool exception_on_error = false);
- gdcmHeader(std::string const & filename,
- bool exception_on_error = false);
+ gdcmHeader();
+ gdcmHeader( std::string const & filename );
virtual ~gdcmHeader();
#include <vtkPointData.h>
#include <vtkLookupTable.h>
-vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.47 $");
+vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.48 $");
vtkStandardNewMacro(vtkGdcmReader);
//-----------------------------------------------------------------------------
fclose(fp);
// Stage 1.2: check for Gdcm parsability
- gdcmHeader GdcmHeader(FileName->c_str(), false );
+ gdcmHeader GdcmHeader(FileName->c_str() );
if (!GdcmHeader.IsReadable())
{
vtkErrorMacro("Gdcm cannot parse file " << FileName->c_str());
unsigned long & UpdateProgressCount)
{
vtkDebugMacro("Copying to memory image [" << FileName.c_str() << "]");
- gdcmFile GdcmFile( FileName.c_str(), false );
+ gdcmFile GdcmFile( FileName.c_str() );
size_t size;
// If the data structure of vtk for image/volume representation