dirName = argv[1];
}
- gdcmDicomDir *dcmdir;
- dcmdir=new gdcmDicomDir();
+ gdcm::DicomDir *dcmdir;
+ dcmdir = new gdcm::DicomDir();
printf( "\n------- BuildUpDicomDir: Test Print Meta only -----\n");
- ((gdcmDocument *)dcmdir)->Print();
+ ((gdcm::Document *)dcmdir)->Print();
- gdcmDicomDirPatient *p1=dcmdir->NewPatient();
+ gdcm::DicomDirPatient *p1=dcmdir->NewPatient();
p1->SetEntryByNumber("patientONE",0x0010, 0x0010);
- gdcmDicomDirPatient *p2=dcmdir->NewPatient();
+ gdcm::DicomDirPatient *p2=dcmdir->NewPatient();
p2->SetEntryByNumber("patientTWO",0x0010, 0x0010);
- gdcmDicomDirStudy *s21=p2->NewStudy();
+ gdcm::DicomDirStudy *s21=p2->NewStudy();
s21->SetEntryByNumber("StudyDescrTwo.One",0x0008, 0x1030);
- gdcmDicomDirSerie *s211=s21->NewSerie();
- gdcmDicomDirImage *s2111=s211->NewImage();
+ gdcm::DicomDirSerie *s211=s21->NewSerie();
+ gdcm::DicomDirImage *s2111=s211->NewImage();
(void)s2111; //not used
- gdcmDicomDirStudy *s11=p1->NewStudy();
+ gdcm::DicomDirStudy *s11=p1->NewStudy();
s11->SetEntryByNumber("StudyDescrOne.One",0x0008, 0x1030);
// Name of the physician reading study
// Header Entry to be created
s11->SetEntryByNumber("Dr Mabuse",0x0008, 0x1060);
- gdcmDicomDirPatient *p3 = dcmdir->NewPatient();
+ gdcm::DicomDirPatient *p3 = dcmdir->NewPatient();
p3->SetEntryByNumber("patientTHREE",0x0010, 0x0010);
std::cout << "\n------- BuildUpDicomDir: Test Print of Patient ONE -----\n";
std::string toto, titi;
- gdcmFile * f1;
+ gdcm::File * f1;
if(argc > 1 )
- f1 = new gdcmFile(argv[1]);
+ f1 = new gdcm::File(argv[1]);
else {
toto = GDCM_DATA_ROOT;
toto += "/test.acr";
- f1 = new gdcmFile(toto);
+ f1 = new gdcm::File(toto);
}
std::string ManufacturerName="SIEMENS ";
return 1;
}
- gdcmHeader* header = new gdcmHeader( argv[1] );
- TagDocEntryHT* Ht = header->BuildFlatHashTable();
+ gdcm::Header* header = new gdcm::Header( argv[1] );
+ gdcm::TagDocEntryHT* Ht = header->BuildFlatHashTable();
- for (TagDocEntryHT::iterator tag = Ht->begin(); tag != Ht->end(); ++tag)
+ for (gdcm::TagDocEntryHT::iterator tag = Ht->begin(); tag != Ht->end(); ++tag)
{
tag->second->Print();
std::cout << std::endl;
int main(int argc, char* argv[])
{
- gdcmDicomDir *e1;
+ gdcm::DicomDir *e1;
- ListDicomDirPatient::iterator itPatient;
- ListDicomDirStudy::iterator itStudy;
- ListDicomDirSerie::iterator itSerie;
- ListDicomDirImage::iterator itImage;
- TSKey v;
+ gdcm::ListDicomDirPatient::iterator itPatient;
+ gdcm::ListDicomDirStudy::iterator itStudy;
+ gdcm::ListDicomDirSerie::iterator itSerie;
+ gdcm::ListDicomDirImage::iterator itImage;
+ gdcm::TSKey v;
std::string file;
if (argc > 1)
file += "/DICOMDIR";
}
- e1 = new gdcmDicomDir( file );
+ e1 = new gdcm::DicomDir( file );
if (argc > 2) {
int level = atoi(argv[2]);
int main(int argc, char* argv[])
{
- gdcmHeader *e1;
+ gdcm::Header *e1;
std::string fileName;
if (argc != 2) {
fileName += "/test.acr";
}
- e1= new gdcmHeader( fileName.c_str() );
+ e1= new gdcm::Header( fileName.c_str() );
e1->SetPrintLevel(2);
int main(int argc, char* argv[])
{
- gdcmHeader *e1;
- gdcmFile *f1;
+ gdcm::Header *e1;
+ gdcm::File *f1;
std::string fileName;
if (argc != 2) {
std::cout << " usage : PrintDocument fileName" << std::endl;
fileName += "/test.acr";
}
- e1= new gdcmHeader( fileName.c_str() );
+ e1= new gdcm::Header( fileName.c_str() );
- f1 = new gdcmFile(e1);
+ f1 = new gdcm::File(e1);
e1->SetPrintLevel(2);
fileName += "/test.acr";
}
- gdcmFile *e2 = new gdcmFile( fileName.c_str() );
- gdcmHeader *e1 = e2->GetHeader();
+ gdcm::File *e2 = new gdcm::File( fileName.c_str() );
+ gdcm::Header *e1 = e2->GetHeader();
if (argc > 2) {
int level = atoi(argv[2]);
return 1;
}
- gdcmHeader *h1 = new gdcmHeader( argv[1] );
- gdcmFile *f1 = new gdcmFile( h1 );
- gdcmFile *f2 = new gdcmFile( argv[2] );
+ gdcm::Header *h1 = new gdcm::Header( argv[1] );
+ gdcm::File *f1 = new gdcm::File( h1 );
+ gdcm::File *f2 = new gdcm::File( argv[2] );
// 0018 1310 US ACQ Acquisition Matrix
- gdcmDictEntry *dictEntry =
+ gdcm::DictEntry *dictEntry =
f2->GetHeader()->GetPubDict()->GetDictEntryByName( "Acquisition Matrix" );
std::cerr << std::hex << dictEntry->GetGroup() << "," << dictEntry->GetElement() << std::endl;
return 1;
}
}
- gdcmFile *original = new gdcmFile( filename );
+ gdcm::File *original = new gdcm::File( filename );
std::cout << "--- Original ----------------------" << std::endl;
//original->GetHeader()->Print();
- gdcmFile *copy = new gdcmFile( output );
+ gdcm::File *copy = new gdcm::File( output );
- TagDocEntryHT & Ht = original->GetHeader()->GetEntry();
+ gdcm::TagDocEntryHT & Ht = original->GetHeader()->GetEntry();
size_t dataSize = original->GetImageDataSize();
uint8_t* imageData = original->GetImageData();
// (the user does NOT have to know the way we implemented the Header !)
// Waiting for a 'clean' solution, I keep the method ...JPRx
- gdcmDocEntry* d;
+ gdcm::DocEntry* d;
- for (TagDocEntryHT::iterator tag = Ht.begin(); tag != Ht.end(); ++tag)
+ for (gdcm::TagDocEntryHT::iterator tag = Ht.begin(); tag != Ht.end(); ++tag)
{
d = tag->second;
d->Print(); std::cout << std::endl;
- if ( gdcmBinEntry* b = dynamic_cast<gdcmBinEntry*>(d) )
+ if ( gdcm::BinEntry* b = dynamic_cast<gdcm::BinEntry*>(d) )
{
copy->GetHeader()->ReplaceOrCreateByNumber(
b->GetBinArea(),
b->GetElement(),
b->GetVR() );
}
- else if ( gdcmValEntry* v = dynamic_cast<gdcmValEntry*>(d) )
+ else if ( gdcm::ValEntry* v = dynamic_cast<gdcm::ValEntry*>(d) )
{
copy->GetHeader()->ReplaceOrCreateByNumber(
v->GetValue(),
std::string toto;
char zozo[100];
- gdcmFile * f1;
+ gdcm::File * f1;
printf (" Before gdcmFile() \n");
printf ("\n\n---------------------------------------\n\n");
if (argc > 1) {
toto = argv[1];
- f1 = new gdcmFile(toto);
+ f1 = new gdcm::File(toto);
} else {
std::string filename = GDCM_DATA_ROOT;
filename += "/test.acr";
- f1 = new gdcmFile(filename.c_str());
+ f1 = new gdcm::File(filename.c_str());
}
printf (" Sortie gdcmFile() \n");
//////////////// Step 1 (see above description):
- gdcmHeader *header = new gdcmHeader( filename );
+ gdcm::Header *header = new gdcm::Header( filename );
if( !header->IsReadable() )
{
std::cerr << "Test::TestReadWriteReadCompare: Image not gdcm compatible:"
//////////////// Step 2:
- gdcmFile* file = new gdcmFile( header );
+ gdcm::File* file = new gdcm::File( header );
int dataSize = file->GetImageDataSize();
uint8_t* imageData = file->GetImageData(); //EXTREMELY IMPORTANT
// Sure, it is : It's up to the user to decide if he wants to
//////////////// Step 3:
- gdcmFile* reread = new gdcmFile( "TestReadWriteReadCompare.dcm" );
+ gdcm::File* reread = new gdcm::File( "TestReadWriteReadCompare.dcm" );
if( !reread->GetHeader()->IsReadable() )
{
std::cerr << "Test::TestReadWriteReadCompare: Could not reread image "
char zozo[200];
- gdcmHeader* e1;
- gdcmFile * f1;
+ gdcm::Header* e1;
+ gdcm::File * f1;
//gdcmDocument * d; //not used
void* imageData;
toto = argv[1];
- e1 = new gdcmHeader( toto.c_str() );
+ e1 = new gdcm::Header( toto.c_str() );
if (!e1->IsReadable())
{
std::cerr << "Sorry, not a Readable DICOM / ACR File" <<std::endl;
}
// e1->Print();
- f1 = new gdcmFile(e1);
+ f1 = new gdcm::File(e1);
// ---
dataSize = f1->GetImageDataSize();
std::string header = argv[1];
const char *output = argv[2];
- gdcmHeader *f1 = new gdcmHeader( header );
- gdcmFile *f2 = new gdcmFile( f1 );
+ gdcm::Header *f1 = new gdcm::Header( header );
+ gdcm::File *f2 = new gdcm::File( f1 );
// If the following call is important, then the API sucks. Why is it
// required to allocate PixelData when we are not using it !?
std::string toto;
char zozo[200];
- gdcmHeader* e1;
- gdcmFile * f1;
+ gdcm::Header* e1;
+ gdcm::File * f1;
//gdcmDocument * d; //not used
void* imageData;
toto = argv[1];
- e1 = new gdcmHeader( toto.c_str() );
+ e1 = new gdcm::Header( toto.c_str() );
if (!e1->IsReadable()) {
std::cerr << "Sorry, not a Readable DICOM / ACR File" <<std::endl;
return 0;
}
// e1->Print();
- f1 = new gdcmFile(e1);
+ f1 = new gdcm::File(e1);
// ---
dataSize = f1->GetImageDataSize();
}
const char *first = argv[1];
- gdcmFile *f1 = new gdcmFile( first );
+ gdcm::File *f1 = new gdcm::File( first );
const char *second = argv[2];
- gdcmFile *f2 = new gdcmFile( second );
+ gdcm::File *f2 = new gdcm::File( second );
// We assume that DICOM fields of second file actually exists :
std::string toto;
char zozo[200];
- gdcmHeader* e1, *e2;
- gdcmFile * f1, *f2;
+ gdcm::Header* e1, *e2;
+ gdcm::File * f1, *f2;
void* imageData, *imageData2;
int dataSize, dataSize2;
std::cout << argv[1] << std::endl;
- e1 = new gdcmHeader( toto );
+ e1 = new gdcm::Header( toto );
if (!e1->IsReadable()) {
std::cerr << "Sorry, " << toto <<" not a Readable DICOM / ACR File"
<<std::endl;
return 0;
}
- f1 = new gdcmFile(e1);
+ f1 = new gdcm::File(e1);
imageData= f1->GetImageData();
dataSize = f1->GetImageDataSize();
// --------------------- we read the written image
- e2 = new gdcmHeader( zozo );
+ e2 = new gdcm::Header( zozo );
if (!e2->IsReadable()) {
std::cerr << "Sorry, " << zozo << " not a Readable DICOM / ACR File"
<<std::endl;
return 0;
}
- f2 = new gdcmFile(e2);
+ f2 = new gdcm::File(e2);
imageData2= f2->GetImageData();
dataSize2 = f2->GetImageDataSize();
*/
int main(int argc, char* argv[]) {
- gdcmDicomDir *dcmdir;
+ gdcm::DicomDir *dcmdir;
std::string dirName;
if (argc > 1)
else
dirName = GDCM_DATA_ROOT;
- dcmdir=new gdcmDicomDir(dirName, true); // we ask for Directory parsing
+ dcmdir = new gdcm::DicomDir(dirName, true); // we ask for Directory parsing
dcmdir->SetStartMethod(StartMethod, (void *) NULL);
dcmdir->SetEndMethod(EndMethod);
- ListDicomDirPatient lp = dcmdir->GetDicomDirPatients();
+ gdcm::ListDicomDirPatient lp = dcmdir->GetDicomDirPatients();
if (! lp.size() )
{
std::cout << "makeDicomDir: no patient list present. Exiting."
#include "gdcmHeader.h"
+
#include <map>
#include <list>
#include <fstream>
//Generated file:
#include "gdcmDataImages.h"
-using namespace std;
-
-typedef string EntryValueType; // same type as gdcmValEntry::value
-typedef map< gdcmTagKey, EntryValueType > MapEntryValues;
+typedef std::string EntryValueType; // same type as ValEntry::value
+typedef std::map< TagKey, EntryValueType > MapEntryValues;
typedef MapEntryValues* MapEntryValuesPtr;
-typedef string FileNameType;
-typedef map< FileNameType, MapEntryValuesPtr > MapFileValuesType;
+typedef std::string FileNameType;
+typedef std::map< FileNameType, MapEntryValuesPtr > MapFileValuesType;
struct ParserException
{
- string error;
- static string Indent;
+ std::string error;
+ static std::string Indent;
- static string GetIndent() { return ParserException::Indent; }
- ParserException( string ErrorMessage )
+ static std::string GetIndent() { return ParserException::Indent; }
+ ParserException( std::string ErrorMessage )
{
error = ErrorMessage;
Indent = " ";
}
- void Print() { cerr << Indent << error << endl; }
+ void Print() { std::cerr << Indent << error << std::endl; }
};
-string ParserException::Indent = " ";
+std::string ParserException::Indent = " ";
class ReferenceFileParser
{
- bool AddKeyValuePairToMap( string& key, string& value );
+ bool AddKeyValuePairToMap( std::string& key, std::string& value );
- istream& eatwhite(istream& is);
- void eatwhite(string& toClean);
- string ExtractFirstString(string& toSplit);
- void CleanUpLine( string& line );
+ std::istream& eatwhite(std::istream& is);
+ void eatwhite(std::string& toClean);
+ std::string ExtractFirstString(std::string& toSplit);
+ void CleanUpLine( std::string& line );
- string ExtractValue(string& toSplit) throw ( ParserException );
- void ParseRegularLine( string& line ) throw ( ParserException );
+ std::string ExtractValue(std::string& toSplit) throw ( ParserException );
+ void ParseRegularLine( std::string& line ) throw ( ParserException );
void FirstPassReferenceFile() throw ( ParserException );
bool SecondPassReferenceFile() throw ( ParserException );
- void HandleFileName( string& line ) throw ( ParserException );
- void HandleKey( string& line ) throw ( ParserException );
- bool HandleValue( string& line ) throw ( ParserException );
+ void HandleFileName( std::string& line ) throw ( ParserException );
+ void HandleKey( std::string& line ) throw ( ParserException );
+ bool HandleValue( std::string& line ) throw ( ParserException );
static uint16_t axtoi( char* );
public:
ReferenceFileParser();
- bool Open( string& referenceFileName );
+ bool Open( std::string& referenceFileName );
void Print();
- void SetDataPath(string&);
+ void SetDataPath(std::string&);
bool Check();
private:
/// The directory containing the images to check:
- string DataPath;
+ std::string DataPath;
/// The product of the parser:
MapFileValuesType ProducedMap;
/// The ifstream attached to the file we parse:
- ifstream from;
+ std::ifstream from;
/// String prefixing every output
- string Indent;
+ std::string Indent;
/// The current line position within the stream:
int lineNumber;
/// The currently parsed filename:
- string CurrentFileName;
+ std::string CurrentFileName;
/// The currently parsed key:
- string CurrentKey;
+ std::string CurrentKey;
/// The currently parsed value:
- string CurrentValue;
+ std::string CurrentValue;
/// The current MapEntryValues pointer:
MapEntryValues* CurrentMapEntryValuesPtr;
m--; // adjust the position to set
n++; // next digit to process
}
- return (intValue);
+ return intValue;
}
-void ReferenceFileParser::SetDataPath( string& inDataPath )
+void ReferenceFileParser::SetDataPath( std::string& inDataPath )
{
DataPath = inDataPath;
}
-bool ReferenceFileParser::AddKeyValuePairToMap( string& key, string& value )
+bool ReferenceFileParser::AddKeyValuePairToMap( std::string& key, std::string& value )
{
if ( !CurrentMapEntryValuesPtr )
return false;
i != ProducedMap.end();
++i)
{
- cout << Indent << "FileName: " << i->first << endl;
+ std::cout << Indent << "FileName: " << i->first << std::endl;
MapEntryValuesPtr KeyValues = i->second;
for (MapEntryValues::iterator j = KeyValues->begin();
j != KeyValues->end();
++j)
{
- cout << Indent
+ std::cout << Indent
<< " Key: " << j->first
<< " Value: " << j->second
- << endl;
+ << std::endl;
}
- cout << Indent << endl;
+ std::cout << Indent << std::endl;
}
- cout << Indent << endl;
+ std::cout << Indent << std::endl;
}
bool ReferenceFileParser::Check()
i != ProducedMap.end();
++i)
{
- string fileName = DataPath + i->first;
- cout << Indent << "FileName: " << fileName << endl;
- gdcmHeader* tested = new gdcmHeader( fileName.c_str() );
+ std::string fileName = DataPath + i->first;
+ std::cout << Indent << "FileName: " << fileName << std::endl;
+ gdcm::Header* tested = new gdcm::Header( fileName.c_str() );
if( !tested->IsReadable() )
{
- cerr << Indent << "Image not gdcm compatible:"
- << fileName << endl;
+ std::cerr << Indent << "Image not gdcm compatible:"
+ << fileName << std::endl;
delete tested;
return false;
}
j != KeyValues->end();
++j)
{
- string key = j->first;
+ std::string key = j->first;
- string groupString = key.substr( 0, 4 );
+ std::string groupString = key.substr( 0, 4 );
char* groupCharPtr;
groupCharPtr = new char(groupString.length() + 1);
strcpy( groupCharPtr, groupString.c_str() );
- string groupElement = key.substr( key.find_first_of( "|" ) + 1, 4 );
+ std::string groupElement = key.substr( key.find_first_of( "|" ) + 1, 4 );
char* groupElementPtr;
groupElementPtr = new char(groupElement.length() + 1);
strcpy( groupElementPtr, groupElement.c_str() );
uint16_t group = axtoi( groupCharPtr );
uint16_t element = axtoi( groupElementPtr );
- string testedValue = tested->GetEntryByNumber(group, element);
+ std::string testedValue = tested->GetEntryByNumber(group, element);
if ( testedValue != j->second )
{
- cout << Indent << "Uncorrect value for key " << key << endl
- << Indent << " read value [" << testedValue << "]" << endl
+ std::cout << Indent << "Uncorrect value for key " << key << std::endl
+ << Indent << " read value [" << testedValue << "]" << std::endl
<< Indent << " reference value [" << j->second << "]"
- << endl;
+ << std::endl;
return false;
}
}
delete tested;
- cout << Indent << " OK" << endl;
+ std::cout << Indent << " OK" << std::endl;
}
- cout << Indent << endl;
+ std::cout << Indent << std::endl;
return true;
}
-istream& ReferenceFileParser::eatwhite( istream& is )
+std::istream& ReferenceFileParser::eatwhite( std::istream& is )
{
char c;
while (is.get(c)) {
return is;
}
-void ReferenceFileParser::eatwhite( string& toClean )
+void ReferenceFileParser::eatwhite( std::string& toClean )
{
while( toClean.find_first_of( " " ) == 0 )
toClean.erase( 0, toClean.find_first_of( " " ) + 1 );
}
-string ReferenceFileParser::ExtractFirstString( string& toSplit )
+std::string ReferenceFileParser::ExtractFirstString( std::string& toSplit )
{
std::string firstString;
eatwhite( toSplit );
- if ( toSplit.find( " " ) == string::npos ) {
+ if ( toSplit.find( " " ) == std::string::npos ) {
firstString = toSplit;
toSplit.erase();
return firstString;
return firstString;
}
-string ReferenceFileParser::ExtractValue( string& toSplit )
+std::string ReferenceFileParser::ExtractValue( std::string& toSplit )
throw ( ParserException )
{
eatwhite( toSplit );
- string::size_type beginPos = toSplit.find_first_of( '"' );
- string::size_type endPos = toSplit.find_last_of( '"' );
+ std::string::size_type beginPos = toSplit.find_first_of( '"' );
+ std::string::size_type endPos = toSplit.find_last_of( '"' );
// Make sure we have at most two " in toSplit:
- string noQuotes = toSplit.substr( beginPos + 1, endPos - beginPos - 1);
- if ( noQuotes.find_first_of( '"' ) != string::npos )
+ std::string noQuotes = toSplit.substr( beginPos + 1, endPos - beginPos - 1);
+ if ( noQuotes.find_first_of( '"' ) != std::string::npos )
throw ParserException( "more than two quote character" );
// No leading quote means this is not a value:
- if ( beginPos == string::npos )
+ if ( beginPos == std::string::npos )
{
- return string();
+ return std::string();
}
- if ( ( endPos == string::npos ) || ( beginPos == endPos ) )
+ if ( ( endPos == std::string::npos ) || ( beginPos == endPos ) )
throw ParserException( "unmatched \" (quote character)" );
if ( beginPos != 0 )
{
- ostringstream error;
+ std::ostringstream error;
error << "leading character ["
<< toSplit.substr(beginPos -1, 1)
<< "] before opening \" ";
if ( ( endPos != toSplit.length() - 1 )
&& ( toSplit.substr(endPos + 1, 1) != " " ) )
{
- ostringstream error;
+ std::ostringstream error;
error << "trailing character ["
<< toSplit.substr(endPos + 1, 1)
<< "] after value closing \" ";
throw ParserException( error.str() );
}
- string value = toSplit.substr( beginPos + 1, endPos - beginPos - 1 );
+ std::string value = toSplit.substr( beginPos + 1, endPos - beginPos - 1 );
toSplit.erase( beginPos, endPos - beginPos + 1);
eatwhite( toSplit );
return value;
/// \warning The underlying file pointer is not preseved.
void ReferenceFileParser::FirstPassReferenceFile() throw ( ParserException )
{
- string line;
+ std::string line;
lineNumber = 1;
bool inBlock = false;
- from.seekg( 0, ios::beg );
+ from.seekg( 0, std::ios::beg );
while ( ! from.eof() )
{
}
// Don't try to parse comments (weed out anything after first "#"):
- if ( line.find_first_of( "#" ) != string::npos )
+ if ( line.find_first_of( "#" ) != std::string::npos )
{
line.erase( line.find_first_of( "#" ) );
}
// blocks which is illegal:
if ( line.find_first_of( "[" ) != line.find_last_of( "[" ) )
{
- ostringstream error;
+ std::ostringstream error;
error << "Syntax error: nested block (open) in reference file"
- << endl
+ << std::endl
<< ParserException::GetIndent()
- << " at line " << lineNumber << endl;
+ << " at line " << lineNumber << std::endl;
throw ParserException( error.str() );
}
// blocks which is illegal:
if ( line.find_first_of( "]" ) != line.find_last_of( "]" ) )
{
- ostringstream error;
+ std::ostringstream error;
error << "Syntax error: nested block (close) in reference file"
- << endl
+ << std::endl
<< ParserException::GetIndent()
- << " at line " << lineNumber << endl;
+ << " at line " << lineNumber << std::endl;
throw ParserException( error.str() );
}
- bool beginBlock ( line.find_first_of("[") != string::npos );
- bool endBlock ( line.find_last_of("]") != string::npos );
+ bool beginBlock ( line.find_first_of("[") != std::string::npos );
+ bool endBlock ( line.find_last_of("]") != std::string::npos );
// Opening and closing of block on same line:
if ( beginBlock && endBlock )
{
- ostringstream error;
+ std::ostringstream error;
error << "Syntax error: opening and closing on block on same line "
- << lineNumber++ << endl;
+ << lineNumber++ << std::endl;
throw ParserException( error.str() );
}
// Illegal closing block when block not open:
if ( !inBlock && endBlock )
{
- ostringstream error;
+ std::ostringstream error;
error << "Syntax error: unexpected end of block at line "
- << lineNumber++ << endl;
+ << lineNumber++ << std::endl;
throw ParserException( error.str() );
}
if ( inBlock && beginBlock )
{
- ostringstream error;
+ std::ostringstream error;
error << " Syntax error: illegal opening of nested block at line "
- << lineNumber++ << endl;
+ << lineNumber++ << std::endl;
throw ParserException( error.str() );
}
// We need rewinding:
from.clear();
- from.seekg( 0, ios::beg );
+ from.seekg( 0, std::ios::beg );
}
ReferenceFileParser::ReferenceFileParser()
Indent = " ";
}
-bool ReferenceFileParser::Open( string& referenceFileName )
+bool ReferenceFileParser::Open( std::string& referenceFileName )
{
- from.open( referenceFileName.c_str(), ios::in );
+ from.open( referenceFileName.c_str(), std::ios::in );
if ( !from.is_open() )
{
- cerr << Indent << "Can't open reference file." << endl;
+ std::cerr << Indent << "Can't open reference file." << std::endl;
}
try
return true; //??
}
-void ReferenceFileParser::CleanUpLine( string& line )
+void ReferenceFileParser::CleanUpLine( std::string& line )
{
// Cleanup from comments:
- if ( line.find_first_of( "#" ) != string::npos )
+ if ( line.find_first_of( "#" ) != std::string::npos )
line.erase( line.find_first_of( "#" ) );
// Cleanup everything after end block delimiter:
- if ( line.find_last_of( "]" ) != string::npos )
+ if ( line.find_last_of( "]" ) != std::string::npos )
line.erase( line.find_last_of( "]" ) + 1 );
// Cleanup leading whites and skip empty lines:
eatwhite( line );
}
-void ReferenceFileParser::HandleFileName( string& line )
+void ReferenceFileParser::HandleFileName( std::string& line )
throw ( ParserException )
{
if ( line.length() == 0 )
CurrentFileName = ExtractFirstString(line);
}
-void ReferenceFileParser::HandleKey( string& line )
+void ReferenceFileParser::HandleKey( std::string& line )
throw ( ParserException )
{
if ( CurrentKey.length() != 0 )
return;
CurrentKey = ExtractFirstString(line);
- if ( CurrentKey.find_first_of( "|" ) == string::npos )
+ if ( CurrentKey.find_first_of( "|" ) == std::string::npos )
{
- ostringstream error;
+ std::ostringstream error;
error << "uncorrect key:" << CurrentKey;
throw ParserException( error.str() );
}
}
-bool ReferenceFileParser::HandleValue( string& line )
+bool ReferenceFileParser::HandleValue( std::string& line )
throw ( ParserException )
{
if ( line.length() == 0 )
if ( CurrentKey.length() == 0 )
{
- cout << Indent << "No key present:" << CurrentKey << endl;
+ std::cout << Indent << "No key present:" << CurrentKey << std::endl;
return false;
}
- string newCurrentValue = ExtractValue(line);
+ std::string newCurrentValue = ExtractValue(line);
if ( newCurrentValue.length() == 0 )
{
- cout << Indent << "Warning: empty value for key:"
- << CurrentKey << endl;
+ std::cout << Indent << "Warning: empty value for key:"
+ << CurrentKey << std::endl;
}
CurrentValue += newCurrentValue;
return true;
}
-void ReferenceFileParser::ParseRegularLine(string& line)
+void ReferenceFileParser::ParseRegularLine( std::string& line)
throw ( ParserException )
{
if ( line.length() == 0 )
bool ReferenceFileParser::SecondPassReferenceFile()
throw ( ParserException )
{
- gdcmTagKey key;
+ TagKey key;
EntryValueType value;
- string line;
+ std::string line;
bool inBlock = false;
lineNumber = 0;
if ( line.length() == 0 )
continue;
- bool beginBlock ( line.find_first_of("[") != string::npos );
- bool endBlock ( line.find_last_of("]") != string::npos );
+ bool beginBlock ( line.find_first_of("[") != std::string::npos );
+ bool endBlock ( line.find_last_of("]") != std::string::npos );
// Waiting for a block to be opened. Meanwhile, drop everything:
if ( !inBlock && !beginBlock )
{
if ( argc > 1 )
{
- cerr << " Usage: " << argv[0]
- << " (no arguments needed)." << endl;
+ std::cerr << " Usage: " << argv[0]
+ << " (no arguments needed)." << std::endl;
return 1;
}
- string referenceDir = GDCM_DATA_ROOT;
+ std::string referenceDir = GDCM_DATA_ROOT;
referenceDir += "/";
- string referenceFilename = referenceDir + "TestAllEntryVerifyReference.txt";
+ std::string referenceFilename = referenceDir + "TestAllEntryVerifyReference.txt";
- cout << " Description (Test::TestAllEntryVerify): "
- << endl;
- cout << " For all images (not blacklisted in gdcm/Test/CMakeLists.txt)"
- << endl;
- cout << " encountered in directory: " << GDCM_DATA_ROOT << endl;
- cout << " apply the following tests : "<< endl;
- cout << " step 1: parse the image and call IsReadable(). " << endl;
- cout << " step 2: look for the entry corresponding to the image" << endl;
- cout << " in the reference file: " << referenceFilename << endl;
- cout << " step 3: check that each reference tag value listed for this"
- << endl;
- cout << " entry matches the tag encountered at parsing step 1."
- << endl << endl;
+ std::cout << " Description (Test::TestAllEntryVerify): "
+ << std::endl;
+ std::cout << " For all images (not blacklisted in gdcm/Test/CMakeLists.txt)"
+ << std::endl;
+ std::cout << " encountered in directory: " << GDCM_DATA_ROOT << std::endl;
+ std::cout << " apply the following tests : "<< std::endl;
+ std::cout << " step 1: parse the image and call IsReadable(). " << std::endl;
+ std::cout << " step 2: look for the entry corresponding to the image" << std::endl;
+ std::cout << " in the reference file: " << referenceFilename << std::endl;
+ std::cout << " step 3: check that each reference tag value listed for this"
+ << std::endl;
+ std::cout << " entry matches the tag encountered at parsing step 1."
+ << std::endl << std::endl;
ReferenceFileParser Parser;
if ( !Parser.Open(referenceFilename) )
{
- cout << " Corrupted reference file name: "
- << referenceFilename << endl;
+ std::cout << " Corrupted reference file name: "
+ << referenceFilename << std::endl;
return 1;
}
Parser.SetDataPath(referenceDir);
{
std::cout << " Testing: " << filename << std::endl;
- gdcmFile* tested = new gdcmFile( filename );
+ gdcm::File* tested = new gdcm::File( 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 );
+ gdcm::File* reference = new gdcm::File( referenceFileName );
if( !reference->GetHeader()->IsReadable() )
{
std::cout << " Reference image " << std::endl
int TestBug(int argc, char* argv[])
{
- gdcmHeader* e1;
+ gdcm::Header* e1;
if (argc > 1)
- e1 = new gdcmHeader( argv[1] );
+ e1 = new gdcm::Header( argv[1] );
else {
std::string filename = GDCM_DATA_ROOT;
filename += "/test.acr";
- e1 = new gdcmHeader( filename.c_str() );
+ e1 = new gdcm::Header( filename.c_str() );
}
//e1->PrintPubDict();
//e1->GetPubDict()->GetEntriesByKey();
}
}
- gdcmFile *original = new gdcmFile( filename );
- gdcmFile *copy = new gdcmFile( output );
+ gdcm::File *original = new gdcm::File( filename );
+ gdcm::File *copy = new gdcm::File( output );
- TagDocEntryHT & Ht = original->GetHeader()->GetEntry();
+ gdcm::TagDocEntryHT & Ht = original->GetHeader()->GetEntry();
size_t dataSize = original->GetImageDataSize();
uint8_t* imageData = original->GetImageData();
// (the user does NOT have to know the way we implemented the Header !)
// Waiting for a 'clean' solution, I keep the method ...JPRx
- gdcmDocEntry* d;
+ gdcm::DocEntry* d;
- for (TagDocEntryHT::iterator tag = Ht.begin(); tag != Ht.end(); ++tag)
+ for (gdcm::TagDocEntryHT::iterator tag = Ht.begin(); tag != Ht.end(); ++tag)
{
d = tag->second;
- if ( gdcmBinEntry* b = dynamic_cast<gdcmBinEntry*>(d) )
+ if ( gdcm::BinEntry* b = dynamic_cast<gdcm::BinEntry*>(d) )
{
copy->GetHeader()->ReplaceOrCreateByNumber(
b->GetBinArea(),
b->GetElement(),
b->GetVR() );
}
- else if ( gdcmValEntry* v = dynamic_cast<gdcmValEntry*>(d) )
+ else if ( gdcm::ValEntry* v = dynamic_cast<gdcm::ValEntry*>(d) )
{
copy->GetHeader()->ReplaceOrCreateByNumber(
v->GetValue(),
delete original;
delete copy;
- copy = new gdcmFile( output );
+ copy = new gdcm::File( output );
//Is the file written still gdcm parsable ?
if ( !copy->GetHeader()->IsReadable() )
int TestDicomDir(int argc, char* argv[])
{
- gdcmDicomDir *e1;
+ gdcm::DicomDir *e1;
- ListDicomDirPatient::iterator itPatient;
- ListDicomDirStudy::iterator itStudy;
- ListDicomDirSerie::iterator itSerie;
- ListDicomDirImage::iterator itImage;
- TSKey v;
+ gdcm::ListDicomDirPatient::iterator itPatient;
+ gdcm::ListDicomDirStudy::iterator itStudy;
+ gdcm::ListDicomDirSerie::iterator itSerie;
+ gdcm::ListDicomDirImage::iterator itImage;
+ gdcm::TSKey v;
std::string file;
if (argc > 1)
file += "/DICOMDIR";
}
- e1 = new gdcmDicomDir(file);
+ e1 = new gdcm::DicomDir(file);
if (argc > 2) {
int level = atoi(argv[2]);
e1->SetPrintLevel(level);
//////////////// Step 1 (see above description):
- gdcmHeader *header = new gdcmHeader( filename );
+ gdcm::Header *header = new gdcm::Header( filename );
if( !header->IsReadable() )
{
std::cerr << "Test::TestReadWriteReadCompare: Image not gdcm compatible:"
//////////////// Step 2:
- gdcmFile* file = new gdcmFile( header );
+ gdcm::File* file = new gdcm::File( header );
int dataSize = file->GetImageDataSize();
uint8_t* imageData = file->GetImageData(); //EXTREMELY IMPORTANT
// Sure, it is : It's up to the user to decide if he wants to
//////////////// Step 3:
- gdcmFile* reread = new gdcmFile( "TestReadWriteReadCompare.dcm" );
+ gdcm::File* reread = new gdcm::File( "TestReadWriteReadCompare.dcm" );
if( !reread->GetHeader()->IsReadable() )
{
std::cerr << "Test::TestReadWriteReadCompare: Could not reread image "
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-
-### VTK related
-VTK_INC = -I/usr/include/vtk
-LIBS_VTK=-L/usr/lib/vtk \
- -lvtkCommon -lvtkIO -lvtkFiltering -lvtkRendering -lvtkGraphics \
- -lvtkImaging -lvtkpng -lvtkzlib -lvtkjpeg -lvtkexpat -lvtktiff \
- -lvtkftgl -lvtkfreetype
-LIBS_VTK_PYTHON= $(LIBS_VTK) \
- -lvtkCommonPython -lvtkIOPython -lvtkFilteringPython \
- -lvtkRenderingPython -lvtkGraphicsPython -lvtkImagingPython
-### Gdcm itself:
-GDCM_INC = -I$(top_srcdir)/src -I$(top_builddir)
-### Vtk wrappers of gdcm relate:
-VTKGDCM_DIR = $(top_srcdir)/vtk/
-VTKGDCM_INC = -I$(VTKGDCM_DIR)
-### Swig related (for wrapping Gdcm):
-SWIG_INC = $(PYTHON_INCLUDES) $(GDCM_INC)
-
-### The resulting include path:
-INCLUDES = $(GDCM_INC) $(PYTHON_INCLUDES) $(VTK_INC) $(VTKGDCM_INC)
-
-### Since maude_LDFLAGS cannot be defined conditionaly:
-pygdcm_la_LDFLAGS = -module -avoid-version -L$(top_builddir)/src/.libs
-vtkgdcmPython_la_LDFLAGS = -module -avoid-version
-
-############################################################
-if BUILD_PYTHON
-pythondir = $(prefix)/lib/python${PYTHON_VERSION}/site-packages/gdcm
-if BUILD_VTK
-GDCMVTKLIB = vtkgdcmPython.la
-endif
-python_LTLIBRARIES = pygdcm.la $(GDCMVTKLIB)
-
-############ Gdcm python wrappers:
-pygdcm_la_SOURCES = gdcm_wrap.cxx
-pygdcm_la_LIBADD = $(top_builddir)/src/libgdcm.la -lstdc++
-gdcm_wrap.cxx: $(srcdir)/gdcm.i
- $(SWIG) -python -c++ $(SWIG_INC) -o $@ $<
-
-############ Vtk wrappers of Gdcm wrapped for python
-if BUILD_VTK
-PYTHON_LIB_BASENAME=vtkgdcmPython
-
-# Python wrappers
-PYTHON_WRAPPER = vtkWrapPython
-PYTHON_WRAPPER_INIT=./vtkWrapPythonInit
-PWFLAGS=hints
-
-vtkgdcmPython_la_SOURCES = \
- vtkGdcmReaderPython.cxx \
- vtkGdcmInit.cxx
-vtkgdcmPython_la_LIBADD = $(top_builddir)/vtk/libvtkgdcm.la \
- $(LIBS_VTK_PYTHON)
-
-vtkGdcmReaderPython.cxx: $(VTKGDCM_DIR)/vtkGdcmReader.h
- $(PYTHON_WRAPPER) $< $(PWFLAGS) $@
-
-vtkGdcmInit.cxx : $(VTKGDCM_DIR)/vtkGdcmReader.h $(PYTHON_WRAPPER_INIT)
- $(PYTHON_WRAPPER_INIT) $(PYTHON_LIB_BASENAME) \
- vtkGdcmReader.h \
- > $@
-
-$(PYTHON_WRAPPER_INIT) : vtkWrapPythonInit.c
- gcc -o $@ $<
-endif### BUILD_PYTHON #######################################
-
-############ Automake general usage classics:
-MOSTLYCLEANFILES = $(pygdcm_la_SOURCES) $(vtkgdcmPython_la_SOURCES)
-BUILT_SOURCES = $(pygdcm_la_SOURCES) $(vtkgdcmPython_la_SOURCES)
-CLEANFILES = gdcm_wrap.cxx gdcm.py gdcm.pyc $(PYTHON_WRAPPER_INIT)
-
-dist-hook:
- rm -f $(distdir)/gdcm_wrap.cxx
-
-install-data-local:
- @INSTALL@ -m 0644 gdcm.py $(DESTDIR)$(pythondir)
- @INSTALL@ -m 0644 __init__.py $(DESTDIR)$(pythondir)
- cp -a $(DESTDIR)$(pythondir)/pygdcm.so $(DESTDIR)$(pythondir)/_gdcm.so
-else
-all:
-endif
-
-EXTRA_DIST = gdcm.i __init__.py testSuite.py
////////////////////////////////////////////////////////////////////////////
// Convert a c++ hash table in a python native dictionary
-%typemap(out) TagDocEntryHT & {
+%typemap(out) gdcm::TagDocEntryHT & {
PyObject* NewDict = PyDict_New(); // The result of this typemap
std::string RawName; // Element name as gotten from gdcm
PyObject* NewKey = (PyObject*)0; // Associated name as python object
std::string RawValue; // Element value as gotten from gdcm
PyObject* NewVal = (PyObject*)0; // Associated value as python object
- for (TagDocEntryHT::iterator tag = $1->begin(); tag != $1->end(); ++tag)
+ for (gdcm::TagDocEntryHT::iterator tag = $1->begin(); tag != $1->end(); ++tag)
{
// The element name shall be the key:
RawName = tag->second->GetName();
NewKey = PyString_FromString(RawName.c_str());
// Element values are striped from leading/trailing spaces
- if (gdcmValEntry* ValEntryPtr =
- dynamic_cast< gdcmValEntry* >(tag->second) )
+ if (gdcm::ValEntry* ValEntryPtr =
+ dynamic_cast< gdcm::ValEntry* >(tag->second) )
{
RawValue = ValEntryPtr->GetValue();
}
PyObject* NewItem = (PyObject*)0;
$result = PyList_New(0); // The result of this typemap
- for (std::list<gdcmDicomDirPatient *>::iterator New = ($1)->begin();
+ for (std::list<gdcm::DicomDirPatient *>::iterator New = ($1)->begin();
New != ($1)->end(); ++New) {
- NewItem = SWIG_NewPointerObj(*New,SWIGTYPE_p_gdcmDicomDirPatient,1);
+ NewItem = SWIG_NewPointerObj(*New,SWIGTYPE_p_DicomDirPatient,1);
PyList_Append($result, NewItem);
}
}
PyObject* NewItem = (PyObject*)0;
$result = PyList_New(0); // The result of this typemap
- for (std::list<gdcmDicomDirStudy *>::iterator New = ($1)->begin();
+ for (std::list<gdcm::DicomDirStudy *>::iterator New = ($1)->begin();
New != ($1)->end(); ++New) {
- NewItem = SWIG_NewPointerObj(*New,SWIGTYPE_p_gdcmDicomDirStudy,1);
+ NewItem = SWIG_NewPointerObj(*New,SWIGTYPE_p_DicomDirStudy,1);
PyList_Append($result, NewItem);
}
}
PyObject* NewItem = (PyObject*)0;
$result = PyList_New(0); // The result of this typemap
- for (std::list<gdcmDicomDirSerie *>::iterator New = ($1)->begin();
+ for (std::list<gdcm::DicomDirSerie *>::iterator New = ($1)->begin();
New != ($1)->end(); ++New) {
- NewItem = SWIG_NewPointerObj(*New,SWIGTYPE_p_gdcmDicomDirSerie,1);
+ NewItem = SWIG_NewPointerObj(*New,SWIGTYPE_p_DicomDirSerie,1);
PyList_Append($result, NewItem);
}
}
PyObject* NewItem = (PyObject*)0;
$result = PyList_New(0); // The result of this typemap
- for (std::list<gdcmDicomDirImage *>::iterator New = ($1)->begin();
+ for (std::list<gdcm::DicomDirImage *>::iterator New = ($1)->begin();
New != ($1)->end(); ++New) {
- NewItem = SWIG_NewPointerObj(*New,SWIGTYPE_p_gdcmDicomDirImage,1);
+ NewItem = SWIG_NewPointerObj(*New,SWIGTYPE_p_DicomDirImage,1);
PyList_Append($result, NewItem);
}
}
////////////////////////////////////////////////////////////////////////////
// Deals with function returning a C++ string.
-%typemap(python, in) (gdcmMethod *,void * =NULL,gdcmMethod * =NULL) {
+%typemap(python, in) (gdcm::Method *,void * =NULL,gdcm::Method * =NULL) {
if($input!=Py_None)
{
Py_INCREF($input);
%include "gdcmCommon.h"
%include "gdcmDictEntry.h"
%include "gdcmDict.h"
-%include "gdcmDictSet.h"
+%include "gdcmDocEntry.h"
%include "gdcmDocEntrySet.h"
%include "gdcmElementSet.h"
-%include "gdcmDocument.h"
+%include "gdcmDictSet.h"
+%include "gdcmTS.h"
+%include "gdcmVR.h"
%include "gdcmSQItem.h"
+%include "gdcmDicomDirObject.h"
+%include "gdcmDicomDirStudy.h"
+%include "gdcmDicomDirPatient.h"
+%include "gdcmDicomDirSerie.h"
+%include "gdcmDicomDirElement.h"
+%include "gdcmDicomDirMeta.h"
+%include "gdcmDocument.h"
%include "gdcmHeader.h"
%include "gdcmHeaderHelper.h"
%include "gdcmFile.h"
%include "gdcmUtil.h"
%include "gdcmGlobal.h"
-%include "gdcmDicomDirObject.h"
%include "gdcmDicomDir.h"
%include "gdcmDicomDirElement.h"
-%include "gdcmDicomDirMeta.h"
-%include "gdcmDicomDirPatient.h"
-%include "gdcmDicomDirStudy.h"
-%include "gdcmDicomDirSerie.h"
%include "gdcmDicomDirImage.h"
Program: gdcm
Module: $RCSfile: gdcmBinEntry.cxx,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:05 $
- Version: $Revision: 1.32 $
+ Date: $Date: 2004/10/12 04:35:44 $
+ Version: $Revision: 1.33 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmBinEntry.h"
#include "gdcmDebug.h"
+namespace gdcm
+{
//-----------------------------------------------------------------------------
// Constructor / Destructor
/**
- * \brief Constructor from a given gdcmBinEntry
+ * \brief Constructor from a given BinEntry
*/
-gdcmBinEntry::gdcmBinEntry(gdcmDictEntry* e) : gdcmValEntry(e)
+BinEntry::BinEntry(DictEntry* e) : ValEntry(e)
{
BinArea = 0;
}
/**
- * \brief Constructor from a given gdcmBinEntry
+ * \brief Constructor from a given BinEntry
* @param e Pointer to existing Doc entry
*/
-gdcmBinEntry::gdcmBinEntry(gdcmDocEntry* e) : gdcmValEntry(e->GetDictEntry())
+BinEntry::BinEntry(DocEntry* e) : ValEntry(e->GetDictEntry())
{
UsableLength = e->GetLength();
ReadLength = e->GetReadLength();
/**
* \brief Canonical destructor.
*/
-gdcmBinEntry::~gdcmBinEntry()
+BinEntry::~BinEntry()
{
if (BinArea)
{
* \brief canonical Printer
*/
-void gdcmBinEntry::Print(std::ostream &os)
+void BinEntry::Print(std::ostream &os)
{
- gdcmDocEntry::Print(os);
+ DocEntry::Print(os);
std::ostringstream s;
void* binArea = GetBinArea();
if (binArea)
* @param fp already open file pointer
* @param filetype type of the file to be written
*/
-void gdcmBinEntry::Write(FILE* fp, FileType filetype)
+void BinEntry::Write(FILE* fp, FileType filetype)
{
- gdcmDocEntry::Write(fp, filetype);
+ DocEntry::Write(fp, filetype);
void* binArea = GetBinArea();
int lgr = GetLength();
if (binArea)
/// \brief Sets the value (non string) of the current Dicom Header Entry
-void gdcmBinEntry::SetBinArea( uint8_t* area )
+void BinEntry::SetBinArea( uint8_t* area )
{
if (BinArea)
delete[] BinArea;
// Private
//-----------------------------------------------------------------------------
+} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmBinEntry.h,v $
Language: C++
- Date: $Date: 2004/10/07 21:05:39 $
- Version: $Revision: 1.21 $
+ Date: $Date: 2004/10/12 04:35:44 $
+ Version: $Revision: 1.22 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <iostream>
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
/**
- * \ingroup gdcmBinEntry
+ * \ingroup BinEntry
* \brief The dicom header of a Dicom file contains a set of such entries
* (when successfuly parsed against a given Dicom dictionary)
* This one contains a 'string value'.
*/
-class GDCM_EXPORT gdcmBinEntry : public gdcmValEntry
+class GDCM_EXPORT BinEntry : public ValEntry
{
public:
- gdcmBinEntry(gdcmDictEntry* e);
- gdcmBinEntry(gdcmDocEntry* d);
+ BinEntry(DictEntry* e);
+ BinEntry(DocEntry* d);
- ~gdcmBinEntry();
+ ~BinEntry();
void Print(std::ostream &os = std::cout);
void Write(FILE*, FileType);
uint8_t* BinArea;
};
-
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmCommon.h,v $
Language: C++
- Date: $Date: 2004/10/08 08:41:04 $
- Version: $Revision: 1.35 $
+ Date: $Date: 2004/10/12 04:35:44 $
+ Version: $Revision: 1.36 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
const std::string GDCM_NOTLOADED = "gdcm::NotLoaded";
const std::string GDCM_UNREAD = "gdcm::UnRead";
-/// \brief gdcmTagKey is made to hold an "universal" (as in URL, Universal
-/// Ressource Locator) key to a gdcmDocEntry i.e. a dicom tag.
+/// \brief TagKey is made to hold an "universal" (as in URL, Universal
+/// Ressource Locator) key to a DocEntry i.e. a dicom tag.
/// A dicom tag always has a group and an element, but a set of tags
/// embeded in various (optionally nested) sequences and sharing
/// the same group and element all share the same (group, element)
/// the form:
/// /ItemNumber#Group|Element
/// where "/", "#" and "|" are characters acting as separators.
-/// Then the general form of a gdcmTagKey is given by:
+/// Then the general form of a TagKey is given by:
/// Group|Element[SeqTag]
/// where [SeqTag] means NO or many instances of SeqTag.
-/// Hence the gdcmTagKey of a tag not "leaving" in a sequence is the
+/// Hence the TagKey of a tag not "leaving" in a sequence is the
/// string e.g.
/// 0028|1201
-/// but the gdcmTagKey of a tag "embeded" is the first item of
+/// but the TagKey of a tag "embeded" is the first item of
/// a sequence, itself nested in the third item of a sequence is the
/// string e.g.
/// 0004|1220/2#0008|0082/0#0008|0090
-typedef std::string gdcmTagKey;
+typedef std::string TagKey;
typedef std::string TagName;
enum FileType {
- gdcmUnknown = 0,
- gdcmExplicitVR, // gdcmDicomDir is in this case
- gdcmImplicitVR,
- gdcmACR,
- gdcmACR_LIBIDO
+ Unknown = 0,
+ ExplicitVR, // DicomDir is in this case
+ ImplicitVR,
+ ACR,
+ ACR_LIBIDO
};
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmDebug.cxx,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:05 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2004/10/12 04:35:44 $
+ Version: $Revision: 1.8 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <iostream>
#include "gdcmDebug.h"
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
/**
* \brief constructor
* @param level debug level
*/
-gdcmDebug::gdcmDebug(int level)
+Debug::Debug(int level)
{
DebugLevel = level;
}
* \brief Accessor
* @param level Set the debug level
*/
-void gdcmDebug::SetDebug(int level)
+void Debug::SetDebug(int level)
{
DebugLevel = level;
}
* @param msg1 first message part
* @param msg2 second message part
*/
-void gdcmDebug::Verbose(int level, const char * msg1, const char * msg2)
+void Debug::Verbose(int level, const char * msg1, const char * msg2)
{
if (level > DebugLevel)
{
* @param msg1 first message part
* @param msg2 second message part
*/
-void gdcmDebug::Error(bool test, const char * msg1, const char * msg2)
+void Debug::Error(bool test, const char * msg1, const char * msg2)
{
if (!test)
{
* @param msg2 second message part
* @param msg3 Third message part
*/
-void gdcmDebug::Error(const char* msg1, const char* msg2,
+void Debug::Error(const char* msg1, const char* msg2,
const char* msg3)
{
std::cerr << msg1 << ' ' << msg2 << ' ' << msg3 << std::endl;
* @param msg1 first message part
* @param msg2 second message part
*/
-void gdcmDebug::Assert(int level, bool test, const char * msg1,
+void Debug::Assert(int level, bool test, const char * msg1,
const char * msg2)
{
if (level > DebugLevel)
* \brief Exit
* @param a return code
*/
-void gdcmDebug::Exit(int a)
+void Debug::Exit(int a)
{
#ifdef __GNUC__
std::exit(a);
exit(a); // Found in #include <stdlib.h>
#endif
}
+
+} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmDebug.h,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:05 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2004/10/12 04:35:44 $
+ Version: $Revision: 1.8 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#define GDCMDEBUG_H
#include "gdcmCommon.h"
+namespace gdcm
+{
//-----------------------------------------------------------------------------
/**
- * \ingroup gdcmDebug
- * \brief gdcmDebug is an object for debugging in program.
+ * \ingroup Debug
+ * \brief Debug is an object for debugging in program.
* It has 2 debugging modes :
* - error : for bad library use
* - debug : for debugging messages
* Shown only when the debug level is higher than the
* message level.
*/
-class GDCM_EXPORT gdcmDebug
+class GDCM_EXPORT Debug
{
public:
- gdcmDebug(int level = -1);
+ Debug(int level = -1);
void SetDebug (int level);
void Verbose(int level, const char* msg1, const char* msg2 = "") ;
void Assert(int level, bool test, const char * msg1, const char * msg2);
void Exit(int a);
- static gdcmDebug &GetReference();
+ static Debug &GetReference();
private:
/// warning message level to be displayed
};
+} // end namespace gdcm
/// Instance of debugging utility.
-static gdcmDebug dbg;
+static gdcm::Debug dbg;
#endif
Program: gdcm
Module: $RCSfile: gdcmDicomDir.cxx,v $
Language: C++
- Date: $Date: 2004/10/10 00:42:54 $
- Version: $Revision: 1.72 $
+ Date: $Date: 2004/10/12 04:35:44 $
+ Version: $Revision: 1.73 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#else
#include <unistd.h>
#endif
+namespace gdcm
+{
//-----------------------------------------------------------------------------
// For full DICOMDIR description, see:
// Constructor / Destructor
/**
- * \ingroup gdcmDicomDir
- * \brief Constructor : creates an empty gdcmDicomDir
+ * \ingroup DicomDir
+ * \brief Constructor : creates an empty DicomDir
*/
-gdcmDicomDir::gdcmDicomDir()
- :gdcmDocument( )
+DicomDir::DicomDir()
+ :Document( )
{
Initialize(); // sets all private fields to NULL
std::string pathBidon = "Bidon"; // Sorry, NULL not allowed ...
* - false if user passed an already built DICOMDIR file
* and wants to use it
*/
-gdcmDicomDir::gdcmDicomDir(std::string const & fileName, bool parseDir ):
- gdcmDocument( fileName )
+DicomDir::DicomDir(std::string const & fileName, bool parseDir ):
+ Document( fileName )
{
// Whatever user passed (a root directory or a DICOMDIR)
// and whatever the value of parseDir was,
- // gdcmDocument is already executed
+ // Document is already executed
Initialize(); // sets all private fields to NULL
// if user passed a root directory, sure we didn't get anything
if ( TagHT.begin() == TagHT.end() ) // when user passed a Directory to parse
{
- dbg.Verbose(0, "gdcmDicomDir::gdcmDicomDir : entry HT empty");
+ dbg.Verbose(0, "DicomDir::DicomDir : entry HT empty");
if ( fileName.size() == 1 && fileName[0] == '.' )
{
{
MetaElems = NewMeta();
- dbg.Verbose(0, "gdcmDicomDir::gdcmDicomDir : Parse directory"
+ dbg.Verbose(0, "DicomDir::DicomDir : Parse directory"
" and create the DicomDir");
ParseDirectory();
}
else // Only if user passed a DICOMDIR
{
// Directory record sequence
- gdcmDocEntry *e = GetDocEntryByNumber(0x0004, 0x1220);
+ DocEntry *e = GetDocEntryByNumber(0x0004, 0x1220);
if ( !e )
{
- dbg.Verbose(0, "gdcmDicomDir::gdcmDicomDir : NO Directory record"
+ dbg.Verbose(0, "DicomDir::DicomDir : NO Directory record"
" sequence (0x0004,0x1220)");
/// \todo FIXME : what do we do when the parsed file IS NOT a
/// DICOMDIR file ?
/**
* \brief Canonical destructor
*/
-gdcmDicomDir::~gdcmDicomDir()
+DicomDir::~DicomDir()
{
SetStartMethod(NULL);
SetProgressMethod(NULL);
/**
* \brief Canonical Printer
*/
-void gdcmDicomDir::Print(std::ostream &os)
+void DicomDir::Print(std::ostream &os)
{
if( MetaElems )
{
* decides whether or not the current header was properly parsed
* and contains the mandatory information for being considered as
* a well formed and usable DicomDir.
- * @return true when gdcmDocument is the one of a reasonable DicomDir,
+ * @return true when Document is the one of a reasonable DicomDir,
* false otherwise.
*/
-bool gdcmDicomDir::IsReadable()
+bool DicomDir::IsReadable()
{
- if( !gdcmDocument::IsReadable() )
+ if( !Document::IsReadable() )
{
return false;
}
* \brief Sets all fields to NULL
*/
-void gdcmDicomDir::Initialize()
+void DicomDir::Initialize()
{
StartMethod = NULL;
ProgressMethod = NULL;
/**
- * \ingroup gdcmDicomDir
+ * \ingroup DicomDir
* \brief fills the whole structure, starting from a root Directory
*/
-void gdcmDicomDir::ParseDirectory()
+void DicomDir::ParseDirectory()
{
CreateDicomDirChainedList( GetFileName() );
CreateDicomDir();
}
/**
- * \ingroup gdcmDicomDir
+ * \ingroup DicomDir
* \brief Set the start method to call when the parsing of the directory starts
* @param method Method to call
* @param arg Argument to pass to the method
* @param argDelete Argument
* \warning In python : the arg parameter isn't considered
*/
-void gdcmDicomDir::SetStartMethod(gdcmMethod* method, void* arg,
- gdcmMethod* argDelete )
+void DicomDir::SetStartMethod(Method* method, void* arg,
+ Method* argDelete )
{
if( StartArg && StartMethodArgDelete )
{
}
/**
- * \ingroup gdcmDicomDir
+ * \ingroup DicomDir
* \brief Set the method to delete the argument
* The argument is destroyed when the method is changed or when the
* class is destroyed
* @param method Method to call to delete the argument
*/
-void gdcmDicomDir::SetStartMethodArgDelete(gdcmMethod* method)
+void DicomDir::SetStartMethodArgDelete(Method* method)
{
StartMethodArgDelete = method;
}
/**
- * \ingroup gdcmDicomDir
+ * \ingroup DicomDir
* \brief Set the progress method to call when the parsing of the directory progress
* @param method Method to call
* @param arg Argument to pass to the method
* @param argDelete Argument
* \warning In python : the arg parameter isn't considered
*/
-void gdcmDicomDir::SetProgressMethod(gdcmMethod* method, void* arg,
- gdcmMethod* argDelete )
+void DicomDir::SetProgressMethod(Method* method, void* arg,
+ Method* argDelete )
{
if( ProgressArg && ProgressMethodArgDelete )
{
}
/**
- * \ingroup gdcmDicomDir
+ * \ingroup DicomDir
* \brief Set the method to delete the argument
* The argument is destroyed when the method is changed or when the
* class is destroyed
* @param method Method to call to delete the argument
*/
-void gdcmDicomDir::SetProgressMethodArgDelete(gdcmMethod* method)
+void DicomDir::SetProgressMethodArgDelete(Method* method)
{
ProgressMethodArgDelete = method;
}
/**
- * \ingroup gdcmDicomDir
+ * \ingroup DicomDir
* \brief Set the end method to call when the parsing of the directory ends
* @param method Method to call
* @param arg Argument to pass to the method
* @param argDelete Argument
* \warning In python : the arg parameter isn't considered
*/
-void gdcmDicomDir::SetEndMethod(gdcmMethod* method, void* arg,
- gdcmMethod* argDelete )
+void DicomDir::SetEndMethod(Method* method, void* arg,
+ Method* argDelete )
{
if( EndArg && EndMethodArgDelete )
{
}
/**
- * \ingroup gdcmDicomDir
+ * \ingroup DicomDir
* \brief Set the method to delete the argument
* The argument is destroyed when the method is changed or when the class
* is destroyed
* @param method Method to call to delete the argument
*/
-void gdcmDicomDir::SetEndMethodArgDelete(gdcmMethod* method)
+void DicomDir::SetEndMethodArgDelete(Method* method)
{
EndMethodArgDelete = method;
}
/**
- * \ingroup gdcmDicomDir
+ * \ingroup DicomDir
* \brief writes on disc a DICOMDIR
* \ warning does NOT add the missing elements in the header :
* it's up to the user doing it !
* @return false only when fail to open
*/
-bool gdcmDicomDir::WriteDicomDir(std::string const& fileName)
+bool DicomDir::WriteDicomDir(std::string const& fileName)
{
uint16_t sq[4] = { 0x0004, 0x1220, 0xffff, 0xffff };
uint16_t sqt[4]= { 0xfffe, 0xe0dd, 0xffff, 0xffff };
fwrite(filePreamble,128,1,fp);
fwrite("DICM",4,1,fp);
- gdcmDicomDirMeta *ptrMeta = GetDicomDirMeta();
- ptrMeta->Write(fp, gdcmExplicitVR);
+ DicomDirMeta *ptrMeta = GetDicomDirMeta();
+ ptrMeta->Write(fp, ExplicitVR);
- // force writing 0004|1220 [SQ ], that CANNOT exist within gdcmDicomDirMeta
+ // force writing 0004|1220 [SQ ], that CANNOT exist within DicomDirMeta
fwrite(&sq[0],8,1,fp); // 0004 1220 ffff ffff
for(ListDicomDirPatient::iterator cc = Patients.begin();
cc != Patients.end();
++cc )
{
- (*cc)->Write( fp, gdcmExplicitVR );
+ (*cc)->Write( fp, ExplicitVR );
}
// force writing Sequence Delimitation Item
// Protected
/**
- * \ingroup gdcmDicomDir
- * \brief create a gdcmDocument-like chained list from a root Directory
+ * \ingroup DicomDir
+ * \brief create a Document-like chained list from a root Directory
* @param path entry point of the tree-like structure
*/
-void gdcmDicomDir::CreateDicomDirChainedList(std::string const & path)
+void DicomDir::CreateDicomDirChainedList(std::string const & path)
{
CallStartMethod();
- gdcmDirList fileList(path,1); // gets recursively the file list
+ DirList fileList(path,1); // gets recursively the file list
unsigned int count = 0;
VectDocument list;
- gdcmHeader *header;
+ Header *header;
TagHT.clear();
Patients.clear();
- for( gdcmDirList::iterator it = fileList.begin();
+ for( DirList::iterator it = fileList.begin();
it != fileList.end();
++it )
{
break;
}
- header = new gdcmHeader( it->c_str() );
+ header = new Header( it->c_str() );
if( !header )
{
dbg.Verbose( 1,
- "gdcmDicomDir::CreateDicomDirChainedList: "
+ "DicomDir::CreateDicomDirChainedList: "
"failure in new Header ",
it->c_str() );
}
// Add the file header to the chained list:
list.push_back(header);
dbg.Verbose( 1,
- "gdcmDicomDir::CreateDicomDirChainedList: readable ",
+ "DicomDir::CreateDicomDirChainedList: readable ",
it->c_str() );
}
count++;
}
// sorts Patient/Study/Serie/
- std::sort(list.begin(), list.end(), gdcmDicomDir::HeaderLessThan );
+ std::sort(list.begin(), list.end(), DicomDir::HeaderLessThan );
std::string tmp = fileList.GetDirName();
//for each Header of the chained list, add/update the Patient/Study/Serie/Image info
}
/**
- * \ingroup gdcmDicomDir
+ * \ingroup DicomDir
* \brief adds *the* Meta to a partially created DICOMDIR
*/
-gdcmDicomDirMeta * gdcmDicomDir::NewMeta()
+DicomDirMeta * DicomDir::NewMeta()
{
- gdcmDicomDirMeta *m = new gdcmDicomDirMeta( &TagHT );
+ DicomDirMeta *m = new DicomDirMeta( &TagHT );
if ( TagHT.begin() != TagHT.end() ) // after Document Parsing
{
}
else // after root directory parsing
{
- std::list<gdcmElement> elemList;
- elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirMetaElements();
+ std::list<Element> elemList;
+ elemList=Global::GetDicomDirElements()->GetDicomDirMetaElements();
m->FillObject(elemList);
}
m->SetSQItemNumber(0); // To avoid further missprinting
/**
* \brief adds a new Patient (with the basic elements) to a partially created DICOMDIR
*/
-gdcmDicomDirPatient * gdcmDicomDir::NewPatient()
+DicomDirPatient * DicomDir::NewPatient()
{
- std::list<gdcmElement>::iterator it;
+ std::list<Element>::iterator it;
uint16_t tmpGr,tmpEl;
- gdcmDictEntry *dictEntry;
- gdcmValEntry *entry;
+ DictEntry *dictEntry;
+ ValEntry *entry;
- std::list<gdcmElement> elemList;
- elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirPatientElements();
- gdcmSQItem *s = new gdcmSQItem(0);
+ std::list<Element> elemList;
+ elemList=Global::GetDicomDirElements()->GetDicomDirPatientElements();
+ SQItem *s = new SQItem(0);
// for all the DicomDirPatient Elements
for( it = elemList.begin(); it != elemList.end(); ++it )
tmpGr = it->Group;
tmpEl = it->Elem;
dictEntry = GetPubDict()->GetDictEntryByNumber(tmpGr, tmpEl);
- entry = new gdcmValEntry( dictEntry );
+ entry = new ValEntry( dictEntry );
entry->SetOffset(0); // just to avoid further missprinting
entry->SetValue( it->Value );
s->AddDocEntry( entry );
}
- gdcmDicomDirPatient *p = new gdcmDicomDirPatient(s, &TagHT);
+ DicomDirPatient *p = new DicomDirPatient(s, &TagHT);
Patients.push_front( p );
return p;
/**
* \brief adds to the HTable
- * the gdcmEntries (Dicom Elements) corresponding to the given type
+ * the Entries (Dicom Elements) corresponding to the given type
* @param path full path file name (only used when type = GDCM_DICOMDIR_IMAGE
- * @param type gdcmDicomDirObject type to create (GDCM_DICOMDIR_PATIENT,
+ * @param type DicomDirObject type to create (GDCM_DICOMDIR_PATIENT,
* GDCM_DICOMDIR_STUDY, GDCM_DICOMDIR_SERIE ...)
- * @param header gdcmHeader of the current file
+ * @param header Header of the current file
*/
-void gdcmDicomDir::SetElement(std::string &path,gdcmDicomDirType type,
- gdcmDocument *header)
+void DicomDir::SetElement(std::string &path,DicomDirType type,
+ Document *header)
{
- std::list<gdcmElement> elemList;
- std::list<gdcmElement>::iterator it;
+ std::list<Element> elemList;
+ std::list<Element>::iterator it;
uint16_t tmpGr, tmpEl;
- gdcmDictEntry *dictEntry;
- gdcmValEntry *entry;
+ DictEntry *dictEntry;
+ ValEntry *entry;
std::string val;
- gdcmSQItem *si = new gdcmSQItem(0); // all the items will be at level 1
+ SQItem *si = new SQItem(0); // all the items will be at level 1
switch( type )
{
case GDCM_DICOMDIR_IMAGE:
- elemList = gdcmGlobal::GetDicomDirElements()->GetDicomDirImageElements();
+ elemList = Global::GetDicomDirElements()->GetDicomDirImageElements();
break;
case GDCM_DICOMDIR_SERIE:
- elemList = gdcmGlobal::GetDicomDirElements()->GetDicomDirSerieElements();
+ elemList = Global::GetDicomDirElements()->GetDicomDirSerieElements();
break;
case GDCM_DICOMDIR_STUDY:
- elemList = gdcmGlobal::GetDicomDirElements()->GetDicomDirStudyElements();
+ elemList = Global::GetDicomDirElements()->GetDicomDirStudyElements();
break;
case GDCM_DICOMDIR_PATIENT:
- elemList = gdcmGlobal::GetDicomDirElements()->GetDicomDirPatientElements();
+ elemList = Global::GetDicomDirElements()->GetDicomDirPatientElements();
break;
case GDCM_DICOMDIR_META:
- elemList = gdcmGlobal::GetDicomDirElements()->GetDicomDirMetaElements();
+ elemList = Global::GetDicomDirElements()->GetDicomDirMetaElements();
break;
default:
tmpEl = it->Elem;
dictEntry = GetPubDict()->GetDictEntryByNumber(tmpGr, tmpEl);
- entry = new gdcmValEntry( dictEntry ); // Be sure it's never a BinEntry !
+ entry = new ValEntry( dictEntry ); // Be sure it's never a BinEntry !
entry->SetOffset(0); // just to avoid further missprinting
entry->SetLength(0); // just to avoid further missprinting
if( tmpGr == 0x0004 && tmpEl == 0x1130 ) // File-set ID
{
// force to the *end* File Name
- val = gdcmUtil::GetName( path );
+ val = Util::GetName( path );
}
else if( tmpGr == 0x0004 && tmpEl == 0x1500 ) // Only used for image
{
if( header->GetFileName().substr(0, path.length()) != path )
{
- dbg.Verbose(0, "gdcmDicomDir::SetElement : the base path"
+ dbg.Verbose(0, "DicomDir::SetElement : the base path"
" of file name is incorrect");
val = header->GetFileName();
}
/**
* \brief CallStartMethod
*/
-void gdcmDicomDir::CallStartMethod()
+void DicomDir::CallStartMethod()
{
Progress = 0.0f;
Abort = false;
}
/**
- * \ingroup gdcmDicomDir
+ * \ingroup DicomDir
* \brief CallProgressMethod
*/
-void gdcmDicomDir::CallProgressMethod()
+void DicomDir::CallProgressMethod()
{
if( ProgressMethod )
{
}
/**
- * \ingroup gdcmDicomDir
+ * \ingroup DicomDir
* \brief CallEndMethod
*/
-void gdcmDicomDir::CallEndMethod()
+void DicomDir::CallEndMethod()
{
Progress = 1.0f;
if( EndMethod )
//-----------------------------------------------------------------------------
// Private
/**
- * \ingroup gdcmDicomDir
- * \brief create a 'gdcmDicomDir' from a DICOMDIR gdcmHeader
+ * \ingroup DicomDir
+ * \brief create a 'DicomDir' from a DICOMDIR Header
*/
-void gdcmDicomDir::CreateDicomDir()
+void DicomDir::CreateDicomDir()
{
// The list is parsed.
// When a DicomDir tag ("PATIENT", "STUDY", "SERIE", "IMAGE") is found :
// + loop to 1 -
// Directory record sequence
- gdcmDocEntry *e = GetDocEntryByNumber(0x0004, 0x1220);
+ DocEntry *e = GetDocEntryByNumber(0x0004, 0x1220);
if ( !e )
{
- dbg.Verbose(0, "gdcmDicomDir::gdcmDicomDir : NO Directory record"
+ dbg.Verbose(0, "DicomDir::DicomDir : NO Directory record"
" sequence (0x0004,0x1220)");
/// \todo FIXME: what to do when the parsed file IS NOT a DICOMDIR file ?
return;
}
- gdcmSeqEntry* s = dynamic_cast<gdcmSeqEntry*>(e);
+ SeqEntry* s = dynamic_cast<SeqEntry*>(e);
if ( !s )
{
- dbg.Verbose(0, "gdcmDicomDir::CreateDicomDir: no SeqEntry present");
+ dbg.Verbose(0, "DicomDir::CreateDicomDir: no SeqEntry present");
// useless : (0x0004,0x1220) IS a Sequence !
return;
}
- gdcmDicomDirType type = gdcmDicomDir::GDCM_DICOMDIR_META;
+ DicomDirType type = DicomDir::GDCM_DICOMDIR_META;
MetaElems = NewMeta();
ListSQItem listItems = s->GetSQItems();
- gdcmDocEntry * d;
+ DocEntry * d;
std::string v;
for( ListSQItem::iterator i = listItems.begin();
i !=listItems.end(); ++i )
{
d = (*i)->GetDocEntryByNumber(0x0004, 0x1430); // Directory Record Type
- if ( gdcmValEntry* ValEntry = dynamic_cast< gdcmValEntry* >(d) )
+ if ( ValEntry* valEntry = dynamic_cast< ValEntry* >(d) )
{
- v = ValEntry->GetValue();
+ v = valEntry->GetValue();
}
else
{
- dbg.Verbose(0, "gdcmDicomDir::CreateDicomDir: not a ValEntry.");
+ dbg.Verbose(0, "DicomDir::CreateDicomDir: not a ValEntry.");
continue;
}
if( v == "PATIENT " )
{
AddDicomDirPatientToEnd( *i );
- type = gdcmDicomDir::GDCM_DICOMDIR_PATIENT;
+ type = DicomDir::GDCM_DICOMDIR_PATIENT;
}
else if( v == "STUDY " )
{
AddDicomDirStudyToEnd( *i );
- type = gdcmDicomDir::GDCM_DICOMDIR_STUDY;
+ type = DicomDir::GDCM_DICOMDIR_STUDY;
}
else if( v == "SERIES" )
{
AddDicomDirSerieToEnd( *i );
- type = gdcmDicomDir::GDCM_DICOMDIR_SERIE;
+ type = DicomDir::GDCM_DICOMDIR_SERIE;
}
else if( v == "IMAGE " )
{
AddDicomDirImageToEnd( *i );
- type = gdcmDicomDir::GDCM_DICOMDIR_IMAGE;
+ type = DicomDir::GDCM_DICOMDIR_IMAGE;
}
else
{
}
/**
- * \ingroup gdcmDicomDir
+ * \ingroup DicomDir
* \brief Well ... there is only one occurence
*/
-void gdcmDicomDir::AddDicomDirMeta()
+void DicomDir::AddDicomDirMeta()
{
if( MetaElems )
{
delete MetaElems;
}
- MetaElems = new gdcmDicomDirMeta( &TagHT );
+ MetaElems = new DicomDirMeta( &TagHT );
}
/**
- * \ingroup gdcmDicomDir
+ * \ingroup DicomDir
* \brief AddDicomDirPatientToEnd
* @param s SQ Item to enqueue to the DicomPatient chained List
*/
-void gdcmDicomDir::AddDicomDirPatientToEnd(gdcmSQItem *s)
+void DicomDir::AddDicomDirPatientToEnd(SQItem *s)
{
- Patients.push_back(new gdcmDicomDirPatient(s, &TagHT));
+ Patients.push_back(new DicomDirPatient(s, &TagHT));
}
/**
- * \ingroup gdcmDicomDir
+ * \ingroup DicomDir
* \brief AddDicomDirStudyToEnd
* @param s SQ Item to enqueue to the DicomDirStudy chained List
*/
- void gdcmDicomDir::AddDicomDirStudyToEnd(gdcmSQItem *s)
+ void DicomDir::AddDicomDirStudyToEnd(SQItem *s)
{
if( Patients.size() > 0 )
{
ListDicomDirPatient::iterator itp = Patients.end();
itp--;
- (*itp)->AddDicomDirStudy(new gdcmDicomDirStudy(s, &TagHT));
+ (*itp)->AddDicomDirStudy(new DicomDirStudy(s, &TagHT));
}
}
/**
- * \ingroup gdcmDicomDir
+ * \ingroup DicomDir
* \brief AddDicomDirSerieToEnd
* @param s SQ Item to enqueue to the DicomDirSerie chained List
*/
-void gdcmDicomDir::AddDicomDirSerieToEnd(gdcmSQItem *s)
+void DicomDir::AddDicomDirSerieToEnd(SQItem *s)
{
if( Patients.size() > 0 )
{
{
ListDicomDirStudy::iterator itst=(*itp)->GetDicomDirStudies().end();
itst--;
- (*itst)->AddDicomDirSerie(new gdcmDicomDirSerie(s, &TagHT));
+ (*itst)->AddDicomDirSerie(new DicomDirSerie(s, &TagHT));
}
}
}
/**
- * \ingroup gdcmDicomDir
+ * \ingroup DicomDir
* \brief AddDicomDirImageToEnd
* @param s SQ Item to enqueue to the DicomDirImage chained List
*/
- void gdcmDicomDir::AddDicomDirImageToEnd(gdcmSQItem *s)
+ void DicomDir::AddDicomDirImageToEnd(SQItem *s)
{
if( Patients.size() > 0 )
{
{
ListDicomDirSerie::iterator its = (*itst)->GetDicomDirSeries().end();
its--;
- (*its)->AddDicomDirImage(new gdcmDicomDirImage(s, &TagHT));
+ (*its)->AddDicomDirImage(new DicomDirImage(s, &TagHT));
}
}
}
}
/**
- * \ingroup gdcmDicomDir
+ * \ingroup DicomDir
* \brief for each Header of the chained list, add/update the Patient/Study/Serie/Image info
* @param path path of the root directory
* @param list chained list of Headers
*/
-void gdcmDicomDir::SetElements(std::string &path, VectDocument &list)
+void DicomDir::SetElements(std::string &path, VectDocument &list)
{
std::string patPrevName = "", patPrevID = "";
std::string studPrevInstanceUID = "", studPrevID = "";
}
/**
- * \ingroup gdcmDicomDir
+ * \ingroup DicomDir
* \brief compares two dgcmHeaders
*/
-bool gdcmDicomDir::HeaderLessThan(gdcmDocument *header1, gdcmDocument *header2)
+bool DicomDir::HeaderLessThan(Document *header1, Document *header2)
{
return *header1 < *header2;
}
+} // end namespace gdcm
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmDicomDir.h,v $
Language: C++
- Date: $Date: 2004/10/09 03:21:55 $
- Version: $Revision: 1.33 $
+ Date: $Date: 2004/10/12 04:35:44 $
+ 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
#include <list>
#include <vector>
+namespace gdcm
+{
//-----------------------------------------------------------------------------
-typedef std::list<gdcmDicomDirPatient*> ListDicomDirPatient;
-typedef std::vector<gdcmDocument*> VectDocument;
+typedef std::list<DicomDirPatient*> ListDicomDirPatient;
+typedef std::vector<Document*> VectDocument;
-typedef GDCM_EXPORT void(gdcmMethod)(void* = NULL);
+typedef GDCM_EXPORT void(Method)(void* = NULL);
//-----------------------------------------------------------------------------
/**
- * \ingroup gdcmDicomDir
- * \brief gdcmDicomDir defines an object representing a DICOMDIR in memory.
+ * \ingroup DicomDir
+ * \brief DicomDir defines an object representing a DICOMDIR in memory.
*
*/
-class GDCM_EXPORT gdcmDicomDir: public gdcmDocument
+class GDCM_EXPORT DicomDir: public Document
{
public:
- gdcmDicomDir( std::string const & fileName, bool parseDir = false );
- gdcmDicomDir();
+ DicomDir( std::string const & fileName, bool parseDir = false );
+ DicomDir();
- ~gdcmDicomDir();
+ ~DicomDir();
/// \brief canonical Printer
/// \sa SetPrintLevel
/// Informations contained in the parser
virtual bool IsReadable();
- /// Returns a pointer to the gdcmDicomDirMeta for this DICOMDIR.
- gdcmDicomDirMeta* GetDicomDirMeta() { return MetaElems; };
+ /// Returns a pointer to the DicomDirMeta for this DICOMDIR.
+ DicomDirMeta* GetDicomDirMeta() { return MetaElems; };
/// Returns the PATIENT chained List for this DICOMDIR.
ListDicomDirPatient &GetDicomDirPatients() { return Patients; };
/// Parsing
void ParseDirectory();
- void SetStartMethod(gdcmMethod*, void* = NULL, gdcmMethod* = NULL);
- void SetStartMethodArgDelete(gdcmMethod*);
- void SetProgressMethod(gdcmMethod* ,void* = NULL, gdcmMethod* = NULL);
- void SetProgressMethodArgDelete(gdcmMethod*);
- void SetEndMethod(gdcmMethod*, void* = NULL,gdcmMethod* = NULL);
- void SetEndMethodArgDelete(gdcmMethod*);
+ void SetStartMethod(Method*, void* = NULL, Method* = NULL);
+ void SetStartMethodArgDelete(Method*);
+ void SetProgressMethod(Method* ,void* = NULL, Method* = NULL);
+ void SetProgressMethodArgDelete(Method*);
+ void SetEndMethod(Method*, void* = NULL,Method* = NULL);
+ void SetEndMethodArgDelete(Method*);
/// GetProgress GetProgress
float GetProgress() { return Progress; };
bool IsAborted() { return Abort; };
/// Adding
- gdcmDicomDirMeta* NewMeta();
- gdcmDicomDirPatient* NewPatient();
+ DicomDirMeta* NewMeta();
+ DicomDirPatient* NewPatient();
/// Write
bool WriteDicomDir(std::string const & fileName);
- /// Types of the gdcmDicomDirObject within the gdcmDicomDir
+ /// Types of the DicomDirObject within the DicomDir
typedef enum
{
GDCM_DICOMDIR_NONE,
GDCM_DICOMDIR_STUDY,
GDCM_DICOMDIR_SERIE,
GDCM_DICOMDIR_IMAGE
- } gdcmDicomDirType;
+ } DicomDirType;
protected:
void CreateDicomDirChainedList(std::string const & path);
void Initialize();
void CreateDicomDir();
void AddDicomDirMeta();
- void AddDicomDirPatientToEnd(gdcmSQItem* s);
- void AddDicomDirStudyToEnd (gdcmSQItem* s);
- void AddDicomDirSerieToEnd (gdcmSQItem* s);
- void AddDicomDirImageToEnd (gdcmSQItem* s);
+ void AddDicomDirPatientToEnd(SQItem* s);
+ void AddDicomDirStudyToEnd (SQItem* s);
+ void AddDicomDirSerieToEnd (SQItem* s);
+ void AddDicomDirImageToEnd (SQItem* s);
void SetElements(std::string &path, VectDocument &list);
- void SetElement (std::string &path,gdcmDicomDirType type,
- gdcmDocument* header);
+ void SetElement (std::string &path,DicomDirType type,
+ Document* header);
- static bool HeaderLessThan(gdcmDocument* header1,gdcmDocument* header2);
+ static bool HeaderLessThan(Document* header1,Document* header2);
// Variables
- /// Pointer on *the* gdcmDicomDirObject 'DicomDirMeta Elements'
- gdcmDicomDirMeta* MetaElems;
+ /// Pointer on *the* DicomDirObject 'DicomDirMeta Elements'
+ DicomDirMeta* MetaElems;
/// Chained list of DicomDirPatient (to be exploited recursively)
ListDicomDirPatient Patients;
/// pointer to the initialisation method for any progress bar
- gdcmMethod* StartMethod;
+ Method* StartMethod;
/// pointer to the incrementation method for any progress bar
- gdcmMethod* ProgressMethod;
+ Method* ProgressMethod;
/// pointer to the termination method for any progress bar
- gdcmMethod* EndMethod;
+ Method* EndMethod;
/// pointer to the ??? method for any progress bar
- gdcmMethod* StartMethodArgDelete;
+ Method* StartMethodArgDelete;
/// pointer to the ??? method for any progress bar
- gdcmMethod* ProgressMethodArgDelete;
+ Method* ProgressMethodArgDelete;
/// pointer to the ??? method for any progress bar
- gdcmMethod* EndMethodArgDelete;
+ Method* EndMethodArgDelete;
/// pointer to the ??? for any progress bar
void* StartArg;
/// pointer to the ??? for any progress bar
/// value of the ??? for any progress bar
bool Abort;
};
-
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmDicomDirElement.cxx,v $
Language: C++
- Date: $Date: 2004/10/10 00:42:54 $
- Version: $Revision: 1.19 $
+ Date: $Date: 2004/10/12 04:35:44 $
+ Version: $Revision: 1.20 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <fstream>
#include <iostream>
+namespace gdcm
+{
//-----------------------------------------------------------------------------
// Constructor / Destructor
* \brief constructor : populates the chained lists
* from the file 'Dicts/DicomDir.dic'
*/
-gdcmDicomDirElement::gdcmDicomDirElement()
+DicomDirElement::DicomDirElement()
{
- std::string filename = gdcmDictSet::BuildDictPath() + std::string(DICT_ELEM);
+ std::string filename = DictSet::BuildDictPath() + std::string(DICT_ELEM);
std::ifstream from(filename.c_str());
- dbg.Error(!from, "gdcmDicomDirElement::gdcmDicomDirElement: can't open dictionary",
+ dbg.Error(!from, "DicomDirElement::DicomDirElement: can't open dictionary",
filename.c_str());
char buff[1024];
std::string type;
- gdcmElement elem;
+ Element elem;
while (!from.eof())
{
}
/**
- * \ingroup gdcmDicomDirElement
+ * \ingroup DicomDirElement
* \brief canonical destructor
*/
-gdcmDicomDirElement::~gdcmDicomDirElement()
+DicomDirElement::~DicomDirElement()
{
DicomDirMetaList.clear();
DicomDirPatientList.clear();
//-----------------------------------------------------------------------------
// Print
/**
- * \ingroup gdcmDicomDirElement
+ * \ingroup DicomDirElement
* \brief Print all
* \todo add a 'Print Level' check
* @param os The output stream to be written to.
*/
-void gdcmDicomDirElement::Print(std::ostream &os)
+void DicomDirElement::Print(std::ostream &os)
{
std::ostringstream s;
- std::list<gdcmElement>::iterator it;
+ std::list<Element>::iterator it;
//char greltag[10]; //group element tag
std::string greltag;
s << "Meta Elements :"<<std::endl;
for (it = DicomDirMetaList.begin(); it != DicomDirMetaList.end(); ++it)
{
- greltag = gdcmUtil::Format("%04x|%04x ",it->Group,it->Elem);
+ greltag = Util::Format("%04x|%04x ",it->Group,it->Elem);
s << " (" << greltag << ") = " << it->Value << std::endl;
}
s << "Patient Elements :"<<std::endl;
for (it = DicomDirPatientList.begin(); it != DicomDirPatientList.end(); ++it)
{
- greltag = gdcmUtil::Format("%04x|%04x ",it->Group,it->Elem);
+ greltag = Util::Format("%04x|%04x ",it->Group,it->Elem);
s << " (" << greltag << ") = " << it->Value << std::endl;
}
s << "Study Elements :"<<std::endl;
for (it = DicomDirStudyList.begin(); it != DicomDirStudyList.end(); ++it)
{
- greltag = gdcmUtil::Format("%04x|%04x ", it->Group, it->Elem);
+ greltag = Util::Format("%04x|%04x ", it->Group, it->Elem);
s << " (" << greltag << ") = " << it->Value << std::endl;
}
s << "Serie Elements :"<<std::endl;
for (it = DicomDirSerieList.begin(); it != DicomDirSerieList.end(); ++it)
{
- greltag = gdcmUtil::Format("%04x|%04x ", it->Group, it->Elem);
+ greltag = Util::Format("%04x|%04x ", it->Group, it->Elem);
s << " (" << greltag << ") = " << it->Value << std::endl;
}
s << "Image Elements :"<<std::endl;
for (it = DicomDirImageList.begin(); it != DicomDirImageList.end(); ++it)
{
- greltag = gdcmUtil::Format("%04x|%04x ", it->Group, it->Elem);
+ greltag = Util::Format("%04x|%04x ", it->Group, it->Elem);
s << " (" << greltag << ") = " << it->Value << std::endl;
}
// Private
//-----------------------------------------------------------------------------
+
+} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmDicomDirElement.h,v $
Language: C++
- Date: $Date: 2004/10/09 03:21:55 $
- Version: $Revision: 1.11 $
+ Date: $Date: 2004/10/12 04:35:44 $
+ Version: $Revision: 1.12 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <list>
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
typedef struct
{
unsigned short int Elem;
/// value (coded as a std::string) of the Element
std::string Value;
-} gdcmElement;
+} Element;
-typedef std::list<gdcmElement> ListDicomDirMetaElem;
-typedef std::list<gdcmElement> ListDicomDirPatientElem;
-typedef std::list<gdcmElement> ListDicomDirStudyElem;
-typedef std::list<gdcmElement> ListDicomDirSerieElem;
-typedef std::list<gdcmElement> ListDicomDirImageElem;
+typedef std::list<Element> ListDicomDirMetaElem;
+typedef std::list<Element> ListDicomDirPatientElem;
+typedef std::list<Element> ListDicomDirStudyElem;
+typedef std::list<Element> ListDicomDirSerieElem;
+typedef std::list<Element> ListDicomDirImageElem;
//-----------------------------------------------------------------------------
/**
- * \ingroup gdcmDicomDirElement
- * \brief gdcmDicomDirElement represents elements contained in a dicom dir
+ * \ingroup DicomDirElement
+ * \brief DicomDirElement represents elements contained in a dicom dir
* Class for the chained lists from the file 'Dicts/DicomDir.dic'
*/
-class GDCM_EXPORT gdcmDicomDirElement
+class GDCM_EXPORT DicomDirElement
{
public:
- gdcmDicomDirElement();
- ~gdcmDicomDirElement();
+ DicomDirElement();
+ ~DicomDirElement();
/**
* \brief canonical Printer
void Print(std::ostream &os);
/**
- * \ingroup gdcmDicomDirElement
+ * \ingroup DicomDirElement
* \brief returns a reference to the chained List
* related to the META Elements of a DICOMDIR.
*/
{ return DicomDirMetaList; };
/**
- * \ingroup gdcmDicomDirElement
+ * \ingroup DicomDirElement
* \brief returns a reference to the chained List
* related to the PATIENT Elements of a DICOMDIR.
*/
{ return DicomDirPatientList; };
/**
- * \ingroup gdcmDicomDirElement
+ * \ingroup DicomDirElement
* \brief returns a reference to the chained List
* related to the STUDY Elements of a DICOMDIR.
*/
{ return DicomDirStudyList; };
/**
- * \ingroup gdcmDicomDirElement
+ * \ingroup DicomDirElement
* \brief returns a reference to the chained List
* related to the SERIE Elements of a DICOMDIR.
*/
{ return DicomDirSerieList; };
/**
- * \ingroup gdcmDicomDirElement
+ * \ingroup DicomDirElement
* \brief returns a reference to the chained List
* related to the IMAGE Elements of a DICOMDIR.
*/
{ return DicomDirImageList; };
private:
- /// gdcmElements chained list, related to the MetaElements of DICOMDIR
+ /// Elements chained list, related to the MetaElements of DICOMDIR
ListDicomDirMetaElem DicomDirMetaList;
- /// gdcmElements chained list, related to the PatientElements of DICOMDIR
+ /// Elements chained list, related to the PatientElements of DICOMDIR
ListDicomDirPatientElem DicomDirPatientList;
- /// gdcmElements chained list, related to the StudyElements of DICOMDIR
+ /// Elements chained list, related to the StudyElements of DICOMDIR
ListDicomDirStudyElem DicomDirStudyList;
- /// gdcmElements chained list, related to the SerieElements of DICOMDIR
+ /// Elements chained list, related to the SerieElements of DICOMDIR
ListDicomDirSerieElem DicomDirSerieList;
- /// gdcmElements chained list, related to the ImageElements of DICOMDIR
+ /// Elements chained list, related to the ImageElements of DICOMDIR
ListDicomDirImageElem DicomDirImageList;
};
-
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmDicomDirImage.cxx,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:06 $
- Version: $Revision: 1.11 $
+ Date: $Date: 2004/10/12 04:35:44 $
+ Version: $Revision: 1.12 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDicomDirImage.h"
#include "gdcmValEntry.h"
+
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
// Constructor / Destructor
/**
- * \ingroup gdcmDicomDirImage
+ * \ingroup DicomDirImage
* \brief Constructor
* @param s SQ Item holding the elements
- * @param ptagHT pointer to the HTable (gdcmDicomDirObject needs it
- * to build the gdcmDocEntries)
+ * @param ptagHT pointer to the HTable (DicomDirObject needs it
+ * to build the DocEntries)
*/
-gdcmDicomDirImage::gdcmDicomDirImage(gdcmSQItem *s, TagDocEntryHT *ptagHT):
- gdcmDicomDirObject(ptagHT)
+DicomDirImage::DicomDirImage(SQItem *s, TagDocEntryHT *ptagHT):
+ DicomDirObject(ptagHT)
{
docEntries = s->GetDocEntries();
}
/**
- * \ingroup gdcmDicomDirImage
+ * \ingroup DicomDirImage
* \brief Constructor
- * @param ptagHT pointer to the HTable (gdcmDicomDirObject needs it
- * to build the gdcmDocEntries)
+ * @param ptagHT pointer to the HTable (DicomDirObject needs it
+ * to build the DocEntries)
*/
-gdcmDicomDirImage::gdcmDicomDirImage(TagDocEntryHT *ptagHT):
- gdcmDicomDirObject(ptagHT)
+DicomDirImage::DicomDirImage(TagDocEntryHT *ptagHT):
+ DicomDirObject(ptagHT)
{
}
/**
- * \ingroup gdcmDicomDirImage
+ * \ingroup DicomDirImage
* \brief Canonical destructor.
*/
-gdcmDicomDirImage::~gdcmDicomDirImage()
+DicomDirImage::~DicomDirImage()
{
}
//-----------------------------------------------------------------------------
// Print
/**
- * \ingroup gdcmDicomDirImage
+ * \ingroup DicomDirImage
* \brief Prints the Object
* @return
*/
-void gdcmDicomDirImage::Print(std::ostream &os)
+void DicomDirImage::Print(std::ostream &os)
{
os << "IMAGE : ";
for(ListDocEntry::iterator i=docEntries.begin();i!=docEntries.end();++i)
{
if( (*i)->GetGroup() == 0x0004 && (*i)->GetElement() == 0x1500 )
{
- os << ((gdcmValEntry *)(*i))->GetValue(); //FIXME
+ os << ((ValEntry *)(*i))->GetValue(); //FIXME
}
}
os << std::endl;
- gdcmDicomDirObject::Print(os);
+ DicomDirObject::Print(os);
}
//-----------------------------------------------------------------------------
// Private
//-----------------------------------------------------------------------------
+} // end namespace gdcm
+
Program: gdcm
Module: $RCSfile: gdcmDicomDirImage.h,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:06 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2004/10/12 04:35:44 $
+ Version: $Revision: 1.10 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#define GDCMDICOMIMAGE_H
#include "gdcmDicomDirObject.h"
+namespace gdcm
+{
//-----------------------------------------------------------------------------
-class GDCM_EXPORT gdcmDicomDirImage : public gdcmDicomDirObject
+class GDCM_EXPORT DicomDirImage : public DicomDirObject
{
public:
- gdcmDicomDirImage(gdcmSQItem *s, TagDocEntryHT *ptagHT);
- gdcmDicomDirImage(TagDocEntryHT *ptagHT);
+ DicomDirImage(SQItem *s, TagDocEntryHT *ptagHT);
+ DicomDirImage(TagDocEntryHT *ptagHT);
- ~gdcmDicomDirImage();
+ ~DicomDirImage();
virtual void Print(std::ostream &os = std::cout);
};
-
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmDicomDirMeta.cxx,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:06 $
- Version: $Revision: 1.11 $
+ Date: $Date: 2004/10/12 04:35:44 $
+ Version: $Revision: 1.12 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDicomDirMeta.h"
#include "gdcmDocument.h"
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
// Constructor / Destructor
/**
- * \ingroup gdcmMeta
+ * \ingroup DicomDirMeta
* \brief Constructor
*/
-gdcmDicomDirMeta::gdcmDicomDirMeta(TagDocEntryHT* ptagHT):
- gdcmDicomDirObject(ptagHT)
+DicomDirMeta::DicomDirMeta(TagDocEntryHT* ptagHT):
+ DicomDirObject(ptagHT)
{
}
/**
- * \ingroup gdcmDicomDirMeta
+ * \ingroup DicomDirMeta
* \brief Canonical destructor.
*/
-gdcmDicomDirMeta::~gdcmDicomDirMeta()
+DicomDirMeta::~DicomDirMeta()
{
}
/**
* \brief Prints the Meta Elements
*/
-void gdcmDicomDirMeta::Print(std::ostream& os)
+void DicomDirMeta::Print(std::ostream& os)
{
os << "META" << std::endl;
- // warning : META doesn't behave exactly like a gdcmObjet
+ // warning : META doesn't behave exactly like a Objet
for (ListDocEntry::iterator i = docEntries.begin();
i != docEntries.end();
++i)
* \brief Writes the Meta Elements
* @return
*/
-void gdcmDicomDirMeta::Write(FILE* fp, FileType t)
+void DicomDirMeta::Write(FILE* fp, FileType t)
{
for (ListDocEntry::iterator i = docEntries.begin();
i != docEntries.end();
// Private
//-----------------------------------------------------------------------------
+
+} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmDicomDirMeta.h,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:06 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2004/10/12 04:35:44 $
+ Version: $Revision: 1.9 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#define GDCMDICOMDIRMETA_H
#include "gdcmDicomDirObject.h"
+namespace gdcm
+{
//-----------------------------------------------------------------------------
-class GDCM_EXPORT gdcmDicomDirMeta : public gdcmDicomDirObject
+class GDCM_EXPORT DicomDirMeta : public DicomDirObject
{
public:
- gdcmDicomDirMeta(TagDocEntryHT *ptagHT);
+ DicomDirMeta(TagDocEntryHT *ptagHT);
- ~gdcmDicomDirMeta();
+ ~DicomDirMeta();
virtual void Print(std::ostream &os = std::cout);
virtual void Write(FILE * fp, FileType t);
};
-
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmDicomDirObject.cxx,v $
Language: C++
- Date: $Date: 2004/10/09 03:21:55 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ 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
#include "gdcmGlobal.h"
#include "gdcmDebug.h"
#include "gdcmValEntry.h"
+namespace gdcm
+{
//-----------------------------------------------------------------------------
/**
- * \ingroup gdcmDicomDirObject
+ * \ingroup DicomDirObject
* \brief Constructor
*
- * @param ptagHT pointer to the HTable (gdcmDicomDirObject needs it
- * to build the gdcmDocEntries)
+ * @param ptagHT pointer to the HTable (DicomDirObject needs it
+ * to build the DocEntries)
* @param depth Sequence depth level
*/
-gdcmDicomDirObject::gdcmDicomDirObject(TagDocEntryHT *ptagHT, int depth)
- : gdcmSQItem (depth)
+DicomDirObject::DicomDirObject(TagDocEntryHT *ptagHT, int depth)
+ : SQItem (depth)
{
PtagHT = ptagHT;
}
/**
- * \ingroup gdcmDicomDirObject
+ * \ingroup DicomDirObject
* \brief Canonical destructor.
*/
-gdcmDicomDirObject::~gdcmDicomDirObject()
+DicomDirObject::~DicomDirObject()
{
}
/**
- * \ingroup gdcmDicomDirObject
+ * \ingroup DicomDirObject
* \brief Builds a hash table (multimap) containing
* pointers to all Header Entries (i.e Dicom Element)
* related to this 'object'
* @return
*/
-TagDocEntryHT gdcmDicomDirObject::GetEntry()
+TagDocEntryHT DicomDirObject::GetEntry()
{
TagDocEntryHT HT;
docEntries=GetDocEntries();
* \brief add the 'Object' related Dicom Elements to the listEntries
* of a partially created DICOMDIR
*/
-void gdcmDicomDirObject::FillObject(std::list<gdcmElement> elemList)
+void DicomDirObject::FillObject(std::list<Element> elemList)
{
// FillObject rempli le SQItem qui sera accroche au bon endroit
- std::list<gdcmElement>::iterator it;
+ std::list<Element>::iterator it;
uint16_t tmpGr,tmpEl;
- gdcmDictEntry *dictEntry;
- gdcmValEntry *entry;
+ DictEntry *dictEntry;
+ ValEntry *entry;
// for all the Elements found in they own part of the DicomDir dict.
for(it = elemList.begin(); it != elemList.end(); ++it)
{
tmpGr = it->Group;
tmpEl = it->Elem;
- dictEntry = gdcmGlobal::GetDicts()->GetDefaultPubDict()->GetDictEntryByNumber(tmpGr,tmpEl);
- entry = new gdcmValEntry(dictEntry);
+ dictEntry = Global::GetDicts()->GetDefaultPubDict()->GetDictEntryByNumber(tmpGr,tmpEl);
+ entry = new ValEntry(dictEntry);
entry->SetOffset(0); // just to avoid further missprinting
entry->SetValue(it->Value);
AddDocEntry(entry);
}
}
+} // end namespace gdcm
+
Program: gdcm
Module: $RCSfile: gdcmDicomDirObject.h,v $
Language: C++
- Date: $Date: 2004/10/07 21:05:40 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ 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
=========================================================================*/
-#ifndef GDCMOBJECT_H
-#define GDCMOBJECT_H
+#ifndef GDCMDICOMDIROBJECT_H
+#define GDCMDICOMDIROBJECT_H
-#include "gdcmCommon.h"
-#include "gdcmDocEntry.h"
-#include "gdcmDocument.h"
-#include "gdcmDicomDirElement.h"
#include "gdcmSQItem.h"
+#include "gdcmDicomDirElement.h"
+
#include <string>
#include <list>
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
-class gdcmDicomDirObject;
-typedef std::list<gdcmDicomDirObject *> ListContent;
+class DicomDirObject;
+typedef std::list<DicomDirObject *> ListContent;
//-----------------------------------------------------------------------------
/**
- * \ingroup gdcmDicomDirObject
+ * \ingroup DicomDirObject
* \brief Base object
*/
-class GDCM_EXPORT gdcmDicomDirObject : public gdcmSQItem
+class GDCM_EXPORT DicomDirObject : public SQItem
{
public:
- gdcmDicomDirObject(TagDocEntryHT *ptagHT, int depth = 0);
- virtual ~gdcmDicomDirObject();
+ DicomDirObject(TagDocEntryHT *ptagHT, int depth = 0);
+ virtual ~DicomDirObject();
/**
* \brief Sets the print level for the Dicom Header
* \note 0 for Light Print; 1 for 'medium' Print, 2 for Heavy
void SetPrintLevel(int level) { PrintLevel = level; };
TagDocEntryHT GetEntry();
- void FillObject(std::list<gdcmElement> elemList);
+ void FillObject(std::list<Element> elemList);
protected:
// Constructor and destructor are protected to avoid end user to
// instanciate from this class.
- // NO ! gdcmDicomDir needs to instanciate it!
+ // NO ! DicomDir needs to instanciate it!
// Members :
///\brief detail level to be printed
int PrintLevel;
};
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmDicomDirPatient.cxx,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:06 $
- Version: $Revision: 1.14 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ Version: $Revision: 1.15 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDicomDirPatient.h"
#include "gdcmDicomDirElement.h"
#include "gdcmGlobal.h"
+namespace gdcm
+{
//-----------------------------------------------------------------------------
// Constructor / Destructor
/**
* \brief Constructor
* @param s SQ Item holding the elements related to this "PATIENT" part
- * @param ptagHT pointer to the HTable (gdcmDicomDirObject needs it
- * to build the gdcmHeaderEntries)
+ * @param ptagHT pointer to the HTable (DicomDirObject needs it
+ * to build the HeaderEntries)
*/
-gdcmDicomDirPatient::gdcmDicomDirPatient(gdcmSQItem *s, TagDocEntryHT *ptagHT):
- gdcmDicomDirObject(ptagHT)
+DicomDirPatient::DicomDirPatient(SQItem *s, TagDocEntryHT *ptagHT):
+ DicomDirObject(ptagHT)
{
docEntries = s->GetDocEntries();
}
/**
* \brief Constructor
- * @param ptagHT pointer to the HTable (gdcmDicomDirObject needs it
- * to build the gdcmHeaderEntries)
+ * @param ptagHT pointer to the HTable (DicomDirObject needs it
+ * to build the HeaderEntries)
*/
-gdcmDicomDirPatient::gdcmDicomDirPatient(TagDocEntryHT* ptagHT):
- gdcmDicomDirObject(ptagHT)
+DicomDirPatient::DicomDirPatient(TagDocEntryHT* ptagHT):
+ DicomDirObject(ptagHT)
{
}
/**
* \brief Canonical destructor.
*/
-gdcmDicomDirPatient::~gdcmDicomDirPatient()
+DicomDirPatient::~DicomDirPatient()
{
for(ListDicomDirStudy::iterator cc = studies.begin();
cc != studies.end(); ++cc)
* \brief Prints the Object
* @return
*/
-void gdcmDicomDirPatient::Print(std::ostream& os)
+void DicomDirPatient::Print(std::ostream& os)
{
os << "PATIENT" << std::endl;
- gdcmDicomDirObject::Print(os);
+ DicomDirObject::Print(os);
for(ListDicomDirStudy::iterator cc = studies.begin();
cc != studies.end(); ++cc)
* \brief Writes the Object
* @return
*/
-void gdcmDicomDirPatient::Write(FILE* fp, FileType t)
+void DicomDirPatient::Write(FILE* fp, FileType t)
{
- gdcmDicomDirObject::Write(fp, t);
+ DicomDirObject::Write(fp, t);
for(ListDicomDirStudy::iterator cc = studies.begin();cc!=studies.end();++cc)
{
* \brief adds a new Patient at the begining of the PatientList
* of a partially created DICOMDIR
*/
-gdcmDicomDirStudy* gdcmDicomDirPatient::NewStudy()
+DicomDirStudy* DicomDirPatient::NewStudy()
{
- std::list<gdcmElement> elemList =
- gdcmGlobal::GetDicomDirElements()->GetDicomDirStudyElements();
+ std::list<Element> elemList =
+ Global::GetDicomDirElements()->GetDicomDirStudyElements();
- gdcmDicomDirStudy* st = new gdcmDicomDirStudy( PtagHT );
+ DicomDirStudy* st = new DicomDirStudy( PtagHT );
st->FillObject(elemList);
studies.push_front(st);
// Private
//-----------------------------------------------------------------------------
+
+} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmDicomDirPatient.h,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:06 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ Version: $Revision: 1.10 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDicomDirObject.h"
#include "gdcmDicomDirStudy.h"
#include "gdcmSQItem.h"
+
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
-typedef std::list<gdcmDicomDirStudy*> ListDicomDirStudy;
+typedef std::list<DicomDirStudy*> ListDicomDirStudy;
//-----------------------------------------------------------------------------
-class GDCM_EXPORT gdcmDicomDirPatient : public gdcmDicomDirObject
+class GDCM_EXPORT DicomDirPatient : public DicomDirObject
{
public:
- gdcmDicomDirPatient(gdcmSQItem *s, TagDocEntryHT *ptagHT);
- gdcmDicomDirPatient(TagDocEntryHT *ptagHT);
+ DicomDirPatient(SQItem *s, TagDocEntryHT *ptagHT);
+ DicomDirPatient(TagDocEntryHT *ptagHT);
- ~gdcmDicomDirPatient();
+ ~DicomDirPatient();
virtual void Print(std::ostream &os = std::cout);
virtual void Write(FILE *fp, FileType t);
ListDicomDirStudy &GetDicomDirStudies() { return studies; };
/// adds the passed STUDY to the STUDY chained List for this PATIENT.
- void AddDicomDirStudy(gdcmDicomDirStudy *obj) { studies.push_back(obj); };
+ void AddDicomDirStudy(DicomDirStudy *obj) { studies.push_back(obj); };
/// TODO
- gdcmDicomDirStudy* NewStudy();
+ DicomDirStudy* NewStudy();
private:
/// chained list of DicomDirStudy
ListDicomDirStudy studies;
};
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmDicomDirSerie.cxx,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:06 $
- Version: $Revision: 1.16 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ Version: $Revision: 1.17 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDicomDirElement.h"
#include "gdcmGlobal.h"
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
// Constructor / Destructor
/**
* \brief Constructor
* @param s SQ Item holding the elements related to this "SERIE" part
- * @param ptagHT pointer to the HTable (gdcmDicomDirObject needs it
- * to build the gdcmDocEntries)
+ * @param ptagHT pointer to the HTable (DicomDirObject needs it
+ * to build the DocEntries)
*/
-gdcmDicomDirSerie::gdcmDicomDirSerie(gdcmSQItem* s, TagDocEntryHT* ptagHT):
- gdcmDicomDirObject(ptagHT)
+DicomDirSerie::DicomDirSerie(SQItem* s, TagDocEntryHT* ptagHT):
+ DicomDirObject(ptagHT)
{
docEntries = s->GetDocEntries();
}
/**
* \brief Constructor
- * @param ptagHT pointer to the HTable (gdcmDicomDirObject needs it
- * to build the gdcmDocEntries)
+ * @param ptagHT pointer to the HTable (DicomDirObject needs it
+ * to build the DocEntries)
*/
-gdcmDicomDirSerie::gdcmDicomDirSerie(TagDocEntryHT* ptagHT):
- gdcmDicomDirObject(ptagHT)
+DicomDirSerie::DicomDirSerie(TagDocEntryHT* ptagHT):
+ DicomDirObject(ptagHT)
{
}
/**
* \brief Canonical destructor.
*/
-gdcmDicomDirSerie::~gdcmDicomDirSerie()
+DicomDirSerie::~DicomDirSerie()
{
for(ListDicomDirImage::iterator cc = images.begin();
cc != images.end();
* \brief Prints the Object
* @return
*/
-void gdcmDicomDirSerie::Print(std::ostream& os)
+void DicomDirSerie::Print(std::ostream& os)
{
os << "SERIE" << std::endl;
- gdcmDicomDirObject::Print(os);
+ DicomDirObject::Print(os);
for(ListDicomDirImage::iterator cc = images.begin();
cc != images.end();
* \brief Writes the Object
* @return
*/
-void gdcmDicomDirSerie::Write(FILE* fp, FileType t)
+void DicomDirSerie::Write(FILE* fp, FileType t)
{
- gdcmDicomDirObject::Write(fp, t);
+ DicomDirObject::Write(fp, t);
for(ListDicomDirImage::iterator cc = images.begin();cc!=images.end();++cc)
{
/**
* \brief adds a new Image (with the basic elements) to a partially created DICOMDIR
*/
-gdcmDicomDirImage* gdcmDicomDirSerie::NewImage()
+DicomDirImage* DicomDirSerie::NewImage()
{
- std::list<gdcmElement> elemList =
- gdcmGlobal::GetDicomDirElements()->GetDicomDirImageElements();
+ std::list<Element> elemList =
+ Global::GetDicomDirElements()->GetDicomDirImageElements();
- gdcmDicomDirImage* st = new gdcmDicomDirImage(PtagHT);
+ DicomDirImage* st = new DicomDirImage(PtagHT);
FillObject(elemList);
images.push_front(st);
// Private
//-----------------------------------------------------------------------------
+} // end namespace gdcm
+
+
Program: gdcm
Module: $RCSfile: gdcmDicomDirSerie.h,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:06 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ Version: $Revision: 1.10 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDicomDirObject.h"
#include "gdcmDicomDirImage.h"
+namespace gdcm
+{
//-----------------------------------------------------------------------------
-typedef std::list<gdcmDicomDirImage *> ListDicomDirImage;
+typedef std::list<DicomDirImage *> ListDicomDirImage;
//-----------------------------------------------------------------------------
-class GDCM_EXPORT gdcmDicomDirSerie : public gdcmDicomDirObject
+class GDCM_EXPORT DicomDirSerie : public DicomDirObject
{
public:
- gdcmDicomDirSerie(gdcmSQItem *s, TagDocEntryHT *ptagHT);
- gdcmDicomDirSerie(TagDocEntryHT *ptagHT);
+ DicomDirSerie(SQItem *s, TagDocEntryHT *ptagHT);
+ DicomDirSerie(TagDocEntryHT *ptagHT);
- ~gdcmDicomDirSerie();
+ ~DicomDirSerie();
virtual void Print(std::ostream &os = std::cout);
virtual void Write(FILE *fp, FileType t);
/**
- * \ingroup gdcmDicomDirSerie
+ * \ingroup DicomDirSerie
* \brief returns the IMAGE chained List for this SERIE.
*/
ListDicomDirImage &GetDicomDirImages() { return images; };
/**
- * \ingroup gdcmDicomDirSerie
+ * \ingroup DicomDirSerie
* \brief adds the passed IMAGE to the IMAGE chained List for this SERIE.
*/
- void AddDicomDirImage(gdcmDicomDirImage *obj) { images.push_back(obj); };
+ void AddDicomDirImage(DicomDirImage *obj) { images.push_back(obj); };
/**
- * \ingroup gdcmDicomDirSerie
+ * \ingroup DicomDirSerie
* \brief TODO
*/
- gdcmDicomDirImage* NewImage();
+ DicomDirImage* NewImage();
private:
/**
*/
ListDicomDirImage images;
};
-
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmDicomDirStudy.cxx,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:06 $
- Version: $Revision: 1.13 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ Version: $Revision: 1.14 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDicomDirStudy.h"
#include "gdcmDicomDirElement.h"
#include "gdcmGlobal.h"
+
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
// Constructor / Destructor
/**
- * \ingroup gdcmDicomDirStudy
+ * \ingroup DicomDirStudy
* \brief constructor
* @param s SQ Item holding the elements related to this "STUDY" part
- * @param ptagHT pointer to the HTable (gdcmDicomDirObject needs it
- * to build the gdcmHeaderEntries)
+ * @param ptagHT pointer to the HTable (DicomDirObject needs it
+ * to build the HeaderEntries)
*/
-gdcmDicomDirStudy::gdcmDicomDirStudy(gdcmSQItem* s, TagDocEntryHT* ptagHT):
- gdcmDicomDirObject(ptagHT)
+DicomDirStudy::DicomDirStudy(SQItem* s, TagDocEntryHT* ptagHT):
+ DicomDirObject(ptagHT)
{
docEntries = s->GetDocEntries();
}
/**
- * \ingroup gdcmDicomDirStudy
+ * \ingroup DicomDirStudy
* \brief constructor
- * @param ptagHT pointer to the HTable (gdcmDicomDirObject needs it
- * to build the gdcmHeaderEntries)
+ * @param ptagHT pointer to the HTable (DicomDirObject needs it
+ * to build the HeaderEntries)
*/
-gdcmDicomDirStudy::gdcmDicomDirStudy(TagDocEntryHT* ptagHT):
- gdcmDicomDirObject(ptagHT)
+DicomDirStudy::DicomDirStudy(TagDocEntryHT* ptagHT):
+ DicomDirObject(ptagHT)
{
}
/**
- * \ingroup gdcmDicomDirStudy
+ * \ingroup DicomDirStudy
* \brief Canonical destructor.
*/
-gdcmDicomDirStudy::~gdcmDicomDirStudy()
+DicomDirStudy::~DicomDirStudy()
{
for(ListDicomDirSerie::iterator cc = series.begin();cc != series.end();++cc)
{
//-----------------------------------------------------------------------------
// Print
/**
- * \ingroup gdcmDicomDirStudy
+ * \ingroup DicomDirStudy
* \brief Prints the Object
* @return
*/
-void gdcmDicomDirStudy::Print(std::ostream& os)
+void DicomDirStudy::Print(std::ostream& os)
{
os << "STUDY" << std::endl;
- gdcmDicomDirObject::Print(os);
+ DicomDirObject::Print(os);
for(ListDicomDirSerie::iterator cc = series.begin();
cc != series.end();
* \brief Writes the Object
* @return
*/
-void gdcmDicomDirStudy::Write(FILE* fp, FileType t)
+void DicomDirStudy::Write(FILE* fp, FileType t)
{
- gdcmDicomDirObject::Write(fp, t);
+ DicomDirObject::Write(fp, t);
for(ListDicomDirSerie::iterator cc = series.begin();cc!=series.end();++cc)
{
}
/**
- * \ingroup gdcmDicomStudy
+ * \ingroup DicomDirStudy
* \brief adds a new Serie at the begining of the SerieList
* of a partially created DICOMDIR
*/
-gdcmDicomDirSerie* gdcmDicomDirStudy::NewSerie()
+DicomDirSerie* DicomDirStudy::NewSerie()
{
- std::list<gdcmElement> elemList =
- gdcmGlobal::GetDicomDirElements()->GetDicomDirSerieElements();
+ std::list<Element> elemList =
+ Global::GetDicomDirElements()->GetDicomDirSerieElements();
- gdcmDicomDirSerie* st = new gdcmDicomDirSerie(PtagHT);
+ DicomDirSerie* st = new DicomDirSerie(PtagHT);
FillObject(elemList);
series.push_front(st);
// Private
//-----------------------------------------------------------------------------
+} // end namespace gdcm
+
Program: gdcm
Module: $RCSfile: gdcmDicomDirStudy.h,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:06 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ Version: $Revision: 1.10 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDicomDirObject.h"
#include "gdcmDicomDirSerie.h"
+namespace gdcm
+{
//-----------------------------------------------------------------------------
-typedef std::list<gdcmDicomDirSerie *> ListDicomDirSerie;
+typedef std::list<DicomDirSerie *> ListDicomDirSerie;
//-----------------------------------------------------------------------------
-class GDCM_EXPORT gdcmDicomDirStudy : public gdcmDicomDirObject
+class GDCM_EXPORT DicomDirStudy : public DicomDirObject
{
public:
- gdcmDicomDirStudy(gdcmSQItem *s, TagDocEntryHT *ptagHT);
- gdcmDicomDirStudy(TagDocEntryHT *ptagHT);
+ DicomDirStudy(SQItem *s, TagDocEntryHT *ptagHT);
+ DicomDirStudy(TagDocEntryHT *ptagHT);
- ~gdcmDicomDirStudy();
+ ~DicomDirStudy();
virtual void Print(std::ostream &os = std::cout);
virtual void Write(FILE *fp, FileType t);
/**
- * \ingroup gdcmDicomDirStudy
+ * \ingroup DicomDirStudy
* \brief returns the SERIE chained List for this STUDY.
*/
ListDicomDirSerie &GetDicomDirSeries() { return series; };
/**
- * \ingroup gdcmDicomDirStudy
+ * \ingroup DicomDirStudy
* \brief adds the passed SERIE to the SERIE chained List for this STUDY.
*/
- void AddDicomDirSerie(gdcmDicomDirSerie *obj) { series.push_back(obj); };
+ void AddDicomDirSerie(DicomDirSerie *obj) { series.push_back(obj); };
/**
- * \ingroup gdcmDicomDirStudy
+ * \ingroup DicomDirStudy
* \brief TODO
*/
- gdcmDicomDirSerie* NewSerie();
+ DicomDirSerie* NewSerie();
private:
/**
*/
ListDicomDirSerie series;
};
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmDict.cxx,v $
Language: C++
- Date: $Date: 2004/10/08 04:43:38 $
- Version: $Revision: 1.44 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ Version: $Revision: 1.45 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <fstream>
#include <iostream>
#include <iomanip>
+namespace gdcm
+{
//-----------------------------------------------------------------------------
// Constructor / Destructor
* \brief Construtor
* @param filename from which to build the dictionary.
*/
-gdcmDict::gdcmDict(std::string const & filename)
+Dict::Dict(std::string const & filename)
{
uint16_t group;
uint16_t element;
TagName name;
std::ifstream from( filename.c_str() );
- dbg.Error(!from, "gdcmDict::gdcmDict: can't open dictionary",
+ dbg.Error(!from, "Dict::Dict: can't open dictionary",
filename.c_str());
while (!from.eof())
from >> std::ws; // used to be eatwhite(from);
std::getline(from, name); /// MEMORY LEAK in std::getline<>
- gdcmDictEntry * newEntry = new gdcmDictEntry(group, element,
+ DictEntry * newEntry = new DictEntry(group, element,
vr, fourth, name);
AddNewEntry(newEntry);
}
/**
* \brief Destructor
*/
-gdcmDict::~gdcmDict()
+Dict::~Dict()
{
for (TagKeyHT::iterator tag = KeyHt.begin(); tag != KeyHt.end(); ++tag)
{
- gdcmDictEntry* entryToDelete = tag->second;
+ DictEntry* entryToDelete = tag->second;
if ( entryToDelete )
{
delete entryToDelete;
}
}
// Since AddNewEntry adds symetrical in both KeyHt and NameHT we can
- // assume all the pointed gdcmDictEntries are already cleaned-up when
+ // assume all the pointed DictEntries are already cleaned-up when
// we cleaned KeyHt.
KeyHt.clear();
NameHt.clear();
* Entries will be sorted by tag i.e. the couple (group, element).
* @param os The output stream to be written to.
*/
-void gdcmDict::Print(std::ostream &os)
+void Dict::Print(std::ostream &os)
{
os << "Dict file name : " << Filename << std::endl;
PrintByKey(os);
* Entries will be sorted by tag i.e. the couple (group, element).
* @param os The output stream to be written to.
*/
-void gdcmDict::PrintByKey(std::ostream &os)
+void Dict::PrintByKey(std::ostream &os)
{
std::ostringstream s;
* unpredictable result
* @param os The output stream to be written to.
*/
-void gdcmDict::PrintByName(std::ostream& os)
+void Dict::PrintByName(std::ostream& os)
{
std::ostringstream s;
//-----------------------------------------------------------------------------
// Public
/**
- * \ingroup gdcmDict
+ * \ingroup Dict
* \brief adds a new Dicom Dictionary Entry
* @param newEntry entry to add
* @return false if Dicom Element already exists
*/
-bool gdcmDict::AddNewEntry(gdcmDictEntry *newEntry)
+bool Dict::AddNewEntry(DictEntry *newEntry)
{
- gdcmTagKey key = newEntry->GetKey();
+ TagKey key = newEntry->GetKey();
if(KeyHt.count(key) == 1)
{
- dbg.Verbose(1, "gdcmDict::AddNewEntry already present", key.c_str());
+ dbg.Verbose(1, "Dict::AddNewEntry already present", key.c_str());
return false;
}
else
}
/**
- * \ingroup gdcmDict
+ * \ingroup Dict
* \brief replaces an already existing Dicom Element by a new one
* @param newEntry new entry (overwrites any previous one with same tag)
* @return false if Dicom Element doesn't exist
*/
-bool gdcmDict::ReplaceEntry(gdcmDictEntry *newEntry)
+bool Dict::ReplaceEntry(DictEntry *newEntry)
{
- if ( RemoveEntry(newEntry->gdcmDictEntry::GetKey()) )
+ if ( RemoveEntry(newEntry->DictEntry::GetKey()) )
{
KeyHt[newEntry->GetKey()] = newEntry;
NameHt[newEntry->GetName()] = newEntry;
}
/**
- * \ingroup gdcmDict
+ * \ingroup Dict
* \brief removes an already existing Dicom Dictionary Entry,
* identified by its Tag
* @param key (group|element)
* @return false if Dicom Dictionary Entry doesn't exist
*/
-bool gdcmDict::RemoveEntry(gdcmTagKey key)
+bool Dict::RemoveEntry(TagKey key)
{
if(KeyHt.count(key) == 1)
{
- gdcmDictEntry* entryToDelete = KeyHt.find(key)->second;
+ DictEntry* entryToDelete = KeyHt.find(key)->second;
if ( entryToDelete )
{
}
else
{
- dbg.Verbose(1, "gdcmDict::RemoveEntry unfound entry", key.c_str());
+ dbg.Verbose(1, "Dict::RemoveEntry unfound entry", key.c_str());
return false;
}
}
* @param element Dicom element number of the Dicom Element
* @return false if Dicom Dictionary Entry doesn't exist
*/
-bool gdcmDict::RemoveEntry (uint16_t group, uint16_t element)
+bool Dict::RemoveEntry (uint16_t group, uint16_t element)
{
- return RemoveEntry(gdcmDictEntry::TranslateToKey(group, element));
+ return RemoveEntry(DictEntry::TranslateToKey(group, element));
}
/**
* the name MAY CHANGE between two versions !
* @return the corresponding dictionnary entry when existing, NULL otherwise
*/
-gdcmDictEntry* gdcmDict::GetDictEntryByName(TagName name)
+DictEntry* Dict::GetDictEntryByName(TagName name)
{
if ( !NameHt.count(name))
{
* @param element element of the entry to be found
* @return the corresponding dictionnary entry when existing, NULL otherwise
*/
-gdcmDictEntry* gdcmDict::GetDictEntryByNumber(uint16_t group, uint16_t element)
+DictEntry* Dict::GetDictEntryByNumber(uint16_t group, uint16_t element)
{
- gdcmTagKey key = gdcmDictEntry::TranslateToKey(group, element);
+ TagKey key = DictEntry::TranslateToKey(group, element);
if ( !KeyHt.count(key) )
{
return 0;
/**
* \brief Consider all the entries of the public dicom dictionnary.
* Build all list of all the tag names of all those entries.
- * \sa gdcmDictSet::GetPubDictTagNamesByCategory
+ * \sa DictSet::GetPubDictTagNamesByCategory
* @return A list of all entries of the public dicom dictionnary.
*/
-std::list<std::string>* gdcmDict::GetDictEntryNames()
+std::list<std::string>* Dict::GetDictEntryNames()
{
std::list<std::string> *result = new std::list<std::string>;
for (TagKeyHT::iterator tag = KeyHt.begin(); tag != KeyHt.end(); ++tag)
}
/**
- * \ingroup gdcmDict
+ * \ingroup Dict
* \brief Consider all the entries of the public dicom dictionnary.
* Build an hashtable whose keys are the names of the groups
* (fourth field in each line of dictionary) and whose corresponding
* corresponding values are lists of all the dictionnary entries
* among that group.
*/
-std::map<std::string, std::list<std::string> > *gdcmDict::GetDictEntryNamesByCategory(void)
+std::map<std::string, std::list<std::string> > *Dict::GetDictEntryNamesByCategory(void)
{
std::map<std::string, std::list<std::string> > *result = new std::map<std::string, std::list<std::string> >;
// Private
//-----------------------------------------------------------------------------
+
+} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmDict.h,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:06 $
- Version: $Revision: 1.18 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ Version: $Revision: 1.19 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <iostream>
#include <list>
#include <map>
+namespace gdcm
+{
//-----------------------------------------------------------------------------
-typedef std::map<gdcmTagKey, gdcmDictEntry*> TagKeyHT;
-typedef std::map<TagName, gdcmDictEntry*> TagNameHT;
+typedef std::map<TagKey, DictEntry*> TagKeyHT;
+typedef std::map<TagName, DictEntry*> TagNameHT;
//-----------------------------------------------------------------------------
/*
- * \defgroup gdcmDict
- * \brief gdcmDict acts a memory representation of a dicom dictionary i.e.
+ * \defgroup Dict
+ * \brief Dict acts a memory representation of a dicom dictionary i.e.
* it is a container for a collection of dictionary entries. The
* dictionary is loaded from in an ascii file.
* There should be a single public dictionary (THE dictionary of
* the actual DICOM v3) but as many shadow dictionaries as imagers
* combined with all software versions...
- * \see gdcmDictSet
+ * \see DictSet
*/
-class GDCM_EXPORT gdcmDict
+class GDCM_EXPORT Dict
{
public:
- gdcmDict(std::string const & FileName);
- ~gdcmDict();
+ Dict(std::string const & FileName);
+ ~Dict();
// Print
void Print(std::ostream &os = std::cout);
void PrintByName(std::ostream &os = std::cout);
// Entries
- bool AddNewEntry (gdcmDictEntry *NewEntry);
- bool ReplaceEntry(gdcmDictEntry *NewEntry);
- bool RemoveEntry (gdcmTagKey key);
+ bool AddNewEntry (DictEntry *NewEntry);
+ bool ReplaceEntry(DictEntry *NewEntry);
+ bool RemoveEntry (TagKey key);
bool RemoveEntry (uint16_t group, uint16_t element);
// Tag
- gdcmDictEntry *GetDictEntryByName(TagName name);
- gdcmDictEntry *GetDictEntryByNumber(uint16_t group, uint16_t element);
+ DictEntry *GetDictEntryByName(TagName name);
+ DictEntry *GetDictEntryByNumber(uint16_t group, uint16_t element);
std::list<std::string> *GetDictEntryNames();
std::map<std::string, std::list<std::string> > *
private:
/// ASCII file holding the Dictionnary
std::string Filename;
- /// Access through gdcmTagKey (see alternate access with NameHt)
+ /// Access through TagKey (see alternate access with NameHt)
TagKeyHT KeyHt;
/// Access through TagName (see alternate access with KeyHt)
TagNameHT NameHt;
};
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmDictEntry.cxx,v $
Language: C++
- Date: $Date: 2004/10/10 00:42:54 $
- Version: $Revision: 1.25 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ 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
#include "gdcmDebug.h"
#include "gdcmUtil.h"
+namespace gdcm
+{
//-----------------------------------------------------------------------------
// Constructor / Destructor
* @param name description of the element
*/
-gdcmDictEntry::gdcmDictEntry(uint16_t group, uint16_t element,
+DictEntry::DictEntry(uint16_t group, uint16_t element,
std::string vr, std::string fourth,
std::string name)
{
* @param element the Dicom element number used to build the tag
* @return the built tag
*/
-gdcmTagKey gdcmDictEntry::TranslateToKey(uint16_t group, uint16_t element)
+TagKey DictEntry::TranslateToKey(uint16_t group, uint16_t element)
{
- gdcmTagKey key = gdcmUtil::Format("%04x|%04x", group , element);
+ TagKey key = Util::Format("%04x|%04x", group , element);
return key;
}
* \ is unset then overwrite it.
* @param vr New V(alue) R(epresentation) to be set.
*/
-void gdcmDictEntry::SetVR(std::string const & vr)
+void DictEntry::SetVR(std::string const & vr)
{
if ( IsVRUnknown() )
{
}
else
{
- dbg.Error(true, "gdcmDictEntry::SetVR",
+ dbg.Error(true, "DictEntry::SetVR",
"Overwriting VR might compromise a dictionary");
}
}
// Private
//-----------------------------------------------------------------------------
+} // end namespace gdcm
+
Program: gdcm
Module: $RCSfile: gdcmDictEntry.h,v $
Language: C++
- Date: $Date: 2004/10/09 02:57:11 $
- Version: $Revision: 1.17 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ Version: $Revision: 1.18 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmCommon.h"
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
/*
- * \defgroup gdcmDictEntry
+ * \defgroup DictEntry
* \brief
- * the gdcmDictEntry in an element contained by the gdcmDict.
+ * the DictEntry in an element contained by the Dict.
* It contains :
* - the key referenced by the DICOM norm or the constructor (for private keys)
* - the corresponding name in english (it's equivalent to a label)
* - the owner group
* - etc.
*/
-class GDCM_EXPORT gdcmDictEntry
+class GDCM_EXPORT DictEntry
{
public:
- gdcmDictEntry(uint16_t group,
+ DictEntry(uint16_t group,
uint16_t element,
std::string vr = "Unknown",
std::string fourth = "Unknown",
std::string name = "Unknown");
- static gdcmTagKey TranslateToKey(uint16_t group, uint16_t element);
+ static TagKey TranslateToKey(uint16_t group, uint16_t element);
void SetVR(std::string const & vr);
/// @return
bool IsVRUnknown() { return VR == "??"; }
- /// \brief Returns the Dicom Group Number of the current gdcmDictEntry
+ /// \brief Returns the Dicom Group Number of the current DictEntry
/// @return the Dicom Group Number
uint16_t GetGroup() { return Group; }
- /// \brief Returns the Dicom Element Number of the current gdcmDictEntry
+ /// \brief Returns the Dicom Element Number of the current DictEntry
/// @return the Dicom Element Number
uint16_t GetElement() { return Element; }
/// \brief Returns the Dicom Value Representation of the current
- /// gdcmDictEntry
+ /// DictEntry
/// @return the Dicom Value Representation
std::string GetVR() { return VR; }
- /// \brief sets the key of the current gdcmDictEntry
+ /// \brief sets the key of the current DictEntry
/// @param k New key to be set.
void SetKey(std::string const & k) { Key = k; }
- /// \brief returns the Fourth field of the current gdcmDictEntry
+ /// \brief returns the Fourth field of the current DictEntry
/// \warning NOT part of the Dicom Standard.
/// May be REMOVED an any time. NEVER use it.
/// @return The Fourth field
std::string GetFourth() { return Fourth; }
- /// \brief Returns the Dicom Name of the current gdcmDictEntry
+ /// \brief Returns the Dicom Name of the current DictEntry
/// e.g. "Patient Name" for Dicom Tag (0x0010, 0x0010)
/// @return the Dicom Name
std::string GetName() { return Name; }
- /// \brief Gets the key of the current gdcmDictEntry
+ /// \brief Gets the key of the current DictEntry
/// @return the key.
std::string GetKey() { return Key; }
private:
/// \todo FIXME
/// where are the group and element used except from building up
- /// a gdcmTagKey. If the answer is nowhere then there is no need
+ /// a TagKey. If the answer is nowhere then there is no need
/// to store the group and element independently.
///
/// --> EVERYWHERE ! The alternate question would be :
- /// What's gdcmTagKey used for ?
+ /// What's TagKey used for ?
/// DicomGroup number
uint16_t Group; // e.g. 0x0010
/// \brief Value Representation i.e. some clue about the nature
/// of the data represented e.g. "FD" short for
- /// "Floating Point Double" (see \ref gdcmVR)
+ /// "Floating Point Double" (see \ref VR)
std::string VR;
/**
std::string Name;
/// Redundant with (group, element) but we add it for efficiency purpose.
- gdcmTagKey Key;
+ TagKey Key;
};
-
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmDictSet.cxx,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:06 $
- Version: $Revision: 1.37 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ Version: $Revision: 1.38 $
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 <fstream>
#include <stdlib.h> // For getenv
+namespace gdcm
+{
//-----------------------------------------------------------------------------
// Constructor / Destructor
/**
- * \ingroup gdcmDictSet
+ * \ingroup DictSet
* \brief The Dictionnary Set obtained with this constructor simply
* contains the Default Public dictionnary.
*/
-gdcmDictSet::gdcmDictSet()
+DictSet::DictSet()
{
DictPath = BuildDictPath();
std::string pubDictFile(DictPath);
pubDictFile += PUB_DICT_FILENAME;
- Dicts[PUB_DICT_NAME] = new gdcmDict(pubDictFile);
+ Dicts[PUB_DICT_NAME] = new Dict(pubDictFile);
}
/**
- * \ingroup gdcmDictSet
+ * \ingroup DictSet
* \brief Destructor
*/
-gdcmDictSet::~gdcmDictSet()
+DictSet::~DictSet()
{
// Remove dictionnaries
for (DictSetHT::iterator tag = Dicts.begin(); tag != Dicts.end(); ++tag)
{
- gdcmDict *entryToDelete = tag->second;
+ Dict *entryToDelete = tag->second;
if ( entryToDelete )
{
delete entryToDelete;
Dicts.clear();
// Remove virtual dictionnary entries
- std::map<std::string,gdcmDictEntry *>::iterator it;
+ std::map<std::string,DictEntry *>::iterator it;
for(it = VirtualEntry.begin(); it != VirtualEntry.end(); ++it)
{
- gdcmDictEntry *entry = it->second;
+ DictEntry *entry = it->second;
if ( entry )
{
delete entry;
//-----------------------------------------------------------------------------
// Print
/**
- * \ingroup gdcmDictSet
+ * \ingroup DictSet
* \brief Print, in an informal fashion, the list of all the dictionaries
- * contained is this gdcmDictSet, along with their respective content.
+ * contained is this DictSet, along with their respective content.
* @param os Output stream used for printing.
*/
-void gdcmDictSet::Print(std::ostream& os)
+void DictSet::Print(std::ostream& os)
{
for (DictSetHT::iterator dict = Dicts.begin(); dict != Dicts.end(); ++dict)
{
//-----------------------------------------------------------------------------
// Public
/**
- * \ingroup gdcmDictSet
+ * \ingroup DictSet
* \brief Consider all the entries of the public dicom dictionnary.
* Build all list of all the tag names of all those entries.
- * \sa gdcmDictSet::GetPubDictTagNamesByCategory
+ * \sa DictSet::GetPubDictTagNamesByCategory
* @return A list of all entries of the public dicom dictionnary.
*/
-std::list<std::string> *gdcmDictSet::GetPubDictEntryNames()
+std::list<std::string> *DictSet::GetPubDictEntryNames()
{
return GetDefaultPubDict()->GetDictEntryNames();
}
/**
- * \ingroup gdcmDictSet
+ * \ingroup DictSet
* \brief
* - Consider all the entries of the public dicom dictionnary.
* - Build an hashtable whose keys are the names of the groups
* among that group.
*/
std::map<std::string, std::list<std::string> > *
- gdcmDictSet::GetPubDictEntryNamesByCategory()
+ DictSet::GetPubDictEntryNamesByCategory()
{
return GetDefaultPubDict()->GetDictEntryNamesByCategory();
}
/**
- * \ingroup gdcmDictSet
+ * \ingroup DictSet
* \brief Loads a dictionary from a specified file, and add it
- * to already the existing ones contained in this gdcmDictSet.
+ * to already the existing ones contained in this DictSet.
* @param fileName Absolute or relative filename containing the
* dictionary to load.
* @param name Symbolic name that be used as identifier of the newly
* created dictionary.
*/
-gdcmDict *gdcmDictSet::LoadDictFromFile(std::string const & fileName,
+Dict *DictSet::LoadDictFromFile(std::string const & fileName,
DictKey const & name)
{
- gdcmDict *newDict = new gdcmDict(fileName);
+ Dict *newDict = new Dict(fileName);
AppendDict(newDict, name);
return newDict;
}
/**
- * \ingroup gdcmDictSet
+ * \ingroup DictSet
* \brief Retrieve the specified dictionary (when existing) from this
- * gdcmDictSet.
+ * DictSet.
* @param dictName The symbolic name of the searched dictionary.
* \result The retrieved dictionary.
*/
-gdcmDict *gdcmDictSet::GetDict(DictKey const & dictName)
+Dict *DictSet::GetDict(DictKey const & dictName)
{
DictSetHT::iterator dict = Dicts.find(dictName);
if(dict != Dicts.end())
}
/**
- * \brief Create a gdcmDictEntry which will be reference
+ * \brief Create a DictEntry which will be reference
* in no dictionnary
* @return virtual entry
*/
-gdcmDictEntry *gdcmDictSet::NewVirtualDictEntry(uint16_t group,
+DictEntry *DictSet::NewVirtualDictEntry(uint16_t group,
uint16_t element,
std::string vr,
std::string fourth,
std::string name)
{
- gdcmDictEntry* entry;
- const std::string tag = gdcmDictEntry::TranslateToKey(group,element)
+ DictEntry* entry;
+ const std::string tag = DictEntry::TranslateToKey(group,element)
+ "#" + vr + "#" + fourth + "#" + name;
- std::map<std::string,gdcmDictEntry *>::iterator it;
+ std::map<std::string,DictEntry *>::iterator it;
it = VirtualEntry.find(tag);
if(it != VirtualEntry.end())
}
else
{
- entry = new gdcmDictEntry(group, element, vr, fourth, name);
+ entry = new DictEntry(group, element, vr, fourth, name);
VirtualEntry[tag] = entry;
}
* to "../Dicts/".
* @return path to directory containing the dictionnaries
*/
-std::string gdcmDictSet::BuildDictPath()
+std::string DictSet::BuildDictPath()
{
std::string resultPath;
const char *envPath = 0;
{
resultPath += '/';
}
- dbg.Verbose(1, "gdcmDictSet::BuildDictPath:",
+ dbg.Verbose(1, "DictSet::BuildDictPath:",
"Dictionary path set from environnement");
}
else
//-----------------------------------------------------------------------------
// Protected
-bool gdcmDictSet::AppendDict(gdcmDict *newDict, DictKey const & name)
+bool DictSet::AppendDict(Dict *newDict, DictKey const & name)
{
Dicts[name] = newDict;
//-----------------------------------------------------------------------------
-
+} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmDictSet.h,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:06 $
- Version: $Revision: 1.26 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ 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
#include "gdcmDict.h"
#include <map>
#include <list>
+namespace gdcm
+{
typedef std::string DictKey;
-typedef std::map<DictKey, gdcmDict*> DictSetHT;
+typedef std::map<DictKey, Dict*> DictSetHT;
//-----------------------------------------------------------------------------
/*
- * \defgroup gdcmDictSet
+ * \defgroup DictSet
* \brief Container for managing a set of loaded dictionaries.
* \note Hopefully, sharing dictionaries should avoid
* \par reloading an already loaded dictionary (saving time)
* \par having many in memory representations of the same dictionary
* (saving memory).
*/
-class GDCM_EXPORT gdcmDictSet
+class GDCM_EXPORT DictSet
{
public:
- gdcmDictSet();
- ~gdcmDictSet();
+ DictSet();
+ ~DictSet();
void Print(std::ostream& os);
std::map<std::string, std::list<std::string> > *
GetPubDictEntryNamesByCategory();
- gdcmDict* LoadDictFromFile( std::string const & fileName,
+ Dict* LoadDictFromFile( std::string const & fileName,
DictKey const & name );
- gdcmDict* GetDict( DictKey const & DictName );
+ Dict* GetDict( DictKey const & DictName );
/// \brief Retrieve the default reference DICOM V3 public dictionary.
- gdcmDict* GetDefaultPubDict() { return GetDict(PUB_DICT_NAME); };
+ Dict* GetDefaultPubDict() { return GetDict(PUB_DICT_NAME); };
// \brief Retrieve the virtual reference DICOM dictionary.
// \warning : not end user intended
- // gdcmDict* GetVirtualDict() { return &VirtualEntry; };
+ // Dict* GetVirtualDict() { return &VirtualEntry; };
- gdcmDictEntry* NewVirtualDictEntry(uint16_t group, uint16_t element,
+ DictEntry* NewVirtualDictEntry(uint16_t group, uint16_t element,
std::string vr = "Unknown",
std::string fourth = "Unknown",
std::string name = "Unknown");
static std::string BuildDictPath();
protected:
- bool AppendDict(gdcmDict *NewDict, DictKey const & name);
+ bool AppendDict(Dict *NewDict, DictKey const & name);
private:
- /// Hash table of all dictionaries contained in this gdcmDictSet
+ /// Hash table of all dictionaries contained in this DictSet
DictSetHT Dicts;
/// Directory path to dictionaries
std::string DictPath;
- /// H table for the on the fly created gdcmDictEntries
+ /// H table for the on the fly created DictEntries
TagKeyHT VirtualEntry;
};
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmDirList.cxx,v $
Language: C++
- Date: $Date: 2004/10/10 00:42:54 $
- Version: $Revision: 1.22 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ Version: $Revision: 1.23 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <sys/stat.h>
#include <sys/types.h>
#endif
+namespace gdcm
+{
// Constructor / Destructor
/**
- * \ingroup gdcmDirList
+ * \ingroup DirList
* \brief Constructor
* @param dirName root directory name
* @param recursive whether we want to explore recursively or not
*/
-gdcmDirList::gdcmDirList(std::string dirName, bool recursive)
+DirList::DirList(std::string dirName, bool recursive)
{
name = dirName;
- gdcmUtil::NormalizePath(name);
+ Util::NormalizePath(name);
Explore(name, recursive);
}
/**
- * \ingroup gdcmDirList
+ * \ingroup DirList
* \brief Destructor
*/
-gdcmDirList::~gdcmDirList()
+DirList::~DirList()
{
}
//-----------------------------------------------------------------------------
// Public
/**
- * \ingroup gdcmDirList
+ * \ingroup DirList
* \brief Get the directory name
* @return the directory name
*/
-std::string gdcmDirList::GetDirName()
+std::string DirList::GetDirName()
{
return name;
}
// Private
/**
- * \ingroup gdcmDirList
+ * \ingroup DirList
* \brief Explore a directory with possibility of recursion
* return number of files read
* @param dirName directory to explore
* @param recursive whether we want recursion or not
*/
-int gdcmDirList::Explore(std::string dirName, bool recursive)
+int DirList::Explore(std::string dirName, bool recursive)
{
int numberOfFiles = 0;
std::string fileName;
- gdcmUtil::NormalizePath(dirName);
+ Util::NormalizePath(dirName);
#if defined(_MSC_VER) || (__CYGWIN__)
WIN32_FIND_DATA fileData;
HANDLE hFile=FindFirstFile((dirName+"*").c_str(),&fileData);
return numberOfFiles;
}
+} // end namespace gdcm
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmDirList.h,v $
Language: C++
- Date: $Date: 2004/10/07 16:55:16 $
- Version: $Revision: 1.10 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ Version: $Revision: 1.11 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <string>
#include <list>
+namespace gdcm
+{
//-----------------------------------------------------------------------------
/**
- * \ingroup gdcmDirList
+ * \ingroup DirList
* \brief List containing the file headers from root directory.
*/
-class GDCM_EXPORT gdcmDirList: public std::list<std::string>
+class GDCM_EXPORT DirList: public std::list<std::string>
{
public :
- gdcmDirList(std::string dirName,bool recursive=false);
- virtual ~gdcmDirList();
+ DirList(std::string dirName,bool recursive=false);
+ virtual ~DirList();
std::string GetDirName();
/// name of the root directory to explore
std::string name;
};
-
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmDocEntry.cxx,v $
Language: C++
- Date: $Date: 2004/10/10 00:42:54 $
- Version: $Revision: 1.26 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ 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
#include "gdcmUtil.h"
#include <iomanip> // for std::ios::left, ...
+namespace gdcm
+{
// CLEAN ME
#define MAX_SIZE_PRINT_ELEMENT_VALUE 64
//-----------------------------------------------------------------------------
// Constructor / Destructor
/**
- * \ingroup gdcmDocEntry
- * \brief Constructor from a given gdcmDictEntry
+ * \ingroup DocEntry
+ * \brief Constructor from a given DictEntry
* @param in Pointer to existing dictionary entry
*/
-gdcmDocEntry::gdcmDocEntry(gdcmDictEntry* in)
+DocEntry::DocEntry(DictEntry* in)
{
ImplicitVR = false;
- DictEntry = in;
+ DicomDict = in;
SetKey( in->GetKey( ) );
Offset = 0 ; // To avoid further missprinting
}
//-----------------------------------------------------------------------------
// Print
/**
- * \ingroup gdcmDocEntry
- * \brief Prints the common part of gdcmValEntry, gdcmBinEntry, gdcmSeqEntry
+ * \ingroup DocEntry
+ * \brief Prints the common part of ValEntry, BinEntry, SeqEntry
* @param os ostream we want to print in
*/
-void gdcmDocEntry::Print(std::ostream& os)
+void DocEntry::Print(std::ostream& os)
{
PrintLevel = 2; // FIXME
o = GetOffset();
vr = GetVR();
- s << gdcmDictEntry::TranslateToKey(GetGroup(),GetElement());
+ s << DictEntry::TranslateToKey(GetGroup(),GetElement());
if (PrintLevel >= 2)
{
lgth = GetReadLength(); // ReadLength, as opposed to UsableLength
if (lgth == 0xffffffff)
{
- st = gdcmUtil::Format("x(ffff)"); // I said : "x(ffff)" !
+ st = Util::Format("x(ffff)"); // I said : "x(ffff)" !
s.setf(std::ios::left);
s << std::setw(10-st.size()) << " ";
s << st << " ";
}
else
{
- st = gdcmUtil::Format("x(%x)",lgth);
+ st = Util::Format("x(%x)",lgth);
s.setf(std::ios::left);
s << std::setw(10-st.size()) << " ";
s << st << " ";
s << std::setw(8) << lgth;
}
s << " Off.: ";
- st = gdcmUtil::Format("x(%x)",o);
+ st = Util::Format("x(%x)",o);
s << std::setw(10-st.size()) << " ";
s << st << " ";
s << std::setw(8) << o;
}
/**
- * \ingroup gdcmDocEntry
- * \brief Writes the common part of any gdcmValEntry, gdcmBinEntry, gdcmSeqEntry
+ * \ingroup DocEntry
+ * \brief Writes the common part of any ValEntry, BinEntry, SeqEntry
* @param fp already open file pointer
* @param filetype type of the file to be written
*/
-void gdcmDocEntry::Write(FILE* fp, FileType filetype)
+void DocEntry::Write(FILE* fp, FileType filetype)
{
uint32_t ffff = 0xffffffff;
uint16_t group = GetGroup();
- gdcmVRKey vr = GetVR();
+ VRKey vr = GetVR();
uint16_t el = GetElement();
uint32_t lgr = GetReadLength();
fwrite ( &group,(size_t)2 ,(size_t)1 ,fp); //group
fwrite ( &el, (size_t)2 ,(size_t)1 ,fp); //element
- if ( filetype == gdcmExplicitVR )
+ if ( filetype == ExplicitVR )
{
// Special case of delimiters:
if (group == 0xfffe)
// Public
/**
- * \ingroup gdcmDocEntry
+ * \ingroup DocEntry
* \brief Gets the full length of the elementary DocEntry (not only value
* length) depending on the VR.
*/
-uint32_t gdcmDocEntry::GetFullLength()
+uint32_t DocEntry::GetFullLength()
{
uint32_t l = GetReadLength();
if ( IsImplicitVR() )
}
/**
- * \ingroup gdcmDocEntry
+ * \ingroup DocEntry
* \brief Copies all the attributes from an other DocEntry
*/
-void gdcmDocEntry::Copy (gdcmDocEntry* e)
+void DocEntry::Copy (DocEntry* e)
{
- DictEntry = e->DictEntry;
+ DicomDict = e->DicomDict;
UsableLength = e->UsableLength;
ReadLength = e->ReadLength;
ImplicitVR = e->ImplicitVR;
Offset = e->Offset;
PrintLevel = e->PrintLevel;
- // TODO : remove gdcmDocEntry SQDepth
+ // TODO : remove DocEntry SQDepth
}
/**
- * \ingroup gdcmDocEntry
+ * \ingroup DocEntry
* \brief tells us if entry is the last one of a 'no length' SequenceItem
* (fffe,e00d)
*/
-bool gdcmDocEntry::IsItemDelimitor()
+bool DocEntry::IsItemDelimitor()
{
return (GetGroup() == 0xfffe && GetElement() == 0xe00d);
}
/**
- * \ingroup gdcmDocEntry
+ * \ingroup DocEntry
* \brief tells us if entry is the last one of a 'no length' Sequence
* (fffe,e0dd)
*/
-bool gdcmDocEntry::IsSequenceDelimitor()
+bool DocEntry::IsSequenceDelimitor()
{
return (GetGroup() == 0xfffe && GetElement() == 0xe0dd);
}
// Private
//-----------------------------------------------------------------------------
+
+} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmDocEntry.h,v $
Language: C++
- Date: $Date: 2004/10/08 04:52:55 $
- Version: $Revision: 1.24 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ Version: $Revision: 1.25 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDictEntry.h"
#include <iostream>
-class gdcmHeader;
-class gdcmValEntry;
-class gdcmBinEntry;
-class gdcmSeqEntry;
+class Header;
+class ValEntry;
+class BinEntry;
+class SeqEntry;
+
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
/**
- * \ingroup gdcmDocEntry
+ * \ingroup DocEntry
* \brief The dicom header of a Dicom file contains a set of such entries
* (when successfuly parsed against a given Dicom dictionary)
*/
-class GDCM_EXPORT gdcmDocEntry
+class GDCM_EXPORT DocEntry
{
public:
- gdcmDocEntry(gdcmDictEntry*);
- virtual ~gdcmDocEntry() {};
+ DocEntry(DictEntry*);
+ virtual ~DocEntry() {};
/// Returns the Dicom Group number of the current Dicom Header Entry
- uint16_t GetGroup() { return DictEntry->GetGroup(); };
+ uint16_t GetGroup() { return DicomDict->GetGroup(); };
/// Returns the Dicom Element number of the current Dicom Header Entry
- uint16_t GetElement() { return DictEntry->GetElement();};
+ uint16_t GetElement() { return DicomDict->GetElement();};
/// Returns the 'key' of the current Dicom Header Entry
- void SetKey( gdcmTagKey key ) { Key = key; }
+ void SetKey( TagKey key ) { Key = key; }
/// Returns the 'key' of the current Dicom Header Entry
std::string GetKey() { return Key; }
/// \brief Returns the 'Name' '(e.g. "Patient's Name") found in the Dicom
/// Dictionnary of the current Dicom Header Entry
- std::string GetName() { return DictEntry->GetName(); };
+ std::string GetName() { return DicomDict->GetName(); };
/// \brief Returns the 'Value Representation' (e.g. "PN" : Person Name,
/// "SL" : Signed Long), found in the Dicom Header or in the Dicom
/// Dictionnary, of the current Dicom Header Entry
- std::string GetVR() { return DictEntry->GetVR(); };
+ std::string GetVR() { return DicomDict->GetVR(); };
/// \brief Returns offset (since the beginning of the file, including
/// the File Preamble, if any) of the value of the current Dicom HeaderEntry
uint32_t GetReadLength() { return ReadLength; };
/// Sets the 'Value Representation' of the current Dicom Header Entry
- void SetVR(std::string const & v) { DictEntry->SetVR(v); };
+ void SetVR(std::string const & v) { DicomDict->SetVR(v); };
/// \brief Sets both 'Read Length' and 'Usable Length' of the current
/// Dicom Header Entry
/// \brief Tells us if the VR of the current Dicom Element is Unknown
/// @return true if the VR is unknown
- bool IsVRUnknown() { return DictEntry->IsVRUnknown(); };
+ bool IsVRUnknown() { return DicomDict->IsVRUnknown(); };
/// \brief Sets the DicEntry of the current Dicom Element
/// @param newEntry pointer to the DictEntry
- void SetDictEntry(gdcmDictEntry *newEntry) { DictEntry = newEntry; };
+ void SetDictEntry(DictEntry *newEntry) { DicomDict = newEntry; };
/// \brief Gets the DicEntry of the current Dicom Element
/// @return The DicEntry of the current Dicom Element
- gdcmDictEntry * GetDictEntry() { return DictEntry; };
+ DictEntry * GetDictEntry() { return DicomDict; };
/// \brief Sets the print level for the Dicom Header Elements
/// \note 0 for Light Print; 1 for 'medium' Print, 2 for Heavy
uint32_t GetFullLength();
- void Copy(gdcmDocEntry *doc);
+ void Copy(DocEntry *doc);
bool IsItemDelimitor();
bool IsSequenceDelimitor();
private:
// FIXME: In fact we should be more specific and use :
- // friend gdcmDocEntry * gdcmHeader::ReadNextElement(void);
- friend class gdcmHeader;
+ // friend DocEntry * Header::ReadNextElement(void);
+ friend class Header;
protected:
// Variables
/// \brief pointer to the underlying Dicom dictionary element
- gdcmDictEntry *DictEntry;
+ DictEntry *DicomDict;
/// \brief Updated from ReadLength, by FixFoungLentgh() for fixing a bug
/// in the header or helping the parser going on
/// How many details are to be printed (value : 0,1,2)
int PrintLevel;
- /// \brief Generalized key (i.e. a gdcmBaseTagKey prepending a gdcmTagKey)
- /// of this gdcmDocEntry
- gdcmTagKey Key;
+ /// \brief Generalized key (i.e. a BaseTagKey prepending a TagKey)
+ /// of this DocEntry
+ TagKey Key;
};
-
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmDocEntrySet.cxx,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:06 $
- Version: $Revision: 1.23 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ Version: $Revision: 1.24 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
+#include "gdcmDocEntrySet.h"
#include "gdcmDebug.h"
#include "gdcmCommon.h"
#include "gdcmGlobal.h"
-#include "gdcmDocEntrySet.h"
#include "gdcmException.h"
#include "gdcmDocEntry.h"
#include "gdcmSeqEntry.h"
#include "gdcmValEntry.h"
#include "gdcmBinEntry.h"
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
// Public
* @param group group number of the underlying DictEntry
* @param elem element number of the underlying DictEntry
*/
-gdcmValEntry *gdcmDocEntrySet::NewValEntryByNumber(uint16_t group,
- uint16_t elem)
+ValEntry *DocEntrySet::NewValEntryByNumber(uint16_t group,
+ uint16_t elem)
{
// Find out if the tag we encountered is in the dictionaries:
- gdcmDictEntry *dictEntry = GetDictEntryByNumber(group, elem);
+ DictEntry *dictEntry = GetDictEntryByNumber(group, elem);
if (!dictEntry)
{
dictEntry = NewVirtualDictEntry(group, elem);
}
- gdcmValEntry *newEntry = new gdcmValEntry(dictEntry);
+ ValEntry *newEntry = new ValEntry(dictEntry);
if (!newEntry)
{
- dbg.Verbose(1, "gdcmDocument::NewValEntryByNumber",
- "failed to allocate gdcmValEntry");
+ dbg.Verbose(1, "Document::NewValEntryByNumber",
+ "failed to allocate ValEntry");
return 0;
}
return newEntry;
* @param group group number of the underlying DictEntry
* @param elem element number of the underlying DictEntry
*/
-gdcmBinEntry *gdcmDocEntrySet::NewBinEntryByNumber(uint16_t group,
- uint16_t elem)
+BinEntry *DocEntrySet::NewBinEntryByNumber(uint16_t group,
+ uint16_t elem)
{
// Find out if the tag we encountered is in the dictionaries:
- gdcmDictEntry *dictEntry = GetDictEntryByNumber(group, elem);
+ DictEntry *dictEntry = GetDictEntryByNumber(group, elem);
if (!dictEntry)
{
dictEntry = NewVirtualDictEntry(group, elem);
}
- gdcmBinEntry *newEntry = new gdcmBinEntry(dictEntry);
+ BinEntry *newEntry = new BinEntry(dictEntry);
if (!newEntry)
{
- dbg.Verbose(1, "gdcmDocument::NewBinEntryByNumber",
- "failed to allocate gdcmBinEntry");
+ dbg.Verbose(1, "Document::NewBinEntryByNumber",
+ "failed to allocate BinEntry");
return 0;
}
return newEntry;
* @param Group group number of the underlying DictEntry
* @param Elem element number of the underlying DictEntry
*/
-gdcmSeqEntry* gdcmDocEntrySet::NewSeqEntryByNumber(uint16_t Group,
+SeqEntry* DocEntrySet::NewSeqEntryByNumber(uint16_t Group,
uint16_t Elem)
{
// Find out if the tag we encountered is in the dictionaries:
- gdcmDictEntry* DictEntry = GetDictEntryByNumber( Group, Elem );
+ DictEntry* DictEntry = GetDictEntryByNumber( Group, Elem );
if ( ! DictEntry )
{
DictEntry = NewVirtualDictEntry(Group, Elem);
}
- gdcmSeqEntry *NewEntry = new gdcmSeqEntry( DictEntry );
+ SeqEntry *NewEntry = new SeqEntry( DictEntry );
if ( !NewEntry )
{
- dbg.Verbose(1, "gdcmDocument::NewSeqEntryByNumber",
- "failed to allocate gdcmSeqEntry");
+ dbg.Verbose(1, "Document::NewSeqEntryByNumber",
+ "failed to allocate SeqEntry");
return 0;
}
return NewEntry;
* \brief Gets a Dicom Element inside a SQ Item Entry, by name
* @return
*/
- gdcmDocEntry *gdcmDocEntrySet::GetDocEntryByName(std::string const & name)
+ DocEntry *DocEntrySet::GetDocEntryByName(std::string const & name)
{
- gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
- gdcmDictEntry *dictEntry = pubDict->GetDictEntryByName(name);
+ Dict *pubDict = Global::GetDicts()->GetDefaultPubDict();
+ DictEntry *dictEntry = pubDict->GetDictEntryByName(name);
if( !dictEntry )
{
return 0;
* @return
*/
-std::string gdcmDocEntrySet::GetEntryByName(TagName const & name)
+std::string DocEntrySet::GetEntryByName(TagName const & name)
{
- gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
- gdcmDictEntry *dictEntry = pubDict->GetDictEntryByName(name);
+ Dict *pubDict = Global::GetDicts()->GetDefaultPubDict();
+ DictEntry *dictEntry = pubDict->GetDictEntryByName(name);
if( !dictEntry )
{
* @param fourth owner group
* @param name english name
*/
-gdcmDictEntry* gdcmDocEntrySet::NewVirtualDictEntry(uint16_t group,
+DictEntry* DocEntrySet::NewVirtualDictEntry(uint16_t group,
uint16_t element,
std::string const & vr,
std::string const & fourth,
std::string const & name)
{
- return gdcmGlobal::GetDicts()->NewVirtualDictEntry(group,element,vr,fourth,name);
+ return Global::GetDicts()->NewVirtualDictEntry(group,element,vr,fourth,name);
}
/** \brief
* @param group group number of the underlying DictEntry
* @param elem elem number of the underlying DictEntry
*/
-gdcmDocEntry* gdcmDocEntrySet::NewDocEntryByNumber(uint16_t group,
+DocEntry* DocEntrySet::NewDocEntryByNumber(uint16_t group,
uint16_t elem)
{
// Find out if the tag we encountered is in the dictionaries:
- gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
- gdcmDictEntry *dictEntry = pubDict->GetDictEntryByNumber(group, elem);
+ Dict *pubDict = Global::GetDicts()->GetDefaultPubDict();
+ DictEntry *dictEntry = pubDict->GetDictEntryByNumber(group, elem);
if (!dictEntry)
{
dictEntry = NewVirtualDictEntry(group, elem);
}
- gdcmDocEntry *newEntry = new gdcmDocEntry(dictEntry);
+ DocEntry *newEntry = new DocEntry(dictEntry);
if (!newEntry)
{
- dbg.Verbose(1, "gdcmSQItem::NewDocEntryByNumber",
- "failed to allocate gdcmDocEntry");
+ dbg.Verbose(1, "SQItem::NewDocEntryByNumber",
+ "failed to allocate DocEntry");
return 0;
}
return newEntry;
* @param VR V(alue) R(epresentation) of the Entry -if private Entry-
*/
-gdcmDocEntry* gdcmDocEntrySet::NewDocEntryByNumber(uint16_t group,
+DocEntry* DocEntrySet::NewDocEntryByNumber(uint16_t group,
uint16_t elem,
std::string const &VR)
{
// Find out if the tag we encountered is in the dictionaries:
- gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
- gdcmDictEntry *dictEntry = pubDict->GetDictEntryByNumber(group, elem);
+ Dict *pubDict = Global::GetDicts()->GetDefaultPubDict();
+ DictEntry *dictEntry = pubDict->GetDictEntryByNumber(group, elem);
if (!dictEntry)
{
dictEntry = NewVirtualDictEntry(group, elem, VR);
}
- gdcmDocEntry *newEntry = new gdcmDocEntry(dictEntry);
+ DocEntry *newEntry = new DocEntry(dictEntry);
if (!newEntry)
{
- dbg.Verbose(1, "gdcmSQItem::NewDocEntryByNumber",
- "failed to allocate gdcmDocEntry");
+ dbg.Verbose(1, "SQItem::NewDocEntryByNumber",
+ "failed to allocate DocEntry");
return 0;
}
return newEntry;
}
/* \brief
- * Probabely move, as is, to gdcmDocEntrySet, as a non virtual method
- * an remove gdcmDocument::NewDocEntryByName
+ * Probabely move, as is, to DocEntrySet, as a non virtual method
+ * an remove Document::NewDocEntryByName
*/
-gdcmDocEntry *gdcmDocEntrySet::NewDocEntryByName (std::string const & name)
+DocEntry *DocEntrySet::NewDocEntryByName (std::string const & name)
{
- gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
- gdcmDictEntry *newTag = pubDict->GetDictEntryByName(name);
+ Dict *pubDict = Global::GetDicts()->GetDefaultPubDict();
+ DictEntry *newTag = pubDict->GetDictEntryByName(name);
if (!newTag)
{
newTag = NewVirtualDictEntry(0xffff, 0xffff, "LO", "unkn", name);
}
- gdcmDocEntry* newEntry = new gdcmDocEntry(newTag);
+ DocEntry* newEntry = new DocEntry(newTag);
if (!newEntry)
{
- dbg.Verbose(1, "gdcmSQItem::ObtainDocEntryByName",
- "failed to allocate gdcmDocEntry");
+ dbg.Verbose(1, "SQItem::ObtainDocEntryByName",
+ "failed to allocate DocEntry");
return 0;
}
* @param name Name of the searched DictEntry
* @return Corresponding DictEntry when it exists, NULL otherwise.
*/
-gdcmDictEntry *gdcmDocEntrySet::GetDictEntryByName(std::string const & name)
+DictEntry *DocEntrySet::GetDictEntryByName(std::string const & name)
{
- gdcmDictEntry *found = 0;
- gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
+ DictEntry *found = 0;
+ Dict *pubDict = Global::GetDicts()->GetDefaultPubDict();
if (!pubDict)
{
- dbg.Verbose(0, "gdcmDocument::GetDictEntry",
+ dbg.Verbose(0, "Document::GetDictEntry",
"we SHOULD have a default dictionary");
}
else
* @param element element number of the searched DictEntry
* @return Corresponding DictEntry when it exists, NULL otherwise.
*/
-gdcmDictEntry *gdcmDocEntrySet::GetDictEntryByNumber(uint16_t group,
+DictEntry *DocEntrySet::GetDictEntryByNumber(uint16_t group,
uint16_t element)
{
- gdcmDictEntry *found = 0;
- gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
+ DictEntry *found = 0;
+ Dict *pubDict = Global::GetDicts()->GetDefaultPubDict();
if (!pubDict)
{
- dbg.Verbose(0, "gdcmDocument::GetDictEntry",
+ dbg.Verbose(0, "Document::GetDictEntry",
"we SHOULD have a default dictionary");
}
else
//-----------------------------------------------------------------------------
// Private
+} // end namespace gdcm
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmDocEntrySet.h,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:06 $
- Version: $Revision: 1.19 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ Version: $Revision: 1.20 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#define GDCMDOCENTRYSET_H
#include "gdcmException.h"
-#include "gdcmDocEntry.h"
-
-typedef std::string gdcmBaseTagKey;
+
+namespace gdcm
+{
+class DocEntry;
+class ValEntry;
+class BinEntry;
+class SeqEntry;
+class DictEntry;
+
+typedef std::string BaseTagKey;
//-----------------------------------------------------------------------------
/**
- * \ref gdcmDocEntrySet is an abstract base class for \ref gdcmElementSet
- * and \ref gdcmSQItem which are both containers for gdcmDocEntries.
- * \ref gdcmElementSet is based on the STL map<> container
- * (see \ref gdcmElementSet::TagHT), as opposed to \ref gdcmSQItem
- * which is based on an STL list container (see \ref gdcmSQItem::docEntries).
+ * \ref DocEntrySet is an abstract base class for \ref ElementSet
+ * and \ref SQItem which are both containers for DocEntries.
+ * \ref ElementSet is based on the STL map<> container
+ * (see \ref ElementSet::TagHT), as opposed to \ref SQItem
+ * which is based on an STL list container (see \ref SQItem::docEntries).
* Since the syntax for adding a new element to a map<> or a list<>
- * differ, \ref gdcmDocEntrySet is designed as an adapter to unify the
- * interfaces of \ref gdcmDocEntrySet and \ref gdcmElementSet.
+ * differ, \ref DocEntrySet is designed as an adapter to unify the
+ * interfaces of \ref DocEntrySet and \ref ElementSet.
* As an illustration of this design, please refer to the implementation
* of \ref AddEntry (or any pure virtual method) in both derived classes.
* This adapter unification of interfaces enables the parsing of a
* DICOM header containing (optionaly heavily nested) sequences to be
- * written recursively [see \ref gdcmDocument::ParseDES
- * which calls \ref gdcmDocument::ParseSQ, which in turns calls
- * \ref gdcmDocument::ParseDES ].
+ * written recursively [see \ref Document::ParseDES
+ * which calls \ref Document::ParseSQ, which in turns calls
+ * \ref Document::ParseDES ].
*
* \note Developpers should strongly resist to the temptation of adding
* members to this class since this class is designed as an adapter
* in the form of an abstract base class.
*/
-class GDCM_EXPORT gdcmDocEntrySet
+class GDCM_EXPORT DocEntrySet
{
public:
-
- gdcmDocEntrySet() {}
- virtual ~gdcmDocEntrySet() {}
+ DocEntrySet() {};
+ virtual ~DocEntrySet() {};
/// \brief adds any type of entry to the entry set (pure vitual)
- virtual bool AddEntry(gdcmDocEntry *Entry) = 0; // pure virtual
+ virtual bool AddEntry(DocEntry *Entry) = 0; // pure virtual
/// \brief prints any type of entry to the entry set (pure vitual)
virtual void Print (std::ostream & os = std::cout) = 0;// pure virtual
/// \brief write any type of entry to the entry set
virtual void Write (FILE *fp, FileType filetype) = 0;// pure virtual
- virtual gdcmDocEntry* GetDocEntryByNumber(uint16_t group,
+ virtual DocEntry* GetDocEntryByNumber(uint16_t group,
uint16_t element) = 0;
- gdcmDocEntry *GetDocEntryByName(std::string const & name);
+ DocEntry *GetDocEntryByName(std::string const & name);
virtual std::string GetEntryByNumber(uint16_t group,uint16_t element) = 0;
std::string GetEntryByName(TagName const & name);
- gdcmDictEntry *NewVirtualDictEntry(uint16_t group,
- uint16_t element,
- std::string const & vr = "unkn",
- std::string const & fourth = "unkn",
- std::string const & name = "unkn");
+ DictEntry *NewVirtualDictEntry(uint16_t group,
+ uint16_t element,
+ std::string const & vr = "unkn",
+ std::string const & fourth = "unkn",
+ std::string const & name = "unkn");
protected:
// DocEntry related utilities
- gdcmValEntry* NewValEntryByNumber(uint16_t group,
- uint16_t element);
- gdcmBinEntry* NewBinEntryByNumber(uint16_t group,
- uint16_t element);
- gdcmDocEntry* NewDocEntryByNumber(uint16_t group,
- uint16_t element);
- gdcmDocEntry* NewDocEntryByNumber(uint16_t group,
- uint16_t element,
- std::string const & VR);
- gdcmDocEntry* NewDocEntryByName (std::string const & name);
- gdcmSeqEntry* NewSeqEntryByNumber(uint16_t group,
- uint16_t element);
+ ValEntry* NewValEntryByNumber(uint16_t group,
+ uint16_t element);
+ BinEntry* NewBinEntryByNumber(uint16_t group,
+ uint16_t element);
+ DocEntry* NewDocEntryByNumber(uint16_t group,
+ uint16_t element);
+ DocEntry* NewDocEntryByNumber(uint16_t group,
+ uint16_t element,
+ std::string const & VR);
+ DocEntry* NewDocEntryByName (std::string const & name);
+ SeqEntry* NewSeqEntryByNumber(uint16_t group,
+ uint16_t element);
// DictEntry related utilities
- gdcmDictEntry *GetDictEntryByName (std::string const & name);
- gdcmDictEntry *GetDictEntryByNumber(uint16_t, uint16_t);
+ DictEntry *GetDictEntryByName (std::string const & name);
+ DictEntry *GetDictEntryByNumber(uint16_t, uint16_t);
};
-
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2004/10/10 16:43:59 $
- Version: $Revision: 1.102 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ Version: $Revision: 1.103 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <iomanip>
+namespace gdcm
+{
+
// Implicit VR Little Endian
#define UI1_2_840_10008_1_2 "1.2.840.10008.1.2"
// Explicit VR Little Endian
#define str2num(str, typeNum) *((typeNum *)(str))
//-----------------------------------------------------------------------------
-// Refer to gdcmDocument::CheckSwap()
-const unsigned int gdcmDocument::HEADER_LENGTH_TO_READ = 256;
+// Refer to Document::CheckSwap()
+const unsigned int Document::HEADER_LENGTH_TO_READ = 256;
-// Refer to gdcmDocument::SetMaxSizeLoadEntry()
-const unsigned int gdcmDocument::MAX_SIZE_LOAD_ELEMENT_VALUE = 0xfff; // 4096
-const unsigned int gdcmDocument::MAX_SIZE_PRINT_ELEMENT_VALUE = 0x7fffffff;
+// Refer to Document::SetMaxSizeLoadEntry()
+const unsigned int Document::MAX_SIZE_LOAD_ELEMENT_VALUE = 0xfff; // 4096
+const unsigned int Document::MAX_SIZE_PRINT_ELEMENT_VALUE = 0x7fffffff;
//-----------------------------------------------------------------------------
// Constructor / Destructor
* \brief constructor
* @param filename file to be opened for parsing
*/
-gdcmDocument::gdcmDocument( std::string const & filename )
- : gdcmElementSet(-1)
+Document::Document( std::string const & filename )
+ : ElementSet(-1)
{
SetMaxSizeLoadEntry(MAX_SIZE_LOAD_ELEMENT_VALUE);
Filename = filename;
return;
}
- dbg.Verbose(0, "gdcmDocument::gdcmDocument: starting parsing of file: ",
+ dbg.Verbose(0, "Document::Document: starting parsing of file: ",
Filename.c_str());
rewind(Fp);
/// defined as having an US Value Representation in the public
/// dictionnary. BUT the semantics implied by the three following
/// lines state that the corresponding tag contents are in fact
- /// the ones of a gdcmBinEntry.
+ /// the ones of a BinEntry.
/// In order to fix things "Quick and Dirty" the dictionnary was
/// altered on PURPOUS but now contains a WRONG value.
/// In order to fix things and restore the dictionary to its
/// correct value, one needs to decided of the semantics by deciding
/// wether the following tags are either:
- /// - multivaluated US, and hence loaded as gdcmValEntry, but afterwards
- /// also used as gdcmBinEntry, which requires the proper conversion,
- /// - OW, and hence loaded as gdcmBinEntry, but afterwards also used
- /// as gdcmValEntry, which requires the proper conversion.
+ /// - multivaluated US, and hence loaded as ValEntry, but afterwards
+ /// also used as BinEntry, which requires the proper conversion,
+ /// - OW, and hence loaded as BinEntry, but afterwards also used
+ /// as ValEntry, which requires the proper conversion.
LoadEntryBinArea(0x0028,0x1201); // R LUT
LoadEntryBinArea(0x0028,0x1202); // G LUT
LoadEntryBinArea(0x0028,0x1203); // B LUT
RecCode == "CANRME_AILIBOD1_1." ) // for brain-damaged softwares
// with "little-endian strings"
{
- Filetype = gdcmACR_LIBIDO;
+ Filetype = ACR_LIBIDO;
std::string rows = GetEntryByNumber(0x0028, 0x0010);
std::string columns = GetEntryByNumber(0x0028, 0x0011);
SetEntryByNumber(columns, 0x0028, 0x0010);
/**
* \brief This default constructor doesn't parse the file. You should
- * then invoke \ref gdcmDocument::SetFileName and then the parsing.
+ * then invoke \ref Document::SetFileName and then the parsing.
*/
-gdcmDocument::gdcmDocument()
- :gdcmElementSet(-1)
+Document::Document()
+ :ElementSet(-1)
{
SetMaxSizeLoadEntry(MAX_SIZE_LOAD_ELEMENT_VALUE);
Initialise();
/**
* \brief Canonical destructor.
*/
-gdcmDocument::~gdcmDocument ()
+Document::~Document ()
{
RefPubDict = NULL;
RefShaDict = NULL;
* \brief Prints The Dict Entries of THE public Dicom Dictionary
* @return
*/
-void gdcmDocument::PrintPubDict(std::ostream & os)
+void Document::PrintPubDict(std::ostream & os)
{
RefPubDict->Print(os);
}
* \brief Prints The Dict Entries of THE shadow Dicom Dictionary
* @return
*/
-void gdcmDocument::PrintShaDict(std::ostream & os)
+void Document::PrintShaDict(std::ostream & os)
{
RefShaDict->Print(os);
}
/**
* \brief Get the public dictionary used
*/
-gdcmDict* gdcmDocument::GetPubDict()
+Dict* Document::GetPubDict()
{
return RefPubDict;
}
/**
* \brief Get the shadow dictionary used
*/
-gdcmDict* gdcmDocument::GetShaDict()
+Dict* Document::GetShaDict()
{
return RefShaDict;
}
* \brief Set the shadow dictionary used
* \param dict dictionary to use in shadow
*/
-bool gdcmDocument::SetShaDict(gdcmDict *dict)
+bool Document::SetShaDict(Dict *dict)
{
RefShaDict = dict;
return !RefShaDict;
* \brief Set the shadow dictionary used
* \param dictName name of the dictionary to use in shadow
*/
-bool gdcmDocument::SetShaDict(DictKey const & dictName)
+bool Document::SetShaDict(DictKey const & dictName)
{
- RefShaDict = gdcmGlobal::GetDicts()->GetDict(dictName);
+ RefShaDict = Global::GetDicts()->GetDict(dictName);
return !RefShaDict;
}
/**
* \brief This predicate, based on hopefully reasonable heuristics,
- * decides whether or not the current gdcmDocument was properly parsed
+ * decides whether or not the current Document was properly parsed
* and contains the mandatory information for being considered as
* a well formed and usable Dicom/Acr File.
- * @return true when gdcmDocument is the one of a reasonable Dicom/Acr file,
+ * @return true when Document is the one of a reasonable Dicom/Acr file,
* false otherwise.
*/
-bool gdcmDocument::IsReadable()
+bool Document::IsReadable()
{
- if( Filetype == gdcmUnknown)
+ if( Filetype == Unknown)
{
- dbg.Verbose(0, "gdcmDocument::IsReadable: wrong filetype");
+ dbg.Verbose(0, "Document::IsReadable: wrong filetype");
return false;
}
if( TagHT.empty() )
{
- dbg.Verbose(0, "gdcmDocument::IsReadable: no tags in internal"
+ dbg.Verbose(0, "Document::IsReadable: no tags in internal"
" hash table.");
return false;
}
* the current document. False either when the document contains
* no Transfer Syntax, or when the Tranfer Syntaxes doesn't match.
*/
-bool gdcmDocument::IsGivenTransferSyntax(std::string const & syntaxToCheck)
+bool Document::IsGivenTransferSyntax(std::string const & syntaxToCheck)
{
- gdcmDocEntry *entry = GetDocEntryByNumber(0x0002, 0x0010);
+ DocEntry *entry = GetDocEntryByNumber(0x0002, 0x0010);
if ( !entry )
{
return false;
// The entry might be present but not loaded (parsing and loading
// happen at different stages): try loading and proceed with check...
LoadDocEntrySafe(entry);
- if (gdcmValEntry* valEntry = dynamic_cast< gdcmValEntry* >(entry) )
+ if (ValEntry* valEntry = dynamic_cast< ValEntry* >(entry) )
{
std::string transfer = valEntry->GetValue();
// The actual transfer (as read from disk) might be padded. We
* \brief Determines if the Transfer Syntax of the present document
* corresponds to a Implicit Value Representation of
* Little Endian.
- * \sa \ref gdcmDocument::IsGivenTransferSyntax.
+ * \sa \ref Document::IsGivenTransferSyntax.
* @return True when ImplicitVRLittleEndian found. False in all other cases.
*/
-bool gdcmDocument::IsImplicitVRLittleEndianTransferSyntax()
+bool Document::IsImplicitVRLittleEndianTransferSyntax()
{
return IsGivenTransferSyntax(UI1_2_840_10008_1_2);
}
* and if it corresponds to a ExplicitVRLittleEndian one.
* @return True when ExplicitVRLittleEndian found. False in all other cases.
*/
-bool gdcmDocument::IsExplicitVRLittleEndianTransferSyntax()
+bool Document::IsExplicitVRLittleEndianTransferSyntax()
{
return IsGivenTransferSyntax(UI1_2_840_10008_1_2_1);
}
* and if it corresponds to a DeflatedExplicitVRLittleEndian one.
* @return True when DeflatedExplicitVRLittleEndian found. False in all other cases.
*/
-bool gdcmDocument::IsDeflatedExplicitVRLittleEndianTransferSyntax()
+bool Document::IsDeflatedExplicitVRLittleEndianTransferSyntax()
{
return IsGivenTransferSyntax(UI1_2_840_10008_1_2_1_99);
}
* and if it corresponds to a Explicit VR Big Endian one.
* @return True when big endian found. False in all other cases.
*/
-bool gdcmDocument::IsExplicitVRBigEndianTransferSyntax()
+bool Document::IsExplicitVRBigEndianTransferSyntax()
{
return IsGivenTransferSyntax(UI1_2_840_10008_1_2_2);
}
* and if it corresponds to a JPEGBaseLineProcess1 one.
* @return True when JPEGBaseLineProcess1found. False in all other cases.
*/
-bool gdcmDocument::IsJPEGBaseLineProcess1TransferSyntax()
+bool Document::IsJPEGBaseLineProcess1TransferSyntax()
{
return IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_50);
}
* and if it corresponds to a JPEGExtendedProcess2-4 one.
* @return True when JPEGExtendedProcess2-4 found. False in all other cases.
*/
-bool gdcmDocument::IsJPEGExtendedProcess2_4TransferSyntax()
+bool Document::IsJPEGExtendedProcess2_4TransferSyntax()
{
return IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_51);
}
* and if it corresponds to a JPEGExtendeProcess3-5 one.
* @return True when JPEGExtendedProcess3-5 found. False in all other cases.
*/
-bool gdcmDocument::IsJPEGExtendedProcess3_5TransferSyntax()
+bool Document::IsJPEGExtendedProcess3_5TransferSyntax()
{
return IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_52);
}
* @return True when JPEGSpectralSelectionProcess6-8 found. False in all
* other cases.
*/
-bool gdcmDocument::IsJPEGSpectralSelectionProcess6_8TransferSyntax()
+bool Document::IsJPEGSpectralSelectionProcess6_8TransferSyntax()
{
return IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_53);
}
* @return True when RLE Lossless found. False in all
* other cases.
*/
-bool gdcmDocument::IsRLELossLessTransferSyntax()
+bool Document::IsRLELossLessTransferSyntax()
{
return IsGivenTransferSyntax(UI1_2_840_10008_1_2_5);
}
* other cases.
*/
-bool gdcmDocument::IsJPEGLossless()
+bool Document::IsJPEGLossless()
{
return ( IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_55)
|| IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_57)
* @return True when JPEG2000 (Lossly or LossLess) found. False in all
* other cases.
*/
-bool gdcmDocument::IsJPEG2000()
+bool Document::IsJPEG2000()
{
return ( IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_90)
|| IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_91) );
* of Jpeg encoded Pixel data.
* @return True when any form of JPEG found. False otherwise.
*/
-bool gdcmDocument::IsJPEGTransferSyntax()
+bool Document::IsJPEGTransferSyntax()
{
return ( IsJPEGBaseLineProcess1TransferSyntax()
|| IsJPEGExtendedProcess2_4TransferSyntax()
* of encoded Pixel Data (as opposed to native).
* @return True when encapsulated. False when native.
*/
-bool gdcmDocument::IsEncapsulateTransferSyntax()
+bool Document::IsEncapsulateTransferSyntax()
{
return ( IsJPEGTransferSyntax()
|| IsRLELossLessTransferSyntax() );
* \brief Predicate for dicom version 3 file.
* @return True when the file is a dicom version 3.
*/
-bool gdcmDocument::IsDicomV3()
+bool Document::IsDicomV3()
{
// Checking if Transfert Syntax exists is enough
// Anyway, it's to late check if the 'Preamble' was found ...
* (ACR, ACR_LIBIDO, ExplicitVR, ImplicitVR, Unknown)
* @return the FileType code
*/
-FileType gdcmDocument::GetFileType()
+FileType Document::GetFileType()
{
return Filetype;
}
/**
- * \brief Tries to open the file \ref gdcmDocument::Filename and
+ * \brief Tries to open the file \ref Document::Filename and
* checks the preamble when existing.
* @return The FILE pointer on success.
*/
-FILE* gdcmDocument::OpenFile()
+FILE* Document::OpenFile()
{
Fp = fopen(Filename.c_str(),"rb");
if(!Fp)
{
dbg.Verbose( 0,
- "gdcmDocument::OpenFile cannot open file: ",
+ "Document::OpenFile cannot open file: ",
Filename.c_str());
return 0;
}
fclose(Fp);
dbg.Verbose( 0,
- "gdcmDocument::OpenFile not DICOM/ACR (missing preamble)",
+ "Document::OpenFile not DICOM/ACR (missing preamble)",
Filename.c_str());
return 0;
* \brief closes the file
* @return TRUE if the close was successfull
*/
-bool gdcmDocument::CloseFile()
+bool Document::CloseFile()
{
int closed = fclose(Fp);
Fp = 0;
* (ACR-NEMA, ExplicitVR, ImplicitVR)
* \return Always true.
*/
-void gdcmDocument::Write(FILE* fp,FileType filetype)
+void Document::Write(FILE* fp,FileType filetype)
{
/// \todo move the following lines (and a lot of others, to be written)
/// to a future function CheckAndCorrectHeader
/// (necessary if user wants to write a DICOM V3 file
- /// starting from an ACR-NEMA (V2) gdcmHeader
+ /// starting from an ACR-NEMA (V2) Header
- if (filetype == gdcmImplicitVR)
+ if (filetype == ImplicitVR)
{
std::string implicitVRTransfertSyntax = UI1_2_840_10008_1_2;
ReplaceOrCreateByNumber(implicitVRTransfertSyntax,0x0002, 0x0010);
SetEntryLengthByNumber(18, 0x0002, 0x0010);
}
- if (filetype == gdcmExplicitVR)
+ if (filetype == ExplicitVR)
{
std::string explicitVRTransfertSyntax = UI1_2_840_10008_1_2_1;
ReplaceOrCreateByNumber(explicitVRTransfertSyntax,0x0002, 0x0010);
* UpdateGroupLength(true,ACR);
*/
- gdcmElementSet::Write(fp, filetype); // This one is recursive
+ ElementSet::Write(fp, filetype); // This one is recursive
}
* \return pointer to the modified/created Header Entry (NULL when creation
* failed).
*/
-gdcmValEntry* gdcmDocument::ReplaceOrCreateByNumber(
+ValEntry* Document::ReplaceOrCreateByNumber(
std::string const & value,
uint16_t group,
uint16_t elem,
std::string const & VR )
{
- gdcmValEntry* valEntry = 0;
- gdcmDocEntry* currentEntry = GetDocEntryByNumber( group, elem);
+ ValEntry* valEntry = 0;
+ DocEntry* currentEntry = GetDocEntryByNumber( group, elem);
if (!currentEntry)
{
// check if (group,element) DictEntry exists
- // if it doesn't, create an entry in gdcmDictSet::VirtualEntry
+ // if it doesn't, create an entry in DictSet::VirtualEntry
// and use it
// Find out if the tag we received is in the dictionaries:
- gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
- gdcmDictEntry* dictEntry = pubDict->GetDictEntryByNumber(group, elem);
+ Dict *pubDict = Global::GetDicts()->GetDefaultPubDict();
+ DictEntry* dictEntry = pubDict->GetDictEntryByNumber(group, elem);
if (!dictEntry)
{
currentEntry = NewDocEntryByNumber(group, elem,VR);
if (!currentEntry)
{
- dbg.Verbose(0, "gdcmDocument::ReplaceOrCreateByNumber: call to"
+ dbg.Verbose(0, "Document::ReplaceOrCreateByNumber: call to"
" NewDocEntryByNumber failed.");
return NULL;
}
- valEntry = new gdcmValEntry(currentEntry);
+ valEntry = new ValEntry(currentEntry);
if ( !AddEntry(valEntry))
{
- dbg.Verbose(0, "gdcmDocument::ReplaceOrCreateByNumber: AddEntry"
+ dbg.Verbose(0, "Document::ReplaceOrCreateByNumber: AddEntry"
" failed allthough this is a creation.");
}
}
else
{
- valEntry = dynamic_cast< gdcmValEntry* >(currentEntry);
+ valEntry = dynamic_cast< ValEntry* >(currentEntry);
if ( !valEntry ) // Euuuuh? It wasn't a ValEntry
// then we change it to a ValEntry ?
// Shouldn't it be considered as an error ?
{
- // We need to promote the gdcmDocEntry to a gdcmValEntry:
- valEntry = new gdcmValEntry(currentEntry);
+ // We need to promote the DocEntry to a ValEntry:
+ valEntry = new ValEntry(currentEntry);
if (!RemoveEntry(currentEntry))
{
- dbg.Verbose(0, "gdcmDocument::ReplaceOrCreateByNumber: removal"
+ dbg.Verbose(0, "Document::ReplaceOrCreateByNumber: removal"
" of previous DocEntry failed.");
return NULL;
}
if ( !AddEntry(valEntry))
{
- dbg.Verbose(0, "gdcmDocument::ReplaceOrCreateByNumber: adding"
+ dbg.Verbose(0, "Document::ReplaceOrCreateByNumber: adding"
" promoted ValEntry failed.");
return NULL;
}
* \return pointer to the modified/created Header Entry (NULL when creation
* failed).
*/
-gdcmBinEntry* gdcmDocument::ReplaceOrCreateByNumber(
+BinEntry* Document::ReplaceOrCreateByNumber(
uint8_t* binArea,
int lgth,
uint16_t group,
uint16_t elem,
std::string const& VR )
{
- gdcmBinEntry* binEntry = 0;
- gdcmDocEntry* currentEntry = GetDocEntryByNumber( group, elem);
+ BinEntry* binEntry = 0;
+ DocEntry* currentEntry = GetDocEntryByNumber( group, elem);
if (!currentEntry)
{
// check if (group,element) DictEntry exists
- // if it doesn't, create an entry in gdcmDictSet::VirtualEntry
+ // if it doesn't, create an entry in DictSet::VirtualEntry
// and use it
// Find out if the tag we received is in the dictionaries:
- gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
- gdcmDictEntry *dictEntry = pubDict->GetDictEntryByNumber(group, elem);
+ Dict *pubDict = Global::GetDicts()->GetDefaultPubDict();
+ DictEntry *dictEntry = pubDict->GetDictEntryByNumber(group, elem);
if (!dictEntry)
{
}
if (!currentEntry)
{
- dbg.Verbose(0, "gdcmDocument::ReplaceOrCreateByNumber: call to"
+ dbg.Verbose(0, "Document::ReplaceOrCreateByNumber: call to"
" NewDocEntryByNumber failed.");
return NULL;
}
- binEntry = new gdcmBinEntry(currentEntry);
+ binEntry = new BinEntry(currentEntry);
if ( !AddEntry(binEntry))
{
- dbg.Verbose(0, "gdcmDocument::ReplaceOrCreateByNumber: AddEntry"
+ dbg.Verbose(0, "Document::ReplaceOrCreateByNumber: AddEntry"
" failed allthough this is a creation.");
}
}
else
{
- binEntry = dynamic_cast< gdcmBinEntry* >(currentEntry);
+ binEntry = dynamic_cast< BinEntry* >(currentEntry);
if ( !binEntry ) // Euuuuh? It wasn't a BinEntry
// then we change it to a BinEntry ?
// Shouldn't it be considered as an error ?
{
- // We need to promote the gdcmDocEntry to a gdcmBinEntry:
- binEntry = new gdcmBinEntry(currentEntry);
+ // We need to promote the DocEntry to a BinEntry:
+ binEntry = new BinEntry(currentEntry);
if (!RemoveEntry(currentEntry))
{
- dbg.Verbose(0, "gdcmDocument::ReplaceOrCreateByNumber: removal"
+ dbg.Verbose(0, "Document::ReplaceOrCreateByNumber: removal"
" of previous DocEntry failed.");
return NULL;
}
if ( !AddEntry(binEntry))
{
- dbg.Verbose(0, "gdcmDocument::ReplaceOrCreateByNumber: adding"
+ dbg.Verbose(0, "Document::ReplaceOrCreateByNumber: adding"
" promoted BinEntry failed.");
return NULL;
}
* \return pointer to the modified/created SeqEntry (NULL when creation
* failed).
*/
-gdcmSeqEntry* gdcmDocument::ReplaceOrCreateByNumber(
+SeqEntry* Document::ReplaceOrCreateByNumber(
uint16_t group,
uint16_t elem)
{
- gdcmSeqEntry* b = 0;
- gdcmDocEntry* a = GetDocEntryByNumber( group, elem);
+ SeqEntry* b = 0;
+ DocEntry* a = GetDocEntryByNumber( group, elem);
if (!a)
{
a = NewSeqEntryByNumber(group, elem);
return 0;
}
- b = new gdcmSeqEntry(a, 1); // FIXME : 1 (Depth)
+ b = new SeqEntry(a, 1); // FIXME : 1 (Depth)
AddEntry(b);
}
return b;
* @param elem element number of the Entry
* \return boolean
*/
-bool gdcmDocument::ReplaceIfExistByNumber(std::string const & value,
+bool Document::ReplaceIfExistByNumber(std::string const & value,
uint16_t group, uint16_t elem )
{
SetEntryByNumber(value, group, elem);
* @param element Element number of the searched Dicom Element
* @return true is found
*/
-bool gdcmDocument::CheckIfEntryExistByNumber(uint16_t group, uint16_t element )
+bool Document::CheckIfEntryExistByNumber(uint16_t group, uint16_t element )
{
- const std::string &key = gdcmDictEntry::TranslateToKey(group, element );
+ const std::string &key = DictEntry::TranslateToKey(group, element );
return TagHT.count(key);
}
* @return Corresponding element value when it exists,
* and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
*/
-std::string gdcmDocument::GetEntryByName(TagName const& tagName)
+std::string Document::GetEntryByName(TagName const& tagName)
{
- gdcmDictEntry* dictEntry = RefPubDict->GetDictEntryByName(tagName);
+ DictEntry* dictEntry = RefPubDict->GetDictEntryByName(tagName);
if( !dictEntry )
{
return GDCM_UNFOUND;
* @return Corresponding element value representation when it exists,
* and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
*/
-std::string gdcmDocument::GetEntryVRByName(TagName const& tagName)
+std::string Document::GetEntryVRByName(TagName const& tagName)
{
- gdcmDictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName);
+ DictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName);
if( dictEntry == NULL)
{
return GDCM_UNFOUND;
}
- gdcmDocEntry* elem = GetDocEntryByNumber(dictEntry->GetGroup(),
+ DocEntry* elem = GetDocEntryByNumber(dictEntry->GetGroup(),
dictEntry->GetElement());
return elem->GetVR();
}
* @return Corresponding element value representation when it exists,
* and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
*/
-std::string gdcmDocument::GetEntryByNumber(uint16_t group, uint16_t element)
+std::string Document::GetEntryByNumber(uint16_t group, uint16_t element)
{
- gdcmTagKey key = gdcmDictEntry::TranslateToKey(group, element);
+ TagKey key = DictEntry::TranslateToKey(group, element);
/// \todo use map methods, instead of multimap JPR
if ( !TagHT.count(key))
{
return GDCM_UNFOUND;
}
- return ((gdcmValEntry *)TagHT.find(key)->second)->GetValue();
+ return ((ValEntry *)TagHT.find(key)->second)->GetValue();
}
/**
* @return Corresponding element value representation when it exists,
* and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
*/
-std::string gdcmDocument::GetEntryVRByNumber(uint16_t group, uint16_t element)
+std::string Document::GetEntryVRByNumber(uint16_t group, uint16_t element)
{
- gdcmDocEntry* elem = GetDocEntryByNumber(group, element);
+ DocEntry* elem = GetDocEntryByNumber(group, element);
if ( !elem )
{
return GDCM_UNFOUND;
* @param element Element number of the searched tag.
* @return Corresponding element length; -2 if not found
*/
-int gdcmDocument::GetEntryLengthByNumber(uint16_t group, uint16_t element)
+int Document::GetEntryLengthByNumber(uint16_t group, uint16_t element)
{
- gdcmDocEntry* elem = GetDocEntryByNumber(group, element);
+ DocEntry* elem = GetDocEntryByNumber(group, element);
if ( !elem )
{
return -2; //magic number
* @param tagName name of the searched Dicom Element.
* @return true when found
*/
-bool gdcmDocument::SetEntryByName(std::string const & content,std::string const & tagName)
+bool Document::SetEntryByName(std::string const & content,std::string const & tagName)
{
- gdcmDictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName);
+ DictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName);
if( !dictEntry )
{
return false;
}
/**
- * \brief Accesses an existing gdcmDocEntry (i.e. a Dicom Element)
+ * \brief Accesses an existing DocEntry (i.e. a Dicom Element)
* through it's (group, element) and modifies it's content with
* the given value.
* @param content new value (string) to substitute with
* @param group group number of the Dicom Element to modify
* @param element element number of the Dicom Element to modify
*/
-bool gdcmDocument::SetEntryByNumber(std::string const& content,
+bool Document::SetEntryByNumber(std::string const& content,
uint16_t group,
uint16_t element)
{
int c;
int l;
- gdcmValEntry* valEntry = GetValEntryByNumber(group, element);
+ ValEntry* valEntry = GetValEntryByNumber(group, element);
if (!valEntry )
{
- dbg.Verbose(0, "gdcmDocument::SetEntryByNumber: no corresponding",
+ dbg.Verbose(0, "Document::SetEntryByNumber: no corresponding",
" ValEntry (try promotion first).");
return false;
}
l = finalContent.length();
if ( l != 0) // To avoid to be cheated by 'zero length' integers
{
- gdcmVRKey vr = valEntry->GetVR();
+ VRKey vr = valEntry->GetVR();
if( vr == "US" || vr == "SS" )
{
// for multivaluated items
- c = gdcmUtil::CountSubstring(content, "\\") + 1;
+ c = Util::CountSubstring(content, "\\") + 1;
l = c*2;
}
else if( vr == "UL" || vr == "SL" )
{
// for multivaluated items
- c = gdcmUtil::CountSubstring(content, "\\") + 1;
+ c = Util::CountSubstring(content, "\\") + 1;
l = c*4;;
}
}
}
/**
- * \brief Accesses an existing gdcmDocEntry (i.e. a Dicom Element)
+ * \brief Accesses an existing DocEntry (i.e. a Dicom Element)
* through it's (group, element) and modifies it's content with
* the given value.
* @param content new value (void* -> uint8_t*) to substitute with
* @param group group number of the Dicom Element to modify
* @param element element number of the Dicom Element to modify
*/
-bool gdcmDocument::SetEntryByNumber(uint8_t*content,
+bool Document::SetEntryByNumber(uint8_t*content,
int lgth,
uint16_t group,
uint16_t element)
{
(void)lgth; //not used
- gdcmTagKey key = gdcmDictEntry::TranslateToKey(group, element);
+ TagKey key = DictEntry::TranslateToKey(group, element);
if ( !TagHT.count(key))
{
return false;
//content = content + '\0'; // fing a trick to enlarge a binary field?
}
*/
- gdcmBinEntry* a = (gdcmBinEntry *)TagHT[key];
+ BinEntry* a = (BinEntry *)TagHT[key];
a->SetBinArea(content);
a->SetLength(lgth);
a->SetValue(GDCM_BINLOADED);
}
/**
- * \brief Accesses an existing gdcmDocEntry (i.e. a Dicom Element)
+ * \brief Accesses an existing DocEntry (i.e. a Dicom Element)
* in the PubDocEntrySet of this instance
* through it's (group, element) and modifies it's length with
* the given value.
* @param element element number of the Entry to modify
* @return true on success, false otherwise.
*/
-bool gdcmDocument::SetEntryLengthByNumber(uint32_t l,
+bool Document::SetEntryLengthByNumber(uint32_t l,
uint16_t group,
uint16_t element)
{
/// \todo use map methods, instead of multimap JPR
- gdcmTagKey key = gdcmDictEntry::TranslateToKey(group, element);
+ TagKey key = DictEntry::TranslateToKey(group, element);
if ( !TagHT.count(key) )
{
return false;
* @param elem element number of the Entry
* @return File Offset of the Element Value
*/
-size_t gdcmDocument::GetEntryOffsetByNumber(uint16_t group, uint16_t elem)
+size_t Document::GetEntryOffsetByNumber(uint16_t group, uint16_t elem)
{
- gdcmDocEntry* entry = GetDocEntryByNumber(group, elem);
+ DocEntry* entry = GetDocEntryByNumber(group, elem);
if (!entry)
{
- dbg.Verbose(1, "gdcmDocument::GetDocEntryByNumber: no entry present.");
+ dbg.Verbose(1, "Document::GetDocEntryByNumber: no entry present.");
return 0;
}
return entry->GetOffset();
* @param elem element number of the Entry
* @return Pointer to the 'non string' area
*/
-void* gdcmDocument::GetEntryBinAreaByNumber(uint16_t group, uint16_t elem)
+void* Document::GetEntryBinAreaByNumber(uint16_t group, uint16_t elem)
{
- gdcmDocEntry* entry = GetDocEntryByNumber(group, elem);
+ DocEntry* entry = GetDocEntryByNumber(group, elem);
if (!entry)
{
- dbg.Verbose(1, "gdcmDocument::GetDocEntryByNumber: no entry");
+ dbg.Verbose(1, "Document::GetDocEntryByNumber: no entry");
return 0;
}
- return ((gdcmBinEntry *)entry)->GetBinArea();
+ return ((BinEntry *)entry)->GetBinArea();
}
/**
* @param group group number of the Entry
* @param elem element number of the Entry
*/
-void* gdcmDocument::LoadEntryBinArea(uint16_t group, uint16_t elem)
+void* Document::LoadEntryBinArea(uint16_t group, uint16_t elem)
{
- gdcmDocEntry *docElement = GetDocEntryByNumber(group, elem);
+ DocEntry *docElement = GetDocEntryByNumber(group, elem);
if ( !docElement )
{
return NULL;
uint8_t* a = new uint8_t[l];
if(!a)
{
- dbg.Verbose(0, "gdcmDocument::LoadEntryBinArea cannot allocate a");
+ dbg.Verbose(0, "Document::LoadEntryBinArea cannot allocate a");
return NULL;
}
size_t l2 = fread(a, 1, l , Fp);
/// \todo Drop any already existing void area! JPR
if( !SetEntryBinAreaByNumber( a, group, elem ) );
{
- dbg.Verbose(0, "gdcmDocument::LoadEntryBinArea setting failed.");
+ dbg.Verbose(0, "Document::LoadEntryBinArea setting failed.");
}
return a;
}
* when a string is not suitable
* @param element Entry whose binArea is going to be loaded
*/
-void* gdcmDocument::LoadEntryBinArea(gdcmBinEntry* element)
+void* Document::LoadEntryBinArea(BinEntry* element)
{
size_t o =(size_t)element->GetOffset();
fseek(Fp, o, SEEK_SET);
uint8_t* a = new uint8_t[l];
if( !a )
{
- dbg.Verbose(0, "gdcmDocument::LoadEntryBinArea cannot allocate a");
+ dbg.Verbose(0, "Document::LoadEntryBinArea cannot allocate a");
return NULL;
}
element->SetBinArea((uint8_t*)a);
* @param element Element number of the searched Dicom Element
* @return
*/
-bool gdcmDocument::SetEntryBinAreaByNumber(uint8_t* area,
+bool Document::SetEntryBinAreaByNumber(uint8_t* area,
uint16_t group,
uint16_t element)
{
- gdcmDocEntry* currentEntry = GetDocEntryByNumber(group, element);
+ DocEntry* currentEntry = GetDocEntryByNumber(group, element);
if ( !currentEntry )
{
return false;
}
- if ( gdcmBinEntry* binEntry = dynamic_cast<gdcmBinEntry*>(currentEntry) )
+ if ( BinEntry* binEntry = dynamic_cast<BinEntry*>(currentEntry) )
{
binEntry->SetBinArea( area );
return true;
* \brief Update the entries with the shadow dictionary.
* Only non even entries are analyzed
*/
-void gdcmDocument::UpdateShaEntries()
+void Document::UpdateShaEntries()
{
- //gdcmDictEntry *entry;
+ //DictEntry *entry;
std::string vr;
/// \todo TODO : still any use to explore recursively the whole structure?
* @return Corresponding Dicom Element when it exists, and NULL
* otherwise.
*/
-gdcmDocEntry* gdcmDocument::GetDocEntryByName(std::string const & tagName)
+DocEntry* Document::GetDocEntryByName(std::string const & tagName)
{
- gdcmDictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName);
+ DictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName);
if( !dictEntry )
{
return NULL;
* @param element Element number of the searched Dicom Element
* @return
*/
-gdcmDocEntry* gdcmDocument::GetDocEntryByNumber(uint16_t group,
+DocEntry* Document::GetDocEntryByNumber(uint16_t group,
uint16_t element)
{
- gdcmTagKey key = gdcmDictEntry::TranslateToKey(group, element);
+ TagKey key = DictEntry::TranslateToKey(group, element);
if ( !TagHT.count(key))
{
return NULL;
}
/**
- * \brief Same as \ref gdcmDocument::GetDocEntryByNumber except it only
+ * \brief Same as \ref Document::GetDocEntryByNumber except it only
* returns a result when the corresponding entry is of type
* ValEntry.
* @return When present, the corresponding ValEntry.
*/
-gdcmValEntry* gdcmDocument::GetValEntryByNumber(uint16_t group,
+ValEntry* Document::GetValEntryByNumber(uint16_t group,
uint16_t element)
{
- gdcmDocEntry* currentEntry = GetDocEntryByNumber(group, element);
+ DocEntry* currentEntry = GetDocEntryByNumber(group, element);
if ( !currentEntry )
{
return 0;
}
- if ( gdcmValEntry* valEntry = dynamic_cast<gdcmValEntry*>(currentEntry) )
+ if ( ValEntry* valEntry = dynamic_cast<ValEntry*>(currentEntry) )
{
return valEntry;
}
- dbg.Verbose(0, "gdcmDocument::GetValEntryByNumber: unfound ValEntry.");
+ dbg.Verbose(0, "Document::GetValEntryByNumber: unfound ValEntry.");
return 0;
}
* @param entry Header Entry whose value shall be loaded.
* @return
*/
-void gdcmDocument::LoadDocEntrySafe(gdcmDocEntry * entry)
+void Document::LoadDocEntrySafe(DocEntry * entry)
{
long PositionOnEntry = ftell(Fp);
LoadDocEntry(entry);
* processor order.
* @return The properly swaped 32 bits integer.
*/
-uint32_t gdcmDocument::SwapLong(uint32_t a)
+uint32_t Document::SwapLong(uint32_t a)
{
switch (SwapCode)
{
break;
default :
//std::cout << "swapCode= " << SwapCode << std::endl;
- dbg.Error(" gdcmDocument::SwapLong : unset swap code");
+ dbg.Error(" Document::SwapLong : unset swap code");
a = 0;
}
return a;
* processor order.
* @return The properly unswaped 32 bits integer.
*/
-uint32_t gdcmDocument::UnswapLong(uint32_t a)
+uint32_t Document::UnswapLong(uint32_t a)
{
return SwapLong(a);
}
* \brief Swaps the bytes so they agree with the processor order
* @return The properly swaped 16 bits integer.
*/
-uint16_t gdcmDocument::SwapShort(uint16_t a)
+uint16_t Document::SwapShort(uint16_t a)
{
if ( SwapCode == 4321 || SwapCode == 2143 )
{
* \brief Unswaps the bytes so they agree with the processor order
* @return The properly unswaped 16 bits integer.
*/
-uint16_t gdcmDocument::UnswapShort(uint16_t a)
+uint16_t Document::UnswapShort(uint16_t a)
{
return SwapShort(a);
}
* \brief Parses a DocEntrySet (Zero-level DocEntries or SQ Item DocEntries)
* @return length of the parsed set.
*/
-void gdcmDocument::ParseDES(gdcmDocEntrySet *set,
+void Document::ParseDES(DocEntrySet *set,
long offset,
long l_max,
bool delim_mode)
{
- gdcmDocEntry *newDocEntry = 0;
+ DocEntry *newDocEntry = 0;
while (true)
{
break;
}
- gdcmVRKey vr = newDocEntry->GetVR();
+ VRKey vr = newDocEntry->GetVR();
if ( vr != "SQ" )
{
- if ( gdcmGlobal::GetVR()->IsVROfGdcmStringRepresentable(vr) )
+ if ( Global::GetVR()->IsVROfGdcmStringRepresentable(vr) )
{
/////////////////////// ValEntry
- gdcmValEntry* newValEntry =
- new gdcmValEntry( newDocEntry->GetDictEntry() );
+ ValEntry* newValEntry =
+ new ValEntry( newDocEntry->GetDictEntry() );
newValEntry->Copy( newDocEntry );
- // When "set" is a gdcmDocument, then we are at the top of the
+ // When "set" is a Document, then we are at the top of the
// hierarchy and the Key is simply of the form ( group, elem )...
- if (gdcmDocument* dummy = dynamic_cast< gdcmDocument* > ( set ) )
+ if (Document* dummy = dynamic_cast< Document* > ( set ) )
{
(void)dummy;
newValEntry->SetKey( newValEntry->GetKey() );
}
- // ...but when "set" is a gdcmSQItem, we are inserting this new
+ // ...but when "set" is a SQItem, we are inserting this new
// valEntry in a sequence item. Hence the key has the
- // generalized form (refer to \ref gdcmBaseTagKey):
- if (gdcmSQItem* parentSQItem = dynamic_cast< gdcmSQItem* > ( set ) )
+ // generalized form (refer to \ref BaseTagKey):
+ if (SQItem* parentSQItem = dynamic_cast< SQItem* > ( set ) )
{
newValEntry->SetKey( parentSQItem->GetBaseTagKey()
+ newValEntry->GetKey() );
}
else
{
- if ( ! gdcmGlobal::GetVR()->IsVROfGdcmBinaryRepresentable(vr) )
+ if ( ! Global::GetVR()->IsVROfGdcmBinaryRepresentable(vr) )
{
////// Neither ValEntry NOR BinEntry: should mean UNKOWN VR
- dbg.Verbose(0, "gdcmDocument::ParseDES: neither Valentry, "
+ dbg.Verbose(0, "Document::ParseDES: neither Valentry, "
"nor BinEntry. Probably unknown VR.");
}
//////////////////// BinEntry or UNKOWN VR:
- gdcmBinEntry* newBinEntry =
- new gdcmBinEntry( newDocEntry->GetDictEntry() );
+ BinEntry* newBinEntry =
+ new BinEntry( newDocEntry->GetDictEntry() );
newBinEntry->Copy( newDocEntry );
- // When "this" is a gdcmDocument the Key is simply of the
+ // When "this" is a Document the Key is simply of the
// form ( group, elem )...
- if (gdcmDocument* dummy = dynamic_cast< gdcmDocument* > ( set ) )
+ if (Document* dummy = dynamic_cast< Document* > ( set ) )
{
(void)dummy;
newBinEntry->SetKey( newBinEntry->GetKey() );
}
// but when "this" is a SQItem, we are inserting this new
// valEntry in a sequence item, and the kay has the
- // generalized form (refer to \ref gdcmBaseTagKey):
- if (gdcmSQItem* parentSQItem = dynamic_cast< gdcmSQItem* > ( set ) )
+ // generalized form (refer to \ref BaseTagKey):
+ if (SQItem* parentSQItem = dynamic_cast< SQItem* > ( set ) )
{
newBinEntry->SetKey( parentSQItem->GetBaseTagKey()
+ newBinEntry->GetKey() );
}
}
// no other way to create it ...
- gdcmSeqEntry* newSeqEntry =
- new gdcmSeqEntry( newDocEntry->GetDictEntry() );
+ SeqEntry* newSeqEntry =
+ new SeqEntry( newDocEntry->GetDictEntry() );
newSeqEntry->Copy( newDocEntry );
newSeqEntry->SetDelimitorMode( delim_mode );
- // At the top of the hierarchy, stands a gdcmDocument. When "set"
- // is a gdcmDocument, then we are building the first depth level.
- // Hence the gdcmSeqEntry we are building simply has a depth
+ // At the top of the hierarchy, stands a Document. When "set"
+ // is a Document, then we are building the first depth level.
+ // Hence the SeqEntry we are building simply has a depth
// level of one:
- if (gdcmDocument* dummy = dynamic_cast< gdcmDocument* > ( set ) )
+ if (Document* dummy = dynamic_cast< Document* > ( set ) )
{
(void)dummy;
newSeqEntry->SetDepthLevel( 1 );
newSeqEntry->SetKey( newSeqEntry->GetKey() );
}
// But when "set" is allready a SQItem, we are building a nested
- // sequence, and hence the depth level of the new gdcmSeqEntry
+ // sequence, and hence the depth level of the new SeqEntry
// we are building, is one level deeper:
- if (gdcmSQItem* parentSQItem = dynamic_cast< gdcmSQItem* > ( set ) )
+ if (SQItem* parentSQItem = dynamic_cast< SQItem* > ( set ) )
{
newSeqEntry->SetDepthLevel( parentSQItem->GetDepthLevel() + 1 );
newSeqEntry->SetKey( parentSQItem->GetBaseTagKey()
* \brief Parses a Sequence ( SeqEntry after SeqEntry)
* @return parsed length for this level
*/
-void gdcmDocument::ParseSQ( gdcmSeqEntry* seqEntry,
+void Document::ParseSQ( SeqEntry* seqEntry,
long offset, long l_max, bool delim_mode)
{
int SQItemNumber = 0;
while (true)
{
- gdcmDocEntry* newDocEntry = ReadNextDocEntry();
+ DocEntry* newDocEntry = ReadNextDocEntry();
if ( !newDocEntry )
{
// FIXME Should warn user
break;
}
- gdcmSQItem *itemSQ = new gdcmSQItem( seqEntry->GetDepthLevel() );
+ SQItem *itemSQ = new SQItem( seqEntry->GetDepthLevel() );
std::ostringstream newBase;
newBase << seqEntry->GetKey()
<< "/"
/**
* \brief Loads the element content if its length doesn't exceed
- * the value specified with gdcmDocument::SetMaxSizeLoadEntry()
+ * the value specified with Document::SetMaxSizeLoadEntry()
* @param entry Header Entry (Dicom Element) to be dealt with
*/
-void gdcmDocument::LoadDocEntry(gdcmDocEntry* entry)
+void Document::LoadDocEntry(DocEntry* entry)
{
size_t item_read;
uint16_t group = entry->GetGroup();
// When the length is zero things are easy:
if ( length == 0 )
{
- ((gdcmValEntry *)entry)->SetValue("");
+ ((ValEntry *)entry)->SetValue("");
return;
}
std::ostringstream s;
if (length > MaxSizeLoadEntry)
{
- if (gdcmBinEntry* binEntryPtr = dynamic_cast< gdcmBinEntry* >(entry) )
+ if (BinEntry* binEntryPtr = dynamic_cast< BinEntry* >(entry) )
{
//s << "gdcm::NotLoaded (BinEntry)";
s << GDCM_NOTLOADED;
binEntryPtr->SetValue(s.str());
}
// Be carefull : a BinEntry IS_A ValEntry ...
- else if (gdcmValEntry* valEntryPtr = dynamic_cast< gdcmValEntry* >(entry) )
+ else if (ValEntry* valEntryPtr = dynamic_cast< ValEntry* >(entry) )
{
// s << "gdcm::NotLoaded. (ValEntry)";
s << GDCM_NOTLOADED;
}
// When we find a BinEntry not very much can be done :
- if (gdcmBinEntry* binEntryPtr = dynamic_cast< gdcmBinEntry* >(entry) )
+ if (BinEntry* binEntryPtr = dynamic_cast< BinEntry* >(entry) )
{
s << GDCM_BINLOADED;
binEntryPtr->SetValue(s.str());
s << std::ends; // to avoid oddities on Solaris
#endif //GDCM_NO_ANSI_STRING_STREAM
- ((gdcmValEntry *)entry)->SetValue(s.str());
+ ((ValEntry *)entry)->SetValue(s.str());
return;
}
str[length] = '\0';
std::string newValue = str;
delete[] str;
- if ( gdcmValEntry* valEntry = dynamic_cast<gdcmValEntry* >(entry) )
+ if ( ValEntry* valEntry = dynamic_cast<ValEntry* >(entry) )
{
if ( item_read != 1 )
{
- dbg.Verbose(1, "gdcmDocument::LoadDocEntry",
+ dbg.Verbose(1, "Document::LoadDocEntry",
"unread element value");
valEntry->SetValue(GDCM_UNREAD);
return;
}
else
{
- dbg.Error(true, "gdcmDocument::LoadDocEntry"
+ dbg.Error(true, "Document::LoadDocEntry"
"Should have a ValEntry, here !");
}
}
* \brief Find the value Length of the passed Header Entry
* @param entry Header Entry whose length of the value shall be loaded.
*/
-void gdcmDocument::FindDocEntryLength( gdcmDocEntry *entry )
- throw ( gdcmFormatError )
+void Document::FindDocEntryLength( DocEntry *entry )
+ throw ( FormatError )
{
uint16_t element = entry->GetElement();
std::string vr = entry->GetVR();
uint16_t length16;
- if ( Filetype == gdcmExplicitVR && !entry->IsImplicitVR() )
+ if ( Filetype == ExplicitVR && !entry->IsImplicitVR() )
{
if ( vr == "OB" || vr == "OW" || vr == "SQ" || vr == "UN" )
{
/// the above test is on both OB and OW...
lengthOB = FindDocEntryLengthOB();
}
- catch ( gdcmFormatUnexpected )
+ catch ( FormatUnexpected )
{
// Computing the length failed (this happens with broken
// files like gdcm-JPEG-LossLess3a.dcm). We still have a
{
if ( !IsExplicitVRBigEndianTransferSyntax() )
{
- throw gdcmFormatError( "gdcmDocument::FindDocEntryLength()",
- " not explicit VR." );
+ throw FormatError( "Document::FindDocEntryLength()",
+ " not explicit VR." );
return;
}
length16 = 4;
// and the dictionary entry depending on them.
uint16_t correctGroup = SwapShort( entry->GetGroup() );
uint16_t correctElem = SwapShort( entry->GetElement() );
- gdcmDictEntry* newTag = GetDictEntryByNumber( correctGroup,
+ DictEntry* newTag = GetDictEntryByNumber( correctGroup,
correctElem );
if ( !newTag )
{
* \brief Find the Value Representation of the current Dicom Element.
* @param entry
*/
-void gdcmDocument::FindDocEntryVR( gdcmDocEntry *entry )
+void Document::FindDocEntryVR( DocEntry *entry )
{
- if ( Filetype != gdcmExplicitVR )
+ if ( Filetype != ExplicitVR )
{
return;
}
* @return false if the VR is incorrect of if the VR isn't referenced
* otherwise, it returns true
*/
-bool gdcmDocument::CheckDocEntryVR(gdcmDocEntry *entry, gdcmVRKey vr)
+bool Document::CheckDocEntryVR(DocEntry *entry, VRKey vr)
{
std::string msg;
bool realExplicit = true;
// CLEANME searching the dicom_vr at each occurence is expensive.
// PostPone this test in an optional integrity check at the end
// of parsing or only in debug mode.
- if ( realExplicit && !gdcmGlobal::GetVR()->Count(vr) )
+ if ( realExplicit && !Global::GetVR()->Count(vr) )
{
realExplicit = false;
}
{
// We thought this was explicit VR, but we end up with an
// implicit VR tag. Let's backtrack.
- msg = gdcmUtil::Format("Falsely explicit vr file (%04x,%04x)\n",
+ msg = Util::Format("Falsely explicit vr file (%04x,%04x)\n",
entry->GetGroup(), entry->GetElement());
- dbg.Verbose(1, "gdcmDocument::FindVR: ", msg.c_str());
+ dbg.Verbose(1, "Document::FindVR: ", msg.c_str());
if( entry->GetGroup() % 2 && entry->GetElement() == 0x0000)
{
// Group length is UL !
- gdcmDictEntry* newEntry = NewVirtualDictEntry(
+ DictEntry* newEntry = NewVirtualDictEntry(
entry->GetGroup(), entry->GetElement(),
"UL", "FIXME", "Group Length");
entry->SetDictEntry( newEntry );
// be unwise to overwrite the VR of a dictionary (since it would
// compromise it's next user), we need to clone the actual DictEntry
// and change the VR for the read one.
- gdcmDictEntry* newEntry = NewVirtualDictEntry(
+ DictEntry* newEntry = NewVirtualDictEntry(
entry->GetGroup(), entry->GetElement(),
vr, "FIXME", entry->GetName());
entry->SetDictEntry(newEntry);
* @param entry entry to tranform
* @return Transformed entry value
*/
-std::string gdcmDocument::GetDocEntryValue(gdcmDocEntry *entry)
+std::string Document::GetDocEntryValue(DocEntry *entry)
{
if ( IsDocEntryAnInteger(entry) && entry->IsImplicitVR() )
{
- std::string val = ((gdcmValEntry *)entry)->GetValue();
+ std::string val = ((ValEntry *)entry)->GetValue();
std::string vr = entry->GetVR();
uint32_t length = entry->GetLength();
std::ostringstream s;
return s.str();
}
- return ((gdcmValEntry *)entry)->GetValue();
+ return ((ValEntry *)entry)->GetValue();
}
/**
* @param entry Entry to reverse transform
* @return Reverse transformed entry value
*/
-std::string gdcmDocument::GetDocEntryUnvalue(gdcmDocEntry* entry)
+std::string Document::GetDocEntryUnvalue(DocEntry* entry)
{
if ( IsDocEntryAnInteger(entry) && entry->IsImplicitVR() )
{
uint16_t newInt16;
tokens.erase( tokens.begin(), tokens.end()); // clean any previous value
- gdcmUtil::Tokenize (((gdcmValEntry *)entry)->GetValue(), tokens, "\\");
+ Util::Tokenize (((ValEntry *)entry)->GetValue(), tokens, "\\");
for (unsigned int i=0; i<tokens.size(); i++)
{
newInt16 = atoi(tokens[i].c_str());
uint32_t newInt32;
tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
- gdcmUtil::Tokenize (((gdcmValEntry *)entry)->GetValue(), tokens, "\\");
+ Util::Tokenize (((ValEntry *)entry)->GetValue(), tokens, "\\");
for (unsigned int i=0; i<tokens.size();i++)
{
newInt32 = atoi(tokens[i].c_str());
return s.str();
}
- return ((gdcmValEntry *)entry)->GetValue();
+ return ((ValEntry *)entry)->GetValue();
}
/**
* \warning NOT end user intended method !
* @param entry entry to skip
*/
-void gdcmDocument::SkipDocEntry(gdcmDocEntry *entry)
+void Document::SkipDocEntry(DocEntry *entry)
{
SkipBytes(entry->GetLength());
}
* \warning NOT end user intended method !
* @param entry entry to skip
*/
-void gdcmDocument::SkipToNextDocEntry(gdcmDocEntry *entry)
+void Document::SkipToNextDocEntry(DocEntry *entry)
{
fseek(Fp, (long)(entry->GetOffset()), SEEK_SET);
fseek(Fp, (long)(entry->GetReadLength()), SEEK_CUR);
* @param entry entry to check
* @param foundLength fist assumption about length
*/
-void gdcmDocument::FixDocEntryFoundLength(gdcmDocEntry *entry,
+void Document::FixDocEntryFoundLength(DocEntry *entry,
uint32_t foundLength)
{
entry->SetReadLength( foundLength ); // will be updated only if a bug is found
* @param entry The element value on which to apply the predicate.
* @return The result of the heuristical predicate.
*/
-bool gdcmDocument::IsDocEntryAnInteger(gdcmDocEntry *entry)
+bool Document::IsDocEntryAnInteger(DocEntry *entry)
{
uint16_t element = entry->GetElement();
uint16_t group = entry->GetGroup();
<< std::hex << group << " , " << element
<< ") -before- position x(" << filePosition << ")"
<< "lgt : " << length;
- dbg.Verbose(0, "gdcmDocument::IsDocEntryAnInteger", s.str().c_str() );
+ dbg.Verbose(0, "Document::IsDocEntryAnInteger", s.str().c_str() );
}
}
* @return
*/
-uint32_t gdcmDocument::FindDocEntryLengthOB()
- throw( gdcmFormatUnexpected )
+uint32_t Document::FindDocEntryLengthOB()
+ throw( FormatUnexpected )
{
// See PS 3.5-2001, section A.4 p. 49 on encapsulation of encoded pixel data.
long positionOnEntry = ftell(Fp);
group = ReadInt16();
elem = ReadInt16();
}
- catch ( gdcmFormatError )
+ catch ( FormatError )
{
- throw gdcmFormatError("gdcmDocument::FindDocEntryLengthOB()",
- " group or element not present.");
+ throw FormatError("Document::FindDocEntryLengthOB()",
+ " group or element not present.");
}
// We have to decount the group and element we just read
if ( group != 0xfffe || ( ( elem != 0xe0dd ) && ( elem != 0xe000 ) ) )
{
- dbg.Verbose(1, "gdcmDocument::FindDocEntryLengthOB: neither an Item "
+ dbg.Verbose(1, "Document::FindDocEntryLengthOB: neither an Item "
"tag nor a Sequence delimiter tag.");
fseek(Fp, positionOnEntry, SEEK_SET);
- throw gdcmFormatUnexpected("gdcmDocument::FindDocEntryLengthOB()",
- "Neither an Item tag nor a Sequence "
- "delimiter tag.");
+ throw FormatUnexpected("Document::FindDocEntryLengthOB()",
+ "Neither an Item tag nor a Sequence "
+ "delimiter tag.");
}
if ( elem == 0xe0dd )
* (swaps it depending on processor endianity)
* @return read value
*/
-uint16_t gdcmDocument::ReadInt16()
- throw( gdcmFormatError )
+uint16_t Document::ReadInt16()
+ throw( FormatError )
{
uint16_t g;
size_t item_read = fread (&g, (size_t)2,(size_t)1, Fp);
{
if( ferror(Fp) )
{
- throw gdcmFormatError( "gdcmDocument::ReadInt16()", " file error." );
+ throw FormatError( "Document::ReadInt16()", " file error." );
}
- throw gdcmFormatError( "gdcmDocument::ReadInt16()", "EOF." );
+ throw FormatError( "Document::ReadInt16()", "EOF." );
}
g = SwapShort(g);
return g;
* (swaps it depending on processor endianity)
* @return read value
*/
-uint32_t gdcmDocument::ReadInt32()
- throw( gdcmFormatError )
+uint32_t Document::ReadInt32()
+ throw( FormatError )
{
uint32_t g;
size_t item_read = fread (&g, (size_t)4,(size_t)1, Fp);
{
if( ferror(Fp) )
{
- throw gdcmFormatError( "gdcmDocument::ReadInt16()", " file error." );
+ throw FormatError( "Document::ReadInt16()", " file error." );
}
- throw gdcmFormatError( "gdcmDocument::ReadInt32()", "EOF." );
+ throw FormatError( "Document::ReadInt32()", "EOF." );
}
g = SwapLong(g);
return g;
* \warning NOT end user intended method !
* @return
*/
-void gdcmDocument::SkipBytes(uint32_t nBytes)
+void Document::SkipBytes(uint32_t nBytes)
{
//FIXME don't dump the returned value
(void)fseek(Fp, (long)nBytes, SEEK_CUR);
* \brief Loads all the needed Dictionaries
* \warning NOT end user intended method !
*/
-void gdcmDocument::Initialise()
+void Document::Initialise()
{
- RefPubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
+ RefPubDict = Global::GetDicts()->GetDefaultPubDict();
RefShaDict = NULL;
}
* it's neither ACR-NEMA nor DICOM
* true when we hope ours assuptions are OK
*/
-bool gdcmDocument::CheckSwap()
+bool Document::CheckSwap()
{
// The only guaranted way of finding the swap code is to find a
// group tag since we know it's length has to be of four bytes i.e.
char *entCur = deb + 128;
if( memcmp(entCur, "DICM", (size_t)4) == 0 )
{
- dbg.Verbose(1, "gdcmDocument::CheckSwap:", "looks like DICOM Version3");
+ dbg.Verbose(1, "Document::CheckSwap:", "looks like DICOM Version3");
// Next, determine the value representation (VR). Let's skip to the
// first element (0002, 0000) and check there if we find "UL"
memcmp(entCur, "CS", (size_t)2) == 0 ) // CS, to remove later
// when Write DCM *adds*
// FIXME
- // Use gdcmDocument::dicom_vr to test all the possibilities
+ // Use Document::dicom_vr to test all the possibilities
// instead of just checking for UL, OB and UI !? group 0000
{
- Filetype = gdcmExplicitVR;
- dbg.Verbose(1, "gdcmDocument::CheckSwap:",
+ Filetype = ExplicitVR;
+ dbg.Verbose(1, "Document::CheckSwap:",
"explicit Value Representation");
}
else
{
- Filetype = gdcmImplicitVR;
- dbg.Verbose(1, "gdcmDocument::CheckSwap:",
+ Filetype = ImplicitVR;
+ dbg.Verbose(1, "Document::CheckSwap:",
"not an explicit Value Representation");
}
if ( net2host )
{
SwapCode = 4321;
- dbg.Verbose(1, "gdcmDocument::CheckSwap:",
+ dbg.Verbose(1, "Document::CheckSwap:",
"HostByteOrder != NetworkByteOrder");
}
else
{
SwapCode = 0;
- dbg.Verbose(1, "gdcmDocument::CheckSwap:",
+ dbg.Verbose(1, "Document::CheckSwap:",
"HostByteOrder = NetworkByteOrder");
}
// Alas, this is not a DicomV3 file and whatever happens there is no file
// preamble. We can reset the file position indicator to where the data
// is (i.e. the beginning of the file).
- dbg.Verbose(1, "gdcmDocument::CheckSwap:", "not a DICOM Version3 file");
+ dbg.Verbose(1, "Document::CheckSwap:", "not a DICOM Version3 file");
rewind(Fp);
// Our next best chance would be to be considering a 'clean' ACR/NEMA file.
{
case 0x00040000 :
SwapCode = 3412;
- Filetype = gdcmACR;
+ Filetype = ACR;
return true;
case 0x04000000 :
SwapCode = 4321;
- Filetype = gdcmACR;
+ Filetype = ACR;
return true;
case 0x00000400 :
SwapCode = 2143;
- Filetype = gdcmACR;
+ Filetype = ACR;
return true;
case 0x00000004 :
SwapCode = 0;
- Filetype = gdcmACR;
+ Filetype = ACR;
return true;
default :
// We are out of luck. It is not a DicomV3 nor a 'clean' ACR/NEMA file.
case 0x0004 :
case 0x0008 :
SwapCode = 0;
- Filetype = gdcmACR;
+ Filetype = ACR;
return true;
case 0x0200 :
case 0x0400 :
case 0x0800 :
SwapCode = 4321;
- Filetype = gdcmACR;
+ Filetype = ACR;
return true;
default :
- dbg.Verbose(0, "gdcmDocument::CheckSwap:",
+ dbg.Verbose(0, "Document::CheckSwap:",
"ACR/NEMA unfound swap info (Really hopeless !)");
- Filetype = gdcmUnknown;
+ Filetype = Unknown;
return false;
}
// Then the only info we have is the net2host one.
* \brief Restore the unproperly loaded values i.e. the group, the element
* and the dictionary entry depending on them.
*/
-void gdcmDocument::SwitchSwapToBigEndian()
+void Document::SwitchSwapToBigEndian()
{
- dbg.Verbose(1, "gdcmDocument::SwitchSwapToBigEndian",
+ dbg.Verbose(1, "Document::SwitchSwapToBigEndian",
"Switching to BigEndian mode.");
if ( SwapCode == 0 )
{
* \brief during parsing, Header Elements too long are not loaded in memory
* @param newSize
*/
-void gdcmDocument::SetMaxSizeLoadEntry(long newSize)
+void Document::SetMaxSizeLoadEntry(long newSize)
{
if ( newSize < 0 )
{
/**
* \brief Header Elements too long will not be printed
- * \todo See comments of \ref gdcmDocument::MAX_SIZE_PRINT_ELEMENT_VALUE
+ * \todo See comments of \ref Document::MAX_SIZE_PRINT_ELEMENT_VALUE
* @param newSize
*/
-void gdcmDocument::SetMaxSizePrintEntry(long newSize)
+void Document::SetMaxSizePrintEntry(long newSize)
{
//DOH !! This is exactly SetMaxSizeLoadEntry FIXME FIXME
if ( newSize < 0 )
* gets the VR, gets the length, gets the offset value)
* @return On succes the newly created DocEntry, NULL on failure.
*/
-gdcmDocEntry* gdcmDocument::ReadNextDocEntry()
+DocEntry* Document::ReadNextDocEntry()
{
uint16_t group;
uint16_t elem;
group = ReadInt16();
elem = ReadInt16();
}
- catch ( gdcmFormatError e )
+ catch ( FormatError e )
{
// We reached the EOF (or an error occured) therefore
// header parsing has to be considered as finished.
return 0;
}
- gdcmDocEntry *newEntry = NewDocEntryByNumber(group, elem);
+ DocEntry *newEntry = NewDocEntryByNumber(group, elem);
FindDocEntryVR(newEntry);
try
{
FindDocEntryLength(newEntry);
}
- catch ( gdcmFormatError e )
+ catch ( FormatError e )
{
// Call it quits
//std::cout << e;
/**
- * \brief Generate a free gdcmTagKey i.e. a gdcmTagKey that is not present
+ * \brief Generate a free TagKey i.e. a TagKey that is not present
* in the TagHt dictionary.
* @param group The generated tag must belong to this group.
* @return The element of tag with given group which is fee.
*/
-uint32_t gdcmDocument::GenerateFreeTagKeyInGroup(uint16_t group)
+uint32_t Document::GenerateFreeTagKeyInGroup(uint16_t group)
{
for (uint32_t elem = 0; elem < UINT32_MAX; elem++)
{
- gdcmTagKey key = gdcmDictEntry::TranslateToKey(group, elem);
+ TagKey key = DictEntry::TranslateToKey(group, elem);
if (TagHT.count(key) == 0)
{
return elem;
}
/**
- * \brief Assuming the internal file pointer \ref gdcmDocument::Fp
+ * \brief Assuming the internal file pointer \ref Document::Fp
* is placed at the beginning of a tag check whether this
* tag is (TestGroup, TestElement).
- * \warning On success the internal file pointer \ref gdcmDocument::Fp
+ * \warning On success the internal file pointer \ref Document::Fp
* is modified to point after the tag.
* On failure (i.e. when the tag wasn't the expected tag
* (TestGroup, TestElement) the internal file pointer
- * \ref gdcmDocument::Fp is restored to it's original position.
+ * \ref Document::Fp is restored to it's original position.
* @param testGroup The expected group of the tag.
* @param testElement The expected Element of the tag.
* @return True on success, false otherwise.
*/
-bool gdcmDocument::ReadTag(uint16_t testGroup, uint16_t testElement)
+bool Document::ReadTag(uint16_t testGroup, uint16_t testElement)
{
long positionOnEntry = ftell(Fp);
long currentPosition = ftell(Fp); // On debugging purposes
s << std::hex << itemTagGroup << "," << itemTagElement << ")"
<< std::endl;
s << " at address: " << (unsigned)currentPosition << std::endl;
- dbg.Verbose(0, "gdcmDocument::ReadItemTagLength: wrong Item Tag found:");
+ dbg.Verbose(0, "Document::ReadItemTagLength: wrong Item Tag found:");
dbg.Verbose(0, s.str().c_str());
fseek(Fp, positionOnEntry, SEEK_SET);
}
/**
- * \brief Assuming the internal file pointer \ref gdcmDocument::Fp
+ * \brief Assuming the internal file pointer \ref Document::Fp
* is placed at the beginning of a tag (TestGroup, TestElement),
* read the length associated to the Tag.
- * \warning On success the internal file pointer \ref gdcmDocument::Fp
+ * \warning On success the internal file pointer \ref Document::Fp
* is modified to point after the tag and it's length.
* On failure (i.e. when the tag wasn't the expected tag
* (TestGroup, TestElement) the internal file pointer
- * \ref gdcmDocument::Fp is restored to it's original position.
+ * \ref Document::Fp is restored to it's original position.
* @param testGroup The expected group of the tag.
* @param testElement The expected Element of the tag.
* @return On success returns the length associated to the tag. On failure
* returns 0.
*/
-uint32_t gdcmDocument::ReadTagLength(uint16_t testGroup, uint16_t testElement)
+uint32_t Document::ReadTagLength(uint16_t testGroup, uint16_t testElement)
{
long positionOnEntry = ftell(Fp);
(void)positionOnEntry;
s << "Basic Item Length is: "
<< itemLength << std::endl;
s << " at address: " << (unsigned)currentPosition << std::endl;
- dbg.Verbose(0, "gdcmDocument::ReadItemTagLength: ", s.str().c_str());
+ dbg.Verbose(0, "Document::ReadItemTagLength: ", s.str().c_str());
}
return itemLength;
}
* \brief When parsing the Pixel Data of an encapsulated file, read
* the basic offset table (when present, and BTW dump it).
*/
-void gdcmDocument::ReadAndSkipEncapsulatedBasicOffsetTable()
+void Document::ReadAndSkipEncapsulatedBasicOffsetTable()
{
//// Read the Basic Offset Table Item Tag length...
uint32_t itemLength = ReadTagLength(0xfffe, 0xe000);
s << " Read one length: ";
s << std::hex << individualLength << std::endl;
dbg.Verbose(0,
- "gdcmDocument::ReadAndSkipEncapsulatedBasicOffsetTable: ",
+ "Document::ReadAndSkipEncapsulatedBasicOffsetTable: ",
s.str().c_str());
}
#endif //GDCM_DEBUG
* Compute the RLE extra information and store it in \ref RLEInfo
* for later pixel retrieval usage.
*/
-void gdcmDocument::ComputeRLEInfo()
+void Document::ComputeRLEInfo()
{
if ( ! IsRLELossLessTransferSyntax() )
{
// Encapsulated RLE Compressed Images (see PS 3.5-2003, Annex G)
// Loop on the individual frame[s] and store the information
- // on the RLE fragments in a gdcmRLEFramesInfo.
+ // on the RLE fragments in a RLEFramesInfo.
// Note: - when only a single frame is present, this is a
// classical image.
// - when more than one frame are present, then we are in
// Deduce from both the RLE Header and the frameLength the
// fragment length, and again store this info in a
- // gdcmRLEFramesInfo.
+ // RLEFramesInfo.
long rleSegmentLength[15];
// skipping (not reading) RLE Segments
if ( nbRleSegments > 1)
SkipBytes(rleSegmentLength[nbRleSegments]);
// Store the collected info
- gdcmRLEFrame* newFrameInfo = new gdcmRLEFrame;
+ RLEFrame* newFrameInfo = new RLEFrame;
newFrameInfo->NumberFragments = nbRleSegments;
for( unsigned int uk = 1; uk <= nbRleSegments; uk++ )
{
// Delimiter Item':
if ( !ReadTag(0xfffe, 0xe0dd) )
{
- dbg.Verbose(0, "gdcmDocument::ComputeRLEInfo: no sequence delimiter ");
+ dbg.Verbose(0, "Document::ComputeRLEInfo: no sequence delimiter ");
dbg.Verbose(0, " item at end of RLE item sequence");
}
}
* length) and store it[them] in \ref JPEGInfo for later pixel
* retrieval usage.
*/
-void gdcmDocument::ComputeJPEGFragmentInfo()
+void Document::ComputeJPEGFragmentInfo()
{
// If you need to, look for comments of ComputeRLEInfo().
if ( ! IsJPEGTransferSyntax() )
ReadAndSkipEncapsulatedBasicOffsetTable();
// Loop on the fragments[s] and store the parsed information in a
- // gdcmJPEGInfo.
+ // JPEGInfo.
long fragmentLength;
while ( (fragmentLength = ReadTagLength(0xfffe, 0xe000)) )
{
long fragmentOffset = ftell(Fp);
// Store the collected info
- gdcmJPEGFragment* newFragment = new gdcmJPEGFragment;
+ JPEGFragment* newFragment = new JPEGFragment;
newFragment->Offset = fragmentOffset;
newFragment->Length = fragmentLength;
JPEGInfo.Fragments.push_back( newFragment );
// Delimiter Item':
if ( !ReadTag(0xfffe, 0xe0dd) )
{
- dbg.Verbose(0, "gdcmDocument::ComputeRLEInfo: no sequence delimiter ");
+ dbg.Verbose(0, "Document::ComputeRLEInfo: no sequence delimiter ");
dbg.Verbose(0, " item at end of JPEG item sequence");
}
}
/**
- * \brief Walk recursively the given \ref gdcmDocEntrySet, and feed
+ * \brief Walk recursively the given \ref DocEntrySet, and feed
* the given hash table (\ref TagDocEntryHT) with all the
- * \ref gdcmDocEntry (Dicom entries) encountered.
+ * \ref DocEntry (Dicom entries) encountered.
* This method does the job for \ref BuildFlatHashTable.
- * @param builtHT Where to collect all the \ref gdcmDocEntry encountered
+ * @param builtHT Where to collect all the \ref DocEntry encountered
* when recursively walking the given set.
* @param set The structure to be traversed (recursively).
*/
-void gdcmDocument::BuildFlatHashTableRecurse( TagDocEntryHT& builtHT,
- gdcmDocEntrySet* set )
+void Document::BuildFlatHashTableRecurse( TagDocEntryHT& builtHT,
+ DocEntrySet* set )
{
- if (gdcmElementSet* elementSet = dynamic_cast< gdcmElementSet* > ( set ) )
+ if (ElementSet* elementSet = dynamic_cast< ElementSet* > ( set ) )
{
TagDocEntryHT* currentHT = elementSet->GetTagHT();
for( TagDocEntryHT::const_iterator i = currentHT->begin();
i != currentHT->end();
++i)
{
- gdcmDocEntry* entry = i->second;
- if ( gdcmSeqEntry* seqEntry = dynamic_cast<gdcmSeqEntry*>(entry) )
+ DocEntry* entry = i->second;
+ if ( SeqEntry* seqEntry = dynamic_cast<SeqEntry*>(entry) )
{
ListSQItem& items = seqEntry->GetSQItems();
for( ListSQItem::const_iterator item = items.begin();
return;
}
- if (gdcmSQItem* SQItemSet = dynamic_cast< gdcmSQItem* > ( set ) )
+ if (SQItem* SQItemSet = dynamic_cast< SQItem* > ( set ) )
{
ListDocEntry& currentList = SQItemSet->GetDocEntries();
for (ListDocEntry::iterator i = currentList.begin();
i != currentList.end();
++i)
{
- gdcmDocEntry* entry = *i;
- if ( gdcmSeqEntry* seqEntry = dynamic_cast<gdcmSeqEntry*>(entry) )
+ DocEntry* entry = *i;
+ if ( SeqEntry* seqEntry = dynamic_cast<SeqEntry*>(entry) )
{
ListSQItem& items = seqEntry->GetSQItems();
for( ListSQItem::const_iterator item = items.begin();
/**
* \brief Build a \ref TagDocEntryHT (i.e. a std::map<>) from the current
- * gdcmDocument.
+ * Document.
*
- * The structure used by a gdcmDocument (through \ref gdcmElementSet),
+ * The structure used by a Document (through \ref ElementSet),
* in order to old the parsed entries of a Dicom header, is a recursive
* one. This is due to the fact that the sequences (when present)
* can be nested. Additionaly, the sequence items (represented in
- * gdcm as \ref gdcmSQItem) add an extra complexity to the data
+ * gdcm as \ref SQItem) add an extra complexity to the data
* structure. Hence, a gdcm user whishing to visit all the entries of
* a Dicom header will need to dig in the gdcm internals (which
* implies exposing all the internal data structures to the API).
* Dicom entries in a flat structure (a \ref TagDocEntryHT i.e. a
* std::map<>).
* \warning Of course there is NO integrity constrain between the
- * returned \ref TagDocEntryHT and the \ref gdcmElementSet used
- * to build it. Hence if the underlying \ref gdcmElementSet is
+ * returned \ref TagDocEntryHT and the \ref ElementSet used
+ * to build it. Hence if the underlying \ref ElementSet is
* altered, then it is the caller responsability to invoke
* \ref BuildFlatHashTable again...
* @return The flat std::map<> we juste build.
*/
-TagDocEntryHT* gdcmDocument::BuildFlatHashTable()
+TagDocEntryHT* Document::BuildFlatHashTable()
{
TagDocEntryHT* FlatHT = new TagDocEntryHT;
BuildFlatHashTableRecurse( *FlatHT, this );
/**
- * \brief Compares two documents, according to \ref gdcmDicomDir rules
+ * \brief Compares two documents, according to \ref DicomDir rules
* \warning Does NOT work with ACR-NEMA files
* \todo Find a trick to solve the pb (use RET fields ?)
* @param document
* @return true if 'smaller'
*/
-bool gdcmDocument::operator<(gdcmDocument &document)
+bool Document::operator<(Document &document)
{
// Patient Name
std::string s1 = GetEntryByNumber(0x0010,0x0010);
return false;
}
+} // end namespace gdcm
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmDocument.h,v $
Language: C++
- Date: $Date: 2004/10/10 16:44:00 $
- Version: $Revision: 1.49 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ Version: $Revision: 1.50 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDocEntrySet.h"
#include "gdcmElementSet.h"
-class gdcmValEntry;
-class gdcmBinEntry;
-class gdcmSeqEntry;
+class ValEntry;
+class BinEntry;
+class SeqEntry;
#include <map>
#include <list>
+namespace gdcm
+{
//-----------------------------------------------------------------------------
/**
- * \brief Derived by both gdcmHeader and gdcmDicomDir
+ * \brief Derived by both Header and DicomDir
*/
-class GDCM_EXPORT gdcmDocument : public gdcmElementSet
+class GDCM_EXPORT Document : public ElementSet
{
-friend class gdcmFile;
+friend class File;
private:
/// Public dictionary used to parse this header
- gdcmDict *RefPubDict;
+ Dict *RefPubDict;
/// \brief Optional "shadow dictionary" (private elements) used to parse
/// this header
- gdcmDict *RefShaDict;
+ Dict *RefShaDict;
/// \brief Size threshold above which an element value will NOT be loaded
/// in memory (to avoid loading the image/volume itself). By default,
/// \brief Elements whose value is longer than MAX_SIZE_PRINT_ELEMENT_VALUE
/// are NOT printed.
/// \todo Currently not used since collides with #define in
- /// \ref gdcmDocEntry.cxx. See also
- /// \ref gdcmDocument::SetMaxSizePrintEntry()
+ /// \ref DocEntry.cxx. See also
+ /// \ref Document::SetMaxSizePrintEntry()
static const unsigned int MAX_SIZE_PRINT_ELEMENT_VALUE;
/// Store the RLE frames info obtained during parsing of pixels.
- gdcmRLEFramesInfo RLEInfo;
+ RLEFramesInfo RLEInfo;
/// Store the JPEG fragments info obtained during parsing of pixels.
- gdcmJPEGFragmentsInfo JPEGInfo;
+ JPEGFragmentsInfo JPEGInfo;
/// \brief Amount of printed details for each Header Entry (Dicom Element):
/// 0 : stands for the least detail level.
virtual void PrintShaDict (std::ostream &os = std::cout);
// Dictionnaries
- gdcmDict *GetPubDict();
- gdcmDict *GetShaDict();
- bool SetShaDict(gdcmDict *dict);
+ Dict *GetPubDict();
+ Dict *GetShaDict();
+ bool SetShaDict(Dict *dict);
bool SetShaDict(DictKey const & dictName);
// Informations contained in the parser
void Write(FILE* fp, FileType type);
- gdcmValEntry* ReplaceOrCreateByNumber(std::string const & value,
+ ValEntry* ReplaceOrCreateByNumber(std::string const & value,
uint16_t group, uint16_t elem,
std::string const & VR ="unkn");
- gdcmBinEntry* ReplaceOrCreateByNumber(uint8_t* binArea, int lgth,
+ BinEntry* ReplaceOrCreateByNumber(uint8_t* binArea, int lgth,
uint16_t group, uint16_t elem,
std::string const & VR="unkn");
- gdcmSeqEntry* ReplaceOrCreateByNumber(uint16_t group, uint16_t elem);
+ SeqEntry* ReplaceOrCreateByNumber(uint16_t group, uint16_t elem);
bool ReplaceIfExistByNumber ( std::string const & value,
uint16_t group,
uint16_t elem );
virtual void* LoadEntryBinArea(uint16_t group, uint16_t elem);
- virtual void* LoadEntryBinArea(gdcmBinEntry* entry);
+ virtual void* LoadEntryBinArea(BinEntry* entry);
// 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
- uint32_t UnswapLong(uint32_t); // needed by gdcmFile
+ uint16_t SwapShort(uint16_t); // needed by File
+ uint32_t SwapLong(uint32_t); // needed by File
+ uint16_t UnswapShort(uint16_t); // needed by File
+ uint32_t UnswapLong(uint32_t); // needed by File
protected:
// Constructor and destructor are protected to forbid end user
- // to instanciate from this class gdcmDocument (only gdcmHeader and
- // gdcmDicomDir are meaningfull).
- gdcmDocument();
- gdcmDocument( std::string const & filename );
- virtual ~gdcmDocument();
+ // to instanciate from this class Document (only Header and
+ // DicomDir are meaningfull).
+ Document();
+ Document( std::string const & filename );
+ virtual ~Document();
void ReadAndSkipEncapsulatedBasicOffsetTable();
void ComputeRLEInfo();
virtual void UpdateShaEntries();
// Header entry
- gdcmDocEntry* GetDocEntryByNumber(uint16_t group, uint16_t element);
- gdcmDocEntry* GetDocEntryByName (std::string const & tagName);
+ DocEntry* GetDocEntryByNumber(uint16_t group, uint16_t element);
+ DocEntry* GetDocEntryByName (std::string const & tagName);
- gdcmValEntry* GetValEntryByNumber(uint16_t group, uint16_t element);
- //gdcmBinEntry* GetBinEntryByNumber(uint16_t group, uint16_t element);
+ ValEntry* GetValEntryByNumber(uint16_t group, uint16_t element);
+ //BinEntry* GetBinEntryByNumber(uint16_t group, uint16_t element);
- void LoadDocEntrySafe(gdcmDocEntry* entry);
+ void LoadDocEntrySafe(DocEntry* entry);
TagDocEntryHT* BuildFlatHashTable();
private:
// Read
- void ParseDES(gdcmDocEntrySet *set,long offset, long l_max, bool delim_mode);
- void ParseSQ (gdcmSeqEntry *seq, long offset, long l_max, bool delim_mode);
+ void ParseDES(DocEntrySet *set,long offset, long l_max, bool delim_mode);
+ void ParseSQ (SeqEntry *seq, long offset, long l_max, bool delim_mode);
- void LoadDocEntry (gdcmDocEntry *);
- void FindDocEntryLength(gdcmDocEntry *) throw ( gdcmFormatError );
- void FindDocEntryVR (gdcmDocEntry *);
- bool CheckDocEntryVR (gdcmDocEntry *, gdcmVRKey);
+ void LoadDocEntry (DocEntry *);
+ void FindDocEntryLength(DocEntry *) throw ( FormatError );
+ void FindDocEntryVR (DocEntry *);
+ bool CheckDocEntryVR (DocEntry *, VRKey);
- std::string GetDocEntryValue (gdcmDocEntry *);
- std::string GetDocEntryUnvalue(gdcmDocEntry *);
+ std::string GetDocEntryValue (DocEntry *);
+ std::string GetDocEntryUnvalue(DocEntry *);
- void SkipDocEntry (gdcmDocEntry *);
- void SkipToNextDocEntry (gdcmDocEntry *);
+ void SkipDocEntry (DocEntry *);
+ void SkipToNextDocEntry (DocEntry *);
- void FixDocEntryFoundLength(gdcmDocEntry *, uint32_t);
- bool IsDocEntryAnInteger (gdcmDocEntry *);
+ void FixDocEntryFoundLength(DocEntry *, uint32_t);
+ bool IsDocEntryAnInteger (DocEntry *);
- uint32_t FindDocEntryLengthOB() throw( gdcmFormatUnexpected );
+ uint32_t FindDocEntryLengthOB() throw( FormatUnexpected );
- uint16_t ReadInt16() throw ( gdcmFormatError );
- uint32_t ReadInt32() throw ( gdcmFormatError );
+ uint16_t ReadInt16() throw ( FormatError );
+ uint32_t ReadInt32() throw ( FormatError );
void SkipBytes(uint32_t);
bool ReadTag(uint16_t, uint16_t);
uint32_t ReadTagLength(uint16_t, uint16_t);
void SetMaxSizePrintEntry(long);
// DocEntry related utilities
- gdcmDocEntry* ReadNextDocEntry();
+ DocEntry* ReadNextDocEntry();
uint32_t GenerateFreeTagKeyInGroup(uint16_t group);
void BuildFlatHashTableRecurse( TagDocEntryHT& builtHT,
- gdcmDocEntrySet* set );
+ DocEntrySet* set );
public:
/// File pointer
FILE * GetFP() { return Fp; }
- bool operator<(gdcmDocument &document);
+ bool operator<(Document &document);
};
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmElementSet.cxx,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:07 $
- Version: $Revision: 1.23 $
+ Date: $Date: 2004/10/12 04:35:45 $
+ Version: $Revision: 1.24 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmBinEntry.h"
#include "gdcmSeqEntry.h"
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
// Constructor / Destructor
/**
- * \ingroup gdcmElementSet
- * \brief Constructor from a given gdcmElementSet
+ * \ingroup ElementSet
+ * \brief Constructor from a given ElementSet
*/
//BOZ depthLevel is not usefull anymore
-gdcmElementSet::gdcmElementSet(int depthLevel)
- : gdcmDocEntrySet()
+ElementSet::ElementSet(int depthLevel)
+ : DocEntrySet()
{
(void)depthLevel;
}
/**
- * \ingroup gdcmElementSet
+ * \ingroup ElementSet
* \brief Canonical destructor.
*/
-gdcmElementSet::~gdcmElementSet()
+ElementSet::~ElementSet()
{
for(TagDocEntryHT::iterator cc = TagHT.begin();cc != TagHT.end(); ++cc)
{
- gdcmDocEntry* entryToDelete = cc->second;
+ DocEntry* entryToDelete = cc->second;
if ( entryToDelete )
{
delete entryToDelete;
* from the H Table
* @return
*/
-void gdcmElementSet::Print(std::ostream& os)
+void ElementSet::Print(std::ostream& os)
{
for( TagDocEntryHT::const_iterator i = TagHT.begin(); i != TagHT.end(); ++i)
{
- gdcmDocEntry* entry = i->second;
+ DocEntry* entry = i->second;
entry->Print(os);
- if ( gdcmSeqEntry* seqEntry = dynamic_cast<gdcmSeqEntry*>(entry) )
+ if ( SeqEntry* seqEntry = dynamic_cast<SeqEntry*>(entry) )
{
(void)seqEntry;
// Avoid the newline for a sequence:
* from the H Table
* @return
*/
-void gdcmElementSet::Write(FILE* fp, FileType filetype)
+void ElementSet::Write(FILE* fp, FileType filetype)
{
for (TagDocEntryHT::const_iterator i = TagHT.begin(); i != TagHT.end(); ++i)
{
* \brief add a new Dicom Element pointer to the H Table
* @param newEntry entry to add
*/
-bool gdcmElementSet::AddEntry( gdcmDocEntry* newEntry)
+bool ElementSet::AddEntry( DocEntry* newEntry)
{
- gdcmTagKey key = newEntry->GetKey();
+ TagKey key = newEntry->GetKey();
if( TagHT.count(key) == 1 )
{
- dbg.Verbose(1, "gdcmElementSet::AddEntry key already present: ",
+ dbg.Verbose(1, "ElementSet::AddEntry key already present: ",
key.c_str());
return(false);
}
* \brief Clear the hash table from given entry BUT keep the entry.
* @param entryToRemove Entry to remove.
*/
-bool gdcmElementSet::RemoveEntryNoDestroy( gdcmDocEntry* entryToRemove)
+bool ElementSet::RemoveEntryNoDestroy( DocEntry* entryToRemove)
{
- gdcmTagKey key = entryToRemove->GetKey();
+ TagKey key = entryToRemove->GetKey();
if( TagHT.count(key) == 1 )
{
TagHT.erase(key);
- dbg.Verbose(0, "gdcmElementSet::RemoveEntry: one element erased.");
+ dbg.Verbose(0, "ElementSet::RemoveEntry: one element erased.");
return true;
}
- dbg.Verbose(0, "gdcmElementSet::RemoveEntry: key not present: ");
+ dbg.Verbose(0, "ElementSet::RemoveEntry: key not present: ");
return false ;
}
* \brief Clear the hash table from given entry AND delete the entry.
* @param entryToRemove Entry to remove AND delete.
*/
-bool gdcmElementSet::RemoveEntry( gdcmDocEntry* entryToRemove)
+bool ElementSet::RemoveEntry( DocEntry* entryToRemove)
{
- gdcmTagKey key = entryToRemove->GetKey();
+ TagKey key = entryToRemove->GetKey();
if( TagHT.count(key) == 1 )
{
TagHT.erase(key);
- dbg.Verbose(0, "gdcmElementSet::RemoveEntry: one element erased.");
+ dbg.Verbose(0, "ElementSet::RemoveEntry: one element erased.");
delete entryToRemove;
return true;
}
- dbg.Verbose(0, "gdcmElementSet::RemoveEntry: key not present: ");
+ dbg.Verbose(0, "ElementSet::RemoveEntry: key not present: ");
return false ;
}
+} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmElementSet.h,v $
Language: C++
- Date: $Date: 2004/10/07 18:09:11 $
- Version: $Revision: 1.18 $
+ Date: $Date: 2004/10/12 04:35:46 $
+ Version: $Revision: 1.19 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <map>
#include <iostream>
-class gdcmValEntry;
-class gdcmBinEntry;
-class gdcmSeqEntry;
+class ValEntry;
+class BinEntry;
+class SeqEntry;
+namespace gdcm
+{
-typedef std::map<gdcmTagKey, gdcmDocEntry *> TagDocEntryHT;
+typedef std::map<TagKey, DocEntry *> TagDocEntryHT;
//-----------------------------------------------------------------------------
-class GDCM_EXPORT gdcmElementSet : public gdcmDocEntrySet
+class GDCM_EXPORT ElementSet : public DocEntrySet
{
public:
- gdcmElementSet(int);
- ~gdcmElementSet();
- virtual bool AddEntry(gdcmDocEntry *Entry);
- bool RemoveEntry(gdcmDocEntry *EntryToRemove);
- bool RemoveEntryNoDestroy(gdcmDocEntry *EntryToRemove);
+ ElementSet(int);
+ ~ElementSet();
+ virtual bool AddEntry(DocEntry *Entry);
+ bool RemoveEntry(DocEntry *EntryToRemove);
+ bool RemoveEntryNoDestroy(DocEntry *EntryToRemove);
virtual void Print(std::ostream &os = std::cout);
virtual void Write(FILE *fp, FileType filetype);
private:
/// Just for following ::GetTagHT()
- friend class gdcmDocument;
+ friend class Document;
/// Accessor to \ref TagHT
TagDocEntryHT* GetTagHT() { return &TagHT; };
};
-
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmException.cxx,v $
Language: C++
- Date: $Date: 2004/10/08 04:52:55 $
- Version: $Revision: 1.19 $
+ Date: $Date: 2004/10/12 04:35:46 $
+ Version: $Revision: 1.20 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmException.h"
#include <typeinfo>
+namespace gdcm
+{
//-----------------------------------------------------------------------------
-// gdcmException
+// Exception
/**
- * \ingroup gdcmException
+ * \ingroup Exception
* \brief constructor
* @param f
* @param msg
*/
-gdcmException::gdcmException(const std::string &f, const std::string& msg) throw()
+Exception::Exception(const std::string &f, const std::string& msg) throw()
#ifdef __GNUC__
try
#endif
}
#ifdef __GNUC__
catch(...) {
- fatal("gdcmException::gdcmException(const std::string&, const std::string&, const std::string&)");
+ fatal("Exception::Exception(const std::string&, const std::string&, const std::string&)");
}
#endif
/**
- * \ingroup gdcmException
+ * \ingroup Exception
* \brief fatal
* @param from
*/
-void gdcmException::fatal(const char *from) throw() {
+void Exception::fatal(const char *from) throw() {
try
{
std::cerr << "Fatal: exception received in " << from
}
/**
- * \ingroup gdcmException
+ * \ingroup Exception
* \brief getName
* @return string
*/
-std::string gdcmException::getName() const throw()
+std::string Exception::getName() const throw()
{
try
{
}
/**
- * \ingroup gdcmException
- * \brief gdcmException
+ * \ingroup Exception
+ * \brief Exception
*/
- gdcmException::operator const char *() const throw() {
+ Exception::operator const char *() const throw() {
return getName().c_str();
}
//-----------------------------------------------------------------------------
/**
- * \ingroup gdcmException
- * \brief gdcmException::operator <<
+ * \ingroup Exception
+ * \brief Exception::operator <<
*/
- std::ostream& operator<<(std::ostream &os, const gdcmException &e) {
+ std::ostream& operator<<(std::ostream &os, const Exception &e) {
try {
os << "Exception " << e.getName() << " thrown: " << e.getError() << std::endl;
}
catch(...) {
- gdcmException::fatal("operator<<(std::ostream &, const gdcmException&)");
+ Exception::fatal("operator<<(std::ostream &, const Exception&)");
}
return os;
}
-
+} // end namespace gdcm
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmException.h,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:07 $
- Version: $Revision: 1.16 $
+ Date: $Date: 2004/10/12 04:35:46 $
+ Version: $Revision: 1.17 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <string>
#include <iostream>
#include <exception>
+namespace gdcm
+{
//-----------------------------------------------------------------------------
/*
* Any exception thrown in the gdcm library
*/
-class GDCM_EXPORT gdcmException : public std::exception
+class GDCM_EXPORT Exception : public std::exception
{
public:
/*
* @param from name of the thrower
* @param error error description string
*/
- explicit gdcmException(const std::string &from, const std::string &error = "")
+ explicit Exception(const std::string &from, const std::string &error = "")
throw();
/**
* \brief virtual destructor makes this class dynamic
*/
- virtual ~gdcmException() throw() {};
+ virtual ~Exception() throw() {};
/// exception caught within exception class: print error message and die
static void fatal(const char *from) throw();
/// returns exception name string
operator const char *() const throw();
- friend std::ostream& operator<<(std::ostream &os, const gdcmException &e);
+ friend std::ostream& operator<<(std::ostream &os, const Exception &e);
protected:
/// error message part 1
/*
* File error exception thrown in the gdcm library
*/
-class GDCM_EXPORT gdcmFileError : public gdcmException
+class GDCM_EXPORT FileError : public Exception
{
public:
/**
* @param from name of the thrower
* @param error error description string
*/
- explicit gdcmFileError(const std::string &from,
+ explicit FileError(const std::string &from,
const std::string &error = "File error")
- throw() : gdcmException(from, error) { }
+ throw() : Exception(from, error) { }
};
/**
* \brief Unexpected file format exception
*/
-class GDCM_EXPORT gdcmFormatUnexpected : public gdcmException
+class GDCM_EXPORT FormatUnexpected : public Exception
{
public:
/// \brief Builds a file-related exception with minimal information:
/// name of the thrower method and error message
/// @param from name of the thrower
/// @param error error description string
- explicit gdcmFormatUnexpected(const std::string &from,
+ explicit FormatUnexpected(const std::string &from,
const std::string &error = "Unexpected file format")
- throw() : gdcmException( from, error ) { }
+ throw() : Exception( from, error ) { }
};
//-----------------------------------------------------------------------------
/**
* \brief Invalid file format exception
*/
-class GDCM_EXPORT gdcmFormatError : public gdcmFormatUnexpected
+class GDCM_EXPORT FormatError : public FormatUnexpected
{
public:
/// \brief Builds a file-related exception with minimal information:
/// name of the thrower method and error message
/// @param from name of the thrower
/// @param error error description string
- explicit gdcmFormatError(const std::string &from,
+ explicit FormatError(const std::string &from,
const std::string &error = "Invalid file format")
- throw() : gdcmFormatUnexpected( from, error ) { }
+ throw() : FormatUnexpected( from, error ) { }
};
//-----------------------------------------------------------------------------
* @param e exception to print
* @returns output stream os
*/
-std::ostream& operator<<(std::ostream &os, const gdcmException &e);
+std::ostream& operator<<(std::ostream &os, const Exception &e);
+
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif // GDCM_EXCEPTION_H
Program: gdcm
Module: $RCSfile: gdcmFile.cxx,v $
Language: C++
- Date: $Date: 2004/10/10 16:44:00 $
- Version: $Revision: 1.138 $
+ Date: $Date: 2004/10/12 04:35:46 $
+ Version: $Revision: 1.139 $
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"
+namespace gdcm
+{
typedef std::pair<TagDocEntryHT::iterator,TagDocEntryHT::iterator> IterHT;
//-------------------------------------------------------------------------
// Constructor / Destructor
/**
* \brief Constructor dedicated to deal with the *pixels* area of a ACR/DICOMV3
- * file (gdcmHeader only deals with the ... header)
+ * file (Header only deals with the ... header)
* Opens (in read only and when possible) an existing file and checks
* for DICOM compliance. Returns NULL on failure.
* It will be up to the user to load the pixels into memory
* This avoid a double parsing of public part of the header when
* user sets an a posteriori shadow dictionary (efficiency can be
* seen as a side effect).
- * @param header already built gdcmHeader
+ * @param header already built Header
*/
-gdcmFile::gdcmFile(gdcmHeader *header)
+File::File(Header *header)
{
- Header = header;
+ HeaderInternal = header;
SelfHeader = false;
Initialise();
}
/**
* \brief Constructor dedicated to deal with the *pixels* area of a ACR/DICOMV3
- * file (gdcmHeader only deals with the ... header)
+ * file (Header only deals with the ... header)
* Opens (in read only and when possible) an existing file and checks
* for DICOM compliance. Returns NULL on failure.
* It will be up to the user to load the pixels into memory
* seen as a side effect).
* @param filename file to be opened for parsing
*/
-gdcmFile::gdcmFile(std::string const & filename )
+File::File(std::string const & filename )
{
- Header = new gdcmHeader( filename );
+ HeaderInternal = new Header( filename );
SelfHeader = true;
Initialise();
}
/**
* \brief Factorization for various forms of constructors.
*/
-void gdcmFile::Initialise()
+void File::Initialise()
{
- if ( Header->IsReadable() )
+ if ( HeaderInternal->IsReadable() )
{
ImageDataSizeRaw = ComputeDecompressedPixelDataSizeFromHeader();
- if ( Header->HasLUT() )
+ if ( HeaderInternal->HasLUT() )
{
ImageDataSize = 3 * ImageDataSizeRaw;
}
/**
* \brief canonical destructor
- * \note If the gdcmHeader was created by the gdcmFile constructor,
- * it is destroyed by the gdcmFile
+ * \note If the Header was created by the File constructor,
+ * it is destroyed by the File
*/
-gdcmFile::~gdcmFile()
+File::~File()
{
if( SelfHeader )
{
- delete Header;
+ delete HeaderInternal;
}
- Header = 0;
+ HeaderInternal = 0;
DeleteInitialValues();
}
* \brief Sets some initial values for the Constructor
* \warning not end user intended
*/
-void gdcmFile::SaveInitialValues()
+void File::SaveInitialValues()
{
PixelRead = -1; // no ImageData read yet.
InitialGreenLUTData = 0;
InitialBlueLUTData = 0;
- if ( Header->IsReadable() )
+ if ( HeaderInternal->IsReadable() )
{
// the following values *may* be modified
- // by gdcmFile::GetImageDataIntoVectorRaw
+ // by File::GetImageDataIntoVectorRaw
// we save their initial value.
- InitialSpp = Header->GetEntryByNumber(0x0028,0x0002);
- InitialPhotInt = Header->GetEntryByNumber(0x0028,0x0004);
- InitialPlanConfig = Header->GetEntryByNumber(0x0028,0x0006);
+ InitialSpp = HeaderInternal->GetEntryByNumber(0x0028,0x0002);
+ InitialPhotInt = HeaderInternal->GetEntryByNumber(0x0028,0x0004);
+ InitialPlanConfig = HeaderInternal->GetEntryByNumber(0x0028,0x0006);
- InitialBitsAllocated = Header->GetEntryByNumber(0x0028,0x0100);
- InitialHighBit = Header->GetEntryByNumber(0x0028,0x0102);
+ InitialBitsAllocated = HeaderInternal->GetEntryByNumber(0x0028,0x0100);
+ InitialHighBit = HeaderInternal->GetEntryByNumber(0x0028,0x0102);
// the following entries *may* be removed from the H table
- // (NOT deleted ...) by gdcmFile::GetImageDataIntoVectorRaw
+ // (NOT deleted ...) by File::GetImageDataIntoVectorRaw
// we keep a pointer on them.
- InitialRedLUTDescr = Header->GetDocEntryByNumber(0x0028,0x1101);
- InitialGreenLUTDescr = Header->GetDocEntryByNumber(0x0028,0x1102);
- InitialBlueLUTDescr = Header->GetDocEntryByNumber(0x0028,0x1103);
+ InitialRedLUTDescr = HeaderInternal->GetDocEntryByNumber(0x0028,0x1101);
+ InitialGreenLUTDescr = HeaderInternal->GetDocEntryByNumber(0x0028,0x1102);
+ InitialBlueLUTDescr = HeaderInternal->GetDocEntryByNumber(0x0028,0x1103);
- InitialRedLUTData = Header->GetDocEntryByNumber(0x0028,0x1201);
- InitialGreenLUTData = Header->GetDocEntryByNumber(0x0028,0x1202);
- InitialBlueLUTData = Header->GetDocEntryByNumber(0x0028,0x1203);
+ InitialRedLUTData = HeaderInternal->GetDocEntryByNumber(0x0028,0x1201);
+ InitialGreenLUTData = HeaderInternal->GetDocEntryByNumber(0x0028,0x1202);
+ InitialBlueLUTData = HeaderInternal->GetDocEntryByNumber(0x0028,0x1203);
}
}
* \brief restores some initial values
* \warning not end user intended
*/
-void gdcmFile::RestoreInitialValues()
+void File::RestoreInitialValues()
{
- if ( Header->IsReadable() )
+ if ( HeaderInternal->IsReadable() )
{
// the following values *may* have been modified
- // by gdcmFile::GetImageDataIntoVectorRaw
+ // by File::GetImageDataIntoVectorRaw
// we restore their initial value.
if ( InitialSpp != "")
- Header->SetEntryByNumber(InitialSpp,0x0028,0x0002);
+ HeaderInternal->SetEntryByNumber(InitialSpp,0x0028,0x0002);
if ( InitialPhotInt != "")
- Header->SetEntryByNumber(InitialPhotInt,0x0028,0x0004);
+ HeaderInternal->SetEntryByNumber(InitialPhotInt,0x0028,0x0004);
if ( InitialPlanConfig != "")
- Header->SetEntryByNumber(InitialPlanConfig,0x0028,0x0006);
+ HeaderInternal->SetEntryByNumber(InitialPlanConfig,0x0028,0x0006);
if ( InitialBitsAllocated != "")
- Header->SetEntryByNumber(InitialBitsAllocated,0x0028,0x0100);
+ HeaderInternal->SetEntryByNumber(InitialBitsAllocated,0x0028,0x0100);
if ( InitialHighBit != "")
- Header->SetEntryByNumber(InitialHighBit,0x0028,0x0102);
+ HeaderInternal->SetEntryByNumber(InitialHighBit,0x0028,0x0102);
// the following entries *may* be have been removed from the H table
- // (NOT deleted ...) by gdcmFile::GetImageDataIntoVectorRaw
+ // (NOT deleted ...) by File::GetImageDataIntoVectorRaw
// we restore them.
if (InitialRedLUTDescr)
- Header->AddEntry(InitialRedLUTDescr);
+ HeaderInternal->AddEntry(InitialRedLUTDescr);
if (InitialGreenLUTDescr)
- Header->AddEntry(InitialGreenLUTDescr);
+ HeaderInternal->AddEntry(InitialGreenLUTDescr);
if (InitialBlueLUTDescr)
- Header->AddEntry(InitialBlueLUTDescr);
+ HeaderInternal->AddEntry(InitialBlueLUTDescr);
if (InitialRedLUTData)
- Header->AddEntry(InitialBlueLUTDescr);
+ HeaderInternal->AddEntry(InitialBlueLUTDescr);
if (InitialGreenLUTData)
- Header->AddEntry(InitialGreenLUTData);
+ HeaderInternal->AddEntry(InitialGreenLUTData);
if (InitialBlueLUTData)
- Header->AddEntry(InitialBlueLUTData);
+ HeaderInternal->AddEntry(InitialBlueLUTData);
}
}
* \brief delete initial values (il they were saved)
* of InitialLutDescriptors and InitialLutData
*/
-void gdcmFile::DeleteInitialValues()
+void File::DeleteInitialValues()
{
// InitialLutDescriptors and InitialLutData
* \warning : it is NOT the group 7FE0 length
* (no interest for compressed images).
*/
-int gdcmFile::ComputeDecompressedPixelDataSizeFromHeader()
+int File::ComputeDecompressedPixelDataSizeFromHeader()
{
// see PS 3.3-2003 : C.7.6.3.2.1
//
// 0028|1203 [US] [Blue Palette Color Lookup Table Data]
// Number of "Bits Allocated"
- int numberBitsAllocated = Header->GetBitsAllocated();
+ int numberBitsAllocated = HeaderInternal->GetBitsAllocated();
if ( ( numberBitsAllocated == 0 ) || ( numberBitsAllocated == 12 ) )
{
numberBitsAllocated = 16;
}
- int DecompressedSize = Header->GetXSize()
- * Header->GetYSize()
- * Header->GetZSize()
+ int DecompressedSize = HeaderInternal->GetXSize()
+ * HeaderInternal->GetYSize()
+ * HeaderInternal->GetZSize()
* ( numberBitsAllocated / 8 )
- * Header->GetSamplesPerPixel();
+ * HeaderInternal->GetSamplesPerPixel();
return DecompressedSize;
}
* @return Pointer to newly allocated pixel data.
* NULL if alloc fails
*/
-uint8_t* gdcmFile::GetImageData()
+uint8_t* File::GetImageData()
{
// FIXME (Mathieu)
// I need to deallocate Pixel_Data before doing any allocation:
* @return On success, the number of bytes actually copied. Zero on
* failure e.g. MaxSize is lower than necessary.
*/
-size_t gdcmFile::GetImageDataIntoVector (void* destination, size_t maxSize)
+size_t File::GetImageDataIntoVector (void* destination, size_t maxSize)
{
GetImageDataIntoVectorRaw (destination, maxSize);
PixelRead = 0 ; // =0 : no ImageDataRaw
- if ( !Header->HasLUT() )
+ if ( !HeaderInternal->HasLUT() )
{
return ImageDataSize;
}
// from Lut R + Lut G + Lut B
uint8_t *newDest = new uint8_t[ImageDataSize];
uint8_t *a = (uint8_t *)destination;
- uint8_t *lutRGBA = Header->GetLUTRGBA();
+ uint8_t *lutRGBA = HeaderInternal->GetLUTRGBA();
if ( lutRGBA )
{
// FIXME : Better use CreateOrReplaceIfExist ?
std::string spp = "3"; // Samples Per Pixel
- Header->SetEntryByNumber(spp,0x0028,0x0002);
+ HeaderInternal->SetEntryByNumber(spp,0x0028,0x0002);
std::string rgb = "RGB "; // Photometric Interpretation
- Header->SetEntryByNumber(rgb,0x0028,0x0004);
+ HeaderInternal->SetEntryByNumber(rgb,0x0028,0x0004);
std::string planConfig = "0"; // Planar Configuration
- Header->SetEntryByNumber(planConfig,0x0028,0x0006);
+ HeaderInternal->SetEntryByNumber(planConfig,0x0028,0x0006);
}
else // GetLUTRGBA() failed
// It seems that *no Dicom Viewer* has any idea :-(
std::string photomInterp = "MONOCHROME1 "; // Photometric Interpretation
- Header->SetEntryByNumber(photomInterp,0x0028,0x0004);
+ HeaderInternal->SetEntryByNumber(photomInterp,0x0028,0x0004);
}
/// \todo Drop Palette Color out of the Header?
* @return Pointer to newly allocated pixel data.
* \ NULL if alloc fails
*/
-uint8_t* gdcmFile::GetImageDataRaw ()
+uint8_t* File::GetImageDataRaw ()
{
size_t imgDataSize;
- if ( Header->HasLUT() )
- /// \todo Let gdcmHeader user a chance to get the right value
+ if ( HeaderInternal->HasLUT() )
+ /// \todo Let Header user a chance to get the right value
imgDataSize = ImageDataSizeRaw;
else
imgDataSize = ImageDataSize;
* @return On success, the number of bytes actually copied. Zero on
* failure e.g. MaxSize is lower than necessary.
*/
-size_t gdcmFile::GetImageDataIntoVectorRaw (void* destination, size_t maxSize)
+size_t File::GetImageDataIntoVectorRaw (void* destination, size_t maxSize)
{
// we save the initial values of the following
// in order to be able to restore the header in a disk-consistent state
if ( ImageDataSize > maxSize )
{
- dbg.Verbose(0, "gdcmFile::GetImageDataIntoVector: pixel data bigger"
+ dbg.Verbose(0, "File::GetImageDataIntoVector: pixel data bigger"
"than caller's expected MaxSize");
return (size_t)0;
}
ReadPixelData( destination );
// Number of Bits Allocated for storing a Pixel
- int numberBitsAllocated = Header->GetBitsAllocated();
+ int numberBitsAllocated = HeaderInternal->GetBitsAllocated();
if ( numberBitsAllocated == 0 )
{
numberBitsAllocated = 16;
}
// Number of Bits actually used
- int numberBitsStored = Header->GetBitsStored();
+ int numberBitsStored = HeaderInternal->GetBitsStored();
if ( numberBitsStored == 0 )
{
numberBitsStored = numberBitsAllocated;
}
// High Bit Position
- int highBitPosition = Header->GetHighBitPosition();
+ int highBitPosition = HeaderInternal->GetHighBitPosition();
if ( highBitPosition == 0 )
{
highBitPosition = numberBitsAllocated - 1;
}
- bool signedPixel = Header->IsSignedPixelData();
+ bool signedPixel = HeaderInternal->IsSignedPixelData();
- gdcmPixelConvert::ConvertReorderEndianity(
+ PixelConvert::ConvertReorderEndianity(
(uint8_t*) destination,
ImageDataSize,
numberBitsStored,
numberBitsAllocated,
- Header->GetSwapCode(),
+ HeaderInternal->GetSwapCode(),
signedPixel );
- gdcmPixelConvert::ConvertReArrangeBits(
+ PixelConvert::ConvertReArrangeBits(
(uint8_t*) destination,
ImageDataSize,
numberBitsStored,
// Deal with the color
// Monochrome pictures don't require color intervention
- if ( Header->IsMonochrome() )
+ if ( HeaderInternal->IsMonochrome() )
{
return ImageDataSize;
}
// PhotometricInterpretation=PALETTE COLOR
// and heuristic has to be found :-(
- int planConf = Header->GetPlanarConfiguration();
+ int planConf = HeaderInternal->GetPlanarConfiguration();
// Planar configuration = 2 ==> 1 gray Plane + 3 LUT
// ...and...
// whatever the Planar Configuration might be, "PALETTE COLOR "
// implies that we deal with the palette.
- if ( ( planConf == 2 ) || Header->IsPaletteColor() )
+ if ( ( planConf == 2 ) || HeaderInternal->IsPaletteColor() )
{
return ImageDataSize;
}
{
uint8_t* newDest = new uint8_t[ImageDataSize];
// Warning : YBR_FULL_422 acts as RGB
- if ( Header->IsYBRFull() )
+ if ( HeaderInternal->IsYBRFull() )
{
ConvertYcBcRPlanesToRGBPixels((uint8_t*)destination, newDest);
}
std::string photInt = "RGB "; // Photometric Interpretation
std::string planConfig = "0"; // Planar Configuration
- Header->SetEntryByNumber(spp,0x0028,0x0002);
- Header->SetEntryByNumber(photInt,0x0028,0x0004);
- Header->SetEntryByNumber(planConfig,0x0028,0x0006);
+ HeaderInternal->SetEntryByNumber(spp,0x0028,0x0002);
+ HeaderInternal->SetEntryByNumber(photInt,0x0028,0x0004);
+ HeaderInternal->SetEntryByNumber(planConfig,0x0028,0x0006);
return ImageDataSize;
}
* \brief Convert (Y plane, cB plane, cR plane) to RGB pixels
* \warning Works on all the frames at a time
*/
-void gdcmFile::ConvertYcBcRPlanesToRGBPixels(uint8_t* source,
+void File::ConvertYcBcRPlanesToRGBPixels(uint8_t* source,
uint8_t* destination)
{
// to see the tricks about YBR_FULL, YBR_FULL_422,
// ftp://medical.nema.org/medical/dicom/final/sup61_ft.pdf
// and be *very* affraid
//
- int l = Header->GetXSize() * Header->GetYSize();
- int nbFrames = Header->GetZSize();
+ int l = HeaderInternal->GetXSize() * HeaderInternal->GetYSize();
+ int nbFrames = HeaderInternal->GetZSize();
uint8_t* a = source;
uint8_t* b = source + l;
* \brief Convert (Red plane, Green plane, Blue plane) to RGB pixels
* \warning Works on all the frames at a time
*/
-void gdcmFile::ConvertRGBPlanesToRGBPixels(uint8_t* source,
+void File::ConvertRGBPlanesToRGBPixels(uint8_t* source,
uint8_t* destination)
{
- int l = Header->GetXSize() * Header->GetYSize() * Header->GetZSize();
+ int l = HeaderInternal->GetXSize() * HeaderInternal->GetYSize() * HeaderInternal->GetZSize();
uint8_t* a = source;
uint8_t* b = source + l;
*
* @return boolean
*/
-bool gdcmFile::SetImageData(uint8_t* inData, size_t expectedSize)
+bool File::SetImageData(uint8_t* inData, size_t expectedSize)
{
- Header->SetImageDataSize( expectedSize );
+ HeaderInternal->SetImageDataSize( expectedSize );
// FIXME : if already allocated, memory leak !
Pixel_Data = inData;
ImageDataSize = ImageDataSizeRaw = expectedSize;
* @return false if write fails
*/
-bool gdcmFile::WriteRawData(std::string const & fileName)
+bool File::WriteRawData(std::string const & fileName)
{
FILE* fp1 = fopen(fileName.c_str(), "wb");
if (fp1 == NULL)
* @return false if write fails
*/
-bool gdcmFile::WriteDcmImplVR (std::string const & fileName)
+bool File::WriteDcmImplVR (std::string const & fileName)
{
- return WriteBase(fileName, gdcmImplicitVR);
+ return WriteBase(fileName, ImplicitVR);
}
/**
* @return false if write fails
*/
-bool gdcmFile::WriteDcmExplVR (std::string const & fileName)
+bool File::WriteDcmExplVR (std::string const & fileName)
{
- return WriteBase(fileName, gdcmExplicitVR);
+ return WriteBase(fileName, ExplicitVR);
}
/**
* @return false if write fails
*/
-bool gdcmFile::WriteAcr (std::string const & fileName)
+bool File::WriteAcr (std::string const & fileName)
{
- return WriteBase(fileName, gdcmACR);
+ return WriteBase(fileName, ACR);
}
//-----------------------------------------------------------------------------
* @param type file type (ExplicitVR, ImplicitVR, ...)
* @return false if write fails
*/
-bool gdcmFile::WriteBase (std::string const & fileName, FileType type)
+bool File::WriteBase (std::string const & fileName, FileType type)
{
- if ( PixelRead == -1 && type != gdcmExplicitVR)
+ if ( PixelRead == -1 && type != ExplicitVR)
{
return false;
}
return false;
}
- if ( type == gdcmImplicitVR || type == gdcmExplicitVR )
+ if ( type == ImplicitVR || type == ExplicitVR )
{
// writing Dicom File Preamble
uint8_t* filePreamble = new uint8_t[128];
/// but pb expected if user deals with, e.g. COMPLEX images
std::string rows, columns;
- if ( Header->GetFileType() == gdcmACR_LIBIDO)
+ if ( HeaderInternal->GetFileType() == ACR_LIBIDO)
{
- rows = Header->GetEntryByNumber(0x0028, 0x0010);
- columns = Header->GetEntryByNumber(0x0028, 0x0011);
+ rows = HeaderInternal->GetEntryByNumber(0x0028, 0x0010);
+ columns = HeaderInternal->GetEntryByNumber(0x0028, 0x0011);
- Header->SetEntryByNumber(columns, 0x0028, 0x0010);
- Header->SetEntryByNumber(rows , 0x0028, 0x0011);
+ HeaderInternal->SetEntryByNumber(columns, 0x0028, 0x0010);
+ HeaderInternal->SetEntryByNumber(rows , 0x0028, 0x0011);
}
// ----------------- End of Special Patch ----------------
- uint16_t grPixel = Header->GetGrPixel();
- uint16_t numPixel = Header->GetNumPixel();;
+ uint16_t grPixel = HeaderInternal->GetGrPixel();
+ uint16_t numPixel = HeaderInternal->GetNumPixel();;
- gdcmDocEntry* PixelElement =
+ DocEntry* PixelElement =
GetHeader()->GetDocEntryByNumber(grPixel, numPixel);
if ( PixelRead == 1 )
PixelElement->SetLength( ImageDataSize );
}
- Header->Write(fp1, type);
+ HeaderInternal->Write(fp1, type);
// --------------------------------------------------------------
// Special Patch to allow gdcm to re-write ACR-LibIDO formated images
// ...and we restore the Header to be Dicom Compliant again
// just after writting
- if ( Header->GetFileType() == gdcmACR_LIBIDO )
+ if ( HeaderInternal->GetFileType() == ACR_LIBIDO )
{
- Header->SetEntryByNumber(rows , 0x0028, 0x0010);
- Header->SetEntryByNumber(columns, 0x0028, 0x0011);
+ HeaderInternal->SetEntryByNumber(rows , 0x0028, 0x0010);
+ HeaderInternal->SetEntryByNumber(columns, 0x0028, 0x0011);
}
// ----------------- End of Special Patch ----------------
* @param destination where the pixel data should be stored.
*
*/
-bool gdcmFile::ReadPixelData(void* destination)
+bool File::ReadPixelData(void* destination)
{
- FILE* fp = Header->OpenFile();
+ FILE* fp = HeaderInternal->OpenFile();
if ( !fp )
{
return false;
}
- if ( fseek(fp, Header->GetPixelOffset(), SEEK_SET) == -1 )
+ if ( fseek(fp, HeaderInternal->GetPixelOffset(), SEEK_SET) == -1 )
{
- Header->CloseFile();
+ HeaderInternal->CloseFile();
return false;
}
- if ( Header->GetBitsAllocated() == 12 )
+ if ( HeaderInternal->GetBitsAllocated() == 12 )
{
- gdcmPixelConvert::ConvertDecompress12BitsTo16Bits(
+ PixelConvert::ConvertDecompress12BitsTo16Bits(
(uint8_t*)destination,
- Header->GetXSize(),
- Header->GetYSize(),
+ HeaderInternal->GetXSize(),
+ HeaderInternal->GetYSize(),
fp);
- Header->CloseFile();
+ HeaderInternal->CloseFile();
return true;
}
// ---------------------- Uncompressed File
- if ( !Header->IsDicomV3() ||
- Header->IsImplicitVRLittleEndianTransferSyntax() ||
- Header->IsExplicitVRLittleEndianTransferSyntax() ||
- Header->IsExplicitVRBigEndianTransferSyntax() ||
- Header->IsDeflatedExplicitVRLittleEndianTransferSyntax() )
+ if ( !HeaderInternal->IsDicomV3() ||
+ HeaderInternal->IsImplicitVRLittleEndianTransferSyntax() ||
+ HeaderInternal->IsExplicitVRLittleEndianTransferSyntax() ||
+ HeaderInternal->IsExplicitVRBigEndianTransferSyntax() ||
+ HeaderInternal->IsDeflatedExplicitVRLittleEndianTransferSyntax() )
{
- size_t ItemRead = fread(destination, Header->GetPixelAreaLength(), 1, fp);
- Header->CloseFile();
+ size_t ItemRead = fread(destination, HeaderInternal->GetPixelAreaLength(), 1, fp);
+ HeaderInternal->CloseFile();
if ( ItemRead != 1 )
{
return false;
}
// ---------------------- Run Length Encoding
- if ( Header->IsRLELossLessTransferSyntax() )
+ if ( HeaderInternal->IsRLELossLessTransferSyntax() )
{
- bool res = gdcmPixelConvert::ReadAndDecompressRLEFile(
+ bool res = PixelConvert::ReadAndDecompressRLEFile(
destination,
- Header->GetXSize(),
- Header->GetYSize(),
- Header->GetZSize(),
- Header->GetBitsAllocated(),
- &(Header->RLEInfo),
+ HeaderInternal->GetXSize(),
+ HeaderInternal->GetYSize(),
+ HeaderInternal->GetZSize(),
+ HeaderInternal->GetBitsAllocated(),
+ &(HeaderInternal->RLEInfo),
fp );
- Header->CloseFile();
+ HeaderInternal->CloseFile();
return res;
}
// --------------- SingleFrame/Multiframe JPEG Lossless/Lossy/2000
- int numberBitsAllocated = Header->GetBitsAllocated();
+ int numberBitsAllocated = HeaderInternal->GetBitsAllocated();
if ( ( numberBitsAllocated == 0 ) || ( numberBitsAllocated == 12 ) )
{
numberBitsAllocated = 16;
}
- bool res = gdcmPixelConvert::ReadAndDecompressJPEGFile(
+ bool res = PixelConvert::ReadAndDecompressJPEGFile(
(uint8_t*)destination,
- Header->GetXSize(),
- Header->GetYSize(),
- Header->GetBitsAllocated(),
- Header->GetBitsStored(),
- Header->GetSamplesPerPixel(),
- Header->GetPixelSize(),
- Header->IsJPEG2000(),
- Header->IsJPEGLossless(),
- &(Header->JPEGInfo),
+ HeaderInternal->GetXSize(),
+ HeaderInternal->GetYSize(),
+ HeaderInternal->GetBitsAllocated(),
+ HeaderInternal->GetBitsStored(),
+ HeaderInternal->GetSamplesPerPixel(),
+ HeaderInternal->GetPixelSize(),
+ HeaderInternal->IsJPEG2000(),
+ HeaderInternal->IsJPEGLossless(),
+ &(HeaderInternal->JPEGInfo),
fp );
- Header->CloseFile();
+ HeaderInternal->CloseFile();
return res;
}
+} // end namespace gdcm
+
Program: gdcm
Module: $RCSfile: gdcmFile.h,v $
Language: C++
- Date: $Date: 2004/10/10 16:44:00 $
- Version: $Revision: 1.59 $
+ Date: $Date: 2004/10/12 04:35:46 $
+ Version: $Revision: 1.60 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmCommon.h"
#include "gdcmHeader.h"
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
/*
* In addition to Dicom header exploration, this class is designed
* for accessing the image/volume content. One can also use it to
* write Dicom/ACR-NEMA/RAW files.
*/
-class GDCM_EXPORT gdcmFile
+class GDCM_EXPORT File
{
public:
- gdcmFile( gdcmHeader *header );
- gdcmFile( std::string const& filename );
+ File( Header *header );
+ File( std::string const& filename );
- virtual ~gdcmFile();
+ virtual ~File();
/// Accessor to \ref Header
- gdcmHeader* GetHeader() { return Header; }
+ Header* GetHeader() { return HeaderInternal; }
int ComputeDecompressedPixelDataSizeFromHeader();
uint8_t* GetImageDataRaw();
size_t GetImageDataIntoVectorRaw(void* destination, size_t maxSize);
- // see also gdcmHeader::SetImageDataSize ?!?
+ // see also Header::SetImageDataSize ?!?
bool SetImageData (uint8_t* data, size_t expectedSize);
/// \todo When the caller is aware we simply point to the data:
virtual bool SetEntryByNumber(std::string const& content,
uint16_t group, uint16_t element)
{
- Header->SetEntryByNumber(content,group,element);
+ HeaderInternal->SetEntryByNumber(content,group,element);
return true;
}
int image_width, int image_height,
int quality);
- void SaveInitialValues(); // will belong to the future gdcmPixelData class
- void RestoreInitialValues(); // will belong to the future gdcmPixelData class
- void DeleteInitialValues(); // will belong to the future gdcmPixelData class
+ void SaveInitialValues(); // will belong to the future PixelData class
+ void RestoreInitialValues(); // will belong to the future PixelData class
+ void DeleteInitialValues(); // will belong to the future PixelData class
// members variables:
/// \brief Header to use to load the file
- gdcmHeader *Header;
+ Header *HeaderInternal;
- /// \brief Whether the underlying \ref gdcmHeader was loaded by
+ /// \brief Whether the underlying \ref Header was loaded by
/// the constructor or passed to the constructor. When false
/// the destructor is in charge of deletion.
bool SelfHeader;
bool Parsed;
//
-// --------------- Will be moved to a gdcmPixelData class
+// --------------- Will be moved to a PixelData class
//
/// \brief to hold the Pixels (when read)
// We keep a pointer on them for a future use.
/// \brief Red Palette Color Lookup Table Descriptor 0028 1101 as read
- gdcmDocEntry* InitialRedLUTDescr;
+ DocEntry* InitialRedLUTDescr;
/// \brief Green Palette Color Lookup Table Descriptor 0028 1102 as read
- gdcmDocEntry* InitialGreenLUTDescr;
+ DocEntry* InitialGreenLUTDescr;
/// \brief Blue Palette Color Lookup Table Descriptor 0028 1103 as read
- gdcmDocEntry* InitialBlueLUTDescr;
+ DocEntry* InitialBlueLUTDescr;
/// \brief Red Palette Color Lookup Table Data 0028 1201 as read
- gdcmDocEntry* InitialRedLUTData;
+ DocEntry* InitialRedLUTData;
/// \brief Green Palette Color Lookup Table Data 0028 1202 as read
- gdcmDocEntry* InitialGreenLUTData;
+ DocEntry* InitialGreenLUTData;
/// \brief Blue Palette Color Lookup Table Data 0028 1203 as read
- gdcmDocEntry* InitialBlueLUTData;
+ DocEntry* InitialBlueLUTData;
//
-// --------------- end of future gdcmPixelData class
+// --------------- end of future PixelData class
//
};
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmGlobal.cxx,v $
Language: C++
- Date: $Date: 2004/10/08 04:52:55 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2004/10/12 04:35:46 $
+ Version: $Revision: 1.5 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmGlobal.h"
#include "gdcmDebug.h"
+namespace gdcm
+{
+
/**
* \ingroup Globals
* \brief Pointer to a container, holding _all_ the Dicom Dictionaries.
*/
-gdcmDictSet *gdcmGlobal::Dicts = (gdcmDictSet *)0;
+DictSet *Global::Dicts = (DictSet *)0;
/**
* \ingroup Globals
* \brief Pointer to a hash table containing the 'Value Representations'.
*/
-gdcmVR *gdcmGlobal::VR = (gdcmVR *)0;
+VR *Global::ValRes = (VR *)0;
/**
* \ingroup Globals
* \brief Pointer to a hash table containing the Transfer Syntax codes
* and their english description
*/
-gdcmTS *gdcmGlobal::TS = (gdcmTS *)0;
+TS *Global::TranSyn = (TS *)0;
/**
* \ingroup Globals
* \brief Pointer to the hash table containing the Dicom Elements
* necessary to describe each part of a DICOMDIR
*/
-gdcmDicomDirElement *gdcmGlobal::ddElem = (gdcmDicomDirElement *)0;
+DicomDirElement *Global::ddElem = (DicomDirElement *)0;
/**
* \ingroup Globals
* \brief Global container
*/
-gdcmGlobal gdcmGlob;
+Global Glob;
/**
- * \ingroup gdcmGlobal
+ * \ingroup Global
* \brief constructor : populates the various H Tables
*/
-gdcmGlobal::gdcmGlobal()
+Global::Global()
{
- if (VR || TS || Dicts || ddElem)
+ if (ValRes || TranSyn || Dicts || ddElem)
{
- dbg.Verbose(0, "gdcmGlobal::gdcmGlobal : VR or TS or Dicts already allocated");
+ dbg.Verbose(0, "Global::Global : VR or TS or Dicts already allocated");
}
- Dicts = new gdcmDictSet();
- VR = new gdcmVR();
- TS = new gdcmTS();
- ddElem = new gdcmDicomDirElement();
+ Dicts = new DictSet();
+ ValRes = new VR();
+ TranSyn = new TS();
+ ddElem = new DicomDirElement();
}
/**
- * \ingroup gdcmGlobal
+ * \ingroup Global
* \brief canonical destructor
*/
-gdcmGlobal::~gdcmGlobal()
+Global::~Global()
{
delete Dicts;
- delete VR;
- delete TS;
+ delete ValRes;
+ delete TranSyn;
delete ddElem;
}
/**
- * \ingroup gdcmGlobal
+ * \ingroup Global
* \brief returns a pointer to the 'Value Representation Table'
*/
-gdcmVR *gdcmGlobal::GetVR()
+VR *Global::GetVR()
{
- return VR;
+ return ValRes;
}
/**
- * \ingroup gdcmGlobal
+ * \ingroup Global
* \brief returns a pointer to the 'Transfert Syntax Table'
*/
-gdcmTS *gdcmGlobal::GetTS()
+TS *Global::GetTS()
{
- return TS;
+ return TranSyn;
}
/**
- * \ingroup gdcmGlobal
+ * \ingroup Global
* \brief returns a pointer to Dictionaries Table
*/
-gdcmDictSet *gdcmGlobal::GetDicts()
+DictSet *Global::GetDicts()
{
return Dicts;
}
/**
- * \ingroup gdcmGlobal
+ * \ingroup Global
* \brief returns a pointer to the DicomDir related elements Table
*/
-gdcmDicomDirElement *gdcmGlobal::GetDicomDirElements()
+DicomDirElement *Global::GetDicomDirElements()
{
return ddElem;
}
+} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmGlobal.h,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:07 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2004/10/12 04:35:46 $
+ 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
#include "gdcmDictSet.h"
#include "gdcmDicomDirElement.h"
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
/**
* \brief This class contains all globals elements that might be
* instanciated only once (singletons).
*/
-class GDCM_EXPORT gdcmGlobal {
+class GDCM_EXPORT Global
+{
public:
- gdcmGlobal(void);
- ~gdcmGlobal();
+ Global();
+ ~Global();
- static gdcmDictSet *GetDicts(void);
- static gdcmVR *GetVR(void);
- static gdcmTS *GetTS(void);
- static gdcmDicomDirElement *GetDicomDirElements(void);
+ static DictSet *GetDicts();
+ static VR *GetVR();
+ static TS *GetTS();
+ static DicomDirElement *GetDicomDirElements();
private:
- static gdcmDictSet *Dicts;
- static gdcmVR *VR;
- static gdcmTS *TS;
- static gdcmDicomDirElement *ddElem;
+ static DictSet *Dicts;
+ static VR *ValRes;
+ static TS *TranSyn;
+ static DicomDirElement *ddElem;
};
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmHeader.cxx,v $
Language: C++
- Date: $Date: 2004/10/10 00:42:54 $
- Version: $Revision: 1.192 $
+ Date: $Date: 2004/10/12 04:35:46 $
+ Version: $Revision: 1.193 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <vector>
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
// Constructor / Destructor
/**
* \brief Constructor
* @param filename name of the file whose header we want to analyze
*/
-gdcmHeader::gdcmHeader( std::string const & filename ):
- gdcmDocument( filename )
+Header::Header( std::string const & filename ):
+ Document( filename )
{
// for some ACR-NEMA images GrPixel, NumPixel is *not* 7fe0,0010
// We may encounter the 'RETired' (0x0028, 0x0200) tag
/**
* \brief Constructor
*/
-gdcmHeader::gdcmHeader()
- :gdcmDocument()
+Header::Header()
+ :Document()
{
}
/**
* \brief Canonical destructor.
*/
-gdcmHeader::~gdcmHeader ()
+Header::~Header ()
{
}
* @param filetype Type of the File to be written
* (ACR-NEMA, ExplicitVR, ImplicitVR)
*/
-void gdcmHeader::Write(FILE* fp,FileType filetype)
+void Header::Write(FILE* fp,FileType filetype)
{
// Bits Allocated
if ( GetEntryByNumber(0x0028,0x0100) == "12")
{
// no (GrPixel, NumPixel) element
std::string s_lgPix;
- s_lgPix = gdcmUtil::Format("%d", i_lgPix+12);
+ s_lgPix = Util::Format("%d", i_lgPix+12);
ReplaceOrCreateByNumber(s_lgPix,GrPixel, 0x0000);
}
- // FIXME : should be nice if we could move it to gdcmFile
+ // FIXME : should be nice if we could move it to File
// (or in future gdcmPixelData class)
// Drop Palette Color, if necessary
// Drop 0028|1101, 0028|1102, 0028|1103
// Drop 0028|1201, 0028|1202, 0028|1203
- gdcmDocEntry* e = GetDocEntryByNumber(0x0028,0x01101);
+ DocEntry* e = GetDocEntryByNumber(0x0028,0x01101);
if (e)
{
RemoveEntryNoDestroy(e);
RemoveEntryNoDestroy(e);
}
}
- gdcmDocument::Write(fp,filetype);
+ Document::Write(fp,filetype);
}
//-----------------------------------------------------------------------------
/**
* \brief This predicate, based on hopefully reasonable heuristics,
- * decides whether or not the current gdcmHeader was properly parsed
+ * decides whether or not the current Header was properly parsed
* and contains the mandatory information for being considered as
* a well formed and usable Dicom/Acr File.
- * @return true when gdcmHeader is the one of a reasonable Dicom/Acr file,
+ * @return true when Header is the one of a reasonable Dicom/Acr file,
* false otherwise.
*/
-bool gdcmHeader::IsReadable()
+bool Header::IsReadable()
{
- if( !gdcmDocument::IsReadable() )
+ if( !Document::IsReadable() )
{
return false;
}
* @return The encountered size when found, 0 by default.
* 0 means the file is NOT USABLE. The caller will have to check
*/
-int gdcmHeader::GetXSize()
+int Header::GetXSize()
{
std::string strSize;
strSize = GetEntryByNumber(0x0028,0x0011);
/**
* \brief Retrieve the number of lines of image.
- * \warning The defaulted value is 1 as opposed to gdcmHeader::GetXSize()
+ * \warning The defaulted value is 1 as opposed to Header::GetXSize()
* @return The encountered size when found, 1 by default
* (The ACR-NEMA file contains a Signal, not an Image).
*/
-int gdcmHeader::GetYSize()
+int Header::GetYSize()
{
std::string strSize = GetEntryByNumber(0x0028,0x0010);
if ( strSize != GDCM_UNFOUND )
* being the ACR-NEMA "Planes" tag content.
* @return The encountered size when found, 1 by default (single image).
*/
-int gdcmHeader::GetZSize()
+int Header::GetZSize()
{
// Both DicomV3 and ACR/Nema consider the "Number of Frames"
// as the third dimension.
* else 1.0
* @return X dimension of a pixel
*/
-float gdcmHeader::GetXSpacing()
+float Header::GetXSpacing()
{
float xspacing, yspacing;
std::string strSpacing = GetEntryByNumber(0x0028,0x0030);
if ( strSpacing == GDCM_UNFOUND )
{
- dbg.Verbose(0, "gdcmHeader::GetXSpacing: unfound Pixel Spacing (0028,0030)");
+ dbg.Verbose(0, "Header::GetXSpacing: unfound Pixel Spacing (0028,0030)");
return 1.;
}
}
if ( xspacing == 0.)
{
- dbg.Verbose(0, "gdcmHeader::GetYSpacing: gdcmData/CT-MONO2-8-abdo.dcm problem");
+ dbg.Verbose(0, "Header::GetYSpacing: gdcmData/CT-MONO2-8-abdo.dcm problem");
// seems to be a bug in the header ...
sscanf( strSpacing.c_str(), "%f\\0\\%f", &yspacing, &xspacing);
}
* else 1.0
* @return Y dimension of a pixel
*/
-float gdcmHeader::GetYSpacing()
+float Header::GetYSpacing()
{
float yspacing = 0;
std::string strSpacing = GetEntryByNumber(0x0028,0x0030);
if ( strSpacing == GDCM_UNFOUND )
{
- dbg.Verbose(0, "gdcmHeader::GetYSpacing: unfound Pixel Spacing (0028,0030)");
+ dbg.Verbose(0, "Header::GetYSpacing: unfound Pixel Spacing (0028,0030)");
return 1.;
}
* else 1.0
* @return Z dimension of a voxel-to be
*/
-float gdcmHeader::GetZSpacing()
+float Header::GetZSpacing()
{
// Spacing Between Slices : distance entre le milieu de chaque coupe
// Les coupes peuvent etre :
if ( strSpacingBSlices == GDCM_UNFOUND )
{
- dbg.Verbose(0, "gdcmHeader::GetZSpacing: unfound StrSpacingBSlices");
+ dbg.Verbose(0, "Header::GetZSpacing: unfound StrSpacingBSlices");
std::string strSliceThickness = GetEntryByNumber(0x0018,0x0050);
if ( strSliceThickness == GDCM_UNFOUND )
{
*\brief gets the info from 0028,1052 : Rescale Intercept
* @return Rescale Intercept
*/
-float gdcmHeader::GetRescaleIntercept()
+float Header::GetRescaleIntercept()
{
float resInter = 0.;
/// 0028 1052 DS IMG Rescale Intercept
if( sscanf( strRescInter.c_str(), "%f", &resInter) != 1 )
{
// bug in the element 0x0028,0x1052
- dbg.Verbose(0, "gdcmHeader::GetRescaleIntercept: Rescale Slope "
+ dbg.Verbose(0, "Header::GetRescaleIntercept: Rescale Slope "
"is empty");
}
}
*\brief gets the info from 0028,1053 : Rescale Slope
* @return Rescale Slope
*/
-float gdcmHeader::GetRescaleSlope()
+float Header::GetRescaleSlope()
{
float resSlope = 1.;
//0028 1053 DS IMG Rescale Slope
if( sscanf( strRescSlope.c_str(), "%f", &resSlope) != 1)
{
// bug in the element 0x0028,0x1053
- dbg.Verbose(0, "gdcmHeader::GetRescaleSlope: Rescale Slope is empty");
+ dbg.Verbose(0, "Header::GetRescaleSlope: Rescale Slope is empty");
}
}
* \warning to be used with GetImagePixels()
* @return 1 if Gray level, 3 if Color (RGB, YBR or PALETTE COLOR)
*/
-int gdcmHeader::GetNumberOfScalarComponents()
+int Header::GetNumberOfScalarComponents()
{
if ( GetSamplesPerPixel() == 3 )
{
* \warning to be used with GetImagePixelsRaw()
* @return 1 if Gray level, 3 if Color (RGB or YBR - NOT 'PALETTE COLOR' -)
*/
-int gdcmHeader::GetNumberOfScalarComponentsRaw()
+int Header::GetNumberOfScalarComponentsRaw()
{
// 0028 0100 US IMG Bits Allocated
// (in order no to be messed up by old RGB images)
- if ( gdcmHeader::GetEntryByNumber(0x0028,0x0100) == "24" )
+ if ( Header::GetEntryByNumber(0x0028,0x0100) == "24" )
{
return 3;
}
* else 0.
* @return up-left image corner X position
*/
-float gdcmHeader::GetXOrigin()
+float Header::GetXOrigin()
{
float xImPos, yImPos, zImPos;
std::string strImPos = GetEntryByNumber(0x0020,0x0032);
if ( strImPos == GDCM_UNFOUND )
{
- dbg.Verbose(0, "gdcmHeader::GetXImagePosition: unfound Image "
+ dbg.Verbose(0, "Header::GetXImagePosition: unfound Image "
"Position Patient (0020,0032)");
strImPos = GetEntryByNumber(0x0020,0x0030); // For ACR-NEMA images
if ( strImPos == GDCM_UNFOUND )
{
- dbg.Verbose(0, "gdcmHeader::GetXImagePosition: unfound Image "
+ dbg.Verbose(0, "Header::GetXImagePosition: unfound Image "
"Position (RET) (0020,0030)");
/// \todo How to tell the caller nothing was found ?
return 0.;
* else 0.
* @return up-left image corner Y position
*/
-float gdcmHeader::GetYOrigin()
+float Header::GetYOrigin()
{
float xImPos, yImPos, zImPos;
std::string strImPos = GetEntryByNumber(0x0020,0x0032);
if ( strImPos == GDCM_UNFOUND)
{
- dbg.Verbose(0, "gdcmHeader::GetYImagePosition: unfound Image "
+ dbg.Verbose(0, "Header::GetYImagePosition: unfound Image "
"Position Patient (0020,0032)");
strImPos = GetEntryByNumber(0x0020,0x0030); // For ACR-NEMA images
if ( strImPos == GDCM_UNFOUND )
{
- dbg.Verbose(0, "gdcmHeader::GetYImagePosition: unfound Image "
+ dbg.Verbose(0, "Header::GetYImagePosition: unfound Image "
"Position (RET) (0020,0030)");
/// \todo How to tell the caller nothing was found ?
return 0.;
* else 0.
* @return up-left image corner Z position
*/
-float gdcmHeader::GetZOrigin()
+float Header::GetZOrigin()
{
float xImPos, yImPos, zImPos;
std::string strImPos = GetEntryByNumber(0x0020,0x0032);
{
if( sscanf( strImPos.c_str(), "%f\\%f\\%f", &xImPos, &yImPos, &zImPos) != 3)
{
- dbg.Verbose(0, "gdcmHeader::GetZImagePosition: wrong Image "
+ dbg.Verbose(0, "Header::GetZImagePosition: wrong Image "
"Position Patient (0020,0032)");
return 0.; // bug in the element 0x0020,0x0032
}
if( sscanf( strImPos.c_str(),
"%f\\%f\\%f", &xImPos, &yImPos, &zImPos ) != 3 )
{
- dbg.Verbose(0, "gdcmHeader::GetZImagePosition: wrong Image Position (RET) (0020,0030)");
+ dbg.Verbose(0, "Header::GetZImagePosition: wrong Image Position (RET) (0020,0030)");
return 0.; // bug in the element 0x0020,0x0032
}
else
{
if( sscanf( strSliceLocation.c_str(), "%f", &zImPos) != 1)
{
- dbg.Verbose(0, "gdcmHeader::GetZImagePosition: wrong Slice Location (0020,1041)");
+ dbg.Verbose(0, "Header::GetZImagePosition: wrong Slice Location (0020,1041)");
return 0.; // bug in the element 0x0020,0x1041
}
else
return zImPos;
}
}
- dbg.Verbose(0, "gdcmHeader::GetZImagePosition: unfound Slice Location (0020,1041)");
+ dbg.Verbose(0, "Header::GetZImagePosition: unfound Slice Location (0020,1041)");
std::string strLocation = GetEntryByNumber(0x0020,0x0050);
if ( strLocation != GDCM_UNFOUND )
{
if( sscanf( strLocation.c_str(), "%f", &zImPos) != 1)
{
- dbg.Verbose(0, "gdcmHeader::GetZImagePosition: wrong Location (0020,0050)");
+ dbg.Verbose(0, "Header::GetZImagePosition: wrong Location (0020,0050)");
return 0.; // bug in the element 0x0020,0x0050
}
else
return zImPos;
}
}
- dbg.Verbose(0, "gdcmHeader::GetYImagePosition: unfound Location (0020,0050)");
+ dbg.Verbose(0, "Header::GetYImagePosition: unfound Location (0020,0050)");
return 0.; // Hopeless
}
* \brief gets the info from 0020,0013 : Image Number else 0.
* @return image number
*/
-int gdcmHeader::GetImageNumber()
+int Header::GetImageNumber()
{
// The function i atoi() takes the address of an area of memory as
// parameter and converts the string stored at that location to an integer
* \brief gets the info from 0008,0060 : Modality
* @return Modality Type
*/
-ModalityType gdcmHeader::GetModality()
+ModalityType Header::GetModality()
{
// 0008 0060 CS ID Modality
std::string strModality = GetEntryByNumber(0x0008,0x0060);
* @return The encountered number of Bits Stored, 0 by default.
* 0 means the file is NOT USABLE. The caller has to check it !
*/
-int gdcmHeader::GetBitsStored()
+int Header::GetBitsStored()
{
std::string strSize = GetEntryByNumber( 0x0028, 0x0101 );
if ( strSize == GDCM_UNFOUND )
{
- dbg.Verbose(0, "gdcmHeader::GetBitsStored: this is supposed to "
+ dbg.Verbose(0, "Header::GetBitsStored: this is supposed to "
"be mandatory");
return 0; // It's supposed to be mandatory
// the caller will have to check
* The responsability of checking this value is left to the caller.
* @return The high bit positin when present. 0 when absent.
*/
-int gdcmHeader::GetHighBitPosition()
+int Header::GetHighBitPosition()
{
std::string strSize = GetEntryByNumber( 0x0028, 0x0102 );
if ( strSize == GDCM_UNFOUND )
{
- dbg.Verbose(0, "gdcmHeader::GetHighBitPosition: this is supposed "
+ dbg.Verbose(0, "Header::GetHighBitPosition: this is supposed "
"to be mandatory");
return 0;
}
* The responsability of checking this value is left to the caller.
* @return True when signed, false when UNsigned
*/
-bool gdcmHeader::IsSignedPixelData()
+bool Header::IsSignedPixelData()
{
std::string strSize = GetEntryByNumber( 0x0028, 0x0103 );
if ( strSize == GDCM_UNFOUND )
{
- dbg.Verbose(0, "gdcmHeader::IsSignedPixelData: this is supposed "
+ dbg.Verbose(0, "Header::IsSignedPixelData: this is supposed "
"to be mandatory");
return false;
}
* @return The encountered number of Bits Allocated, 0 by default.
* 0 means the file is NOT USABLE. The caller has to check it !
*/
-int gdcmHeader::GetBitsAllocated()
+int Header::GetBitsAllocated()
{
std::string strSize = GetEntryByNumber(0x0028,0x0100);
if ( strSize == GDCM_UNFOUND )
{
- dbg.Verbose(0, "gdcmHeader::GetBitsStored: this is supposed to "
+ dbg.Verbose(0, "Header::GetBitsStored: this is supposed to "
"be mandatory");
return 0; // It's supposed to be mandatory
// the caller will have to check
* @return The encountered number of Samples Per Pixel, 1 by default.
* (Gray level Pixels)
*/
-int gdcmHeader::GetSamplesPerPixel()
+int Header::GetSamplesPerPixel()
{
std::string strSize = GetEntryByNumber(0x0028,0x0002);
if ( strSize == GDCM_UNFOUND )
{
- dbg.Verbose(0, "gdcmHeader::GetBitsStored: this is supposed to "
+ dbg.Verbose(0, "Header::GetBitsStored: this is supposed to "
"be mandatory");
return 1; // Well, it's supposed to be mandatory ...
// but sometimes it's missing : *we* assume Gray pixels
* the "Photometric Interpretation" tag ( 0x0028, 0x0004 ).
* @return true when "MONOCHROME1" or "MONOCHROME2". False otherwise.
*/
-bool gdcmHeader::IsMonochrome()
+bool Header::IsMonochrome()
{
std::string PhotometricInterp = GetEntryByNumber( 0x0028, 0x0004 );
if ( PhotometricInterp == "MONOCHROME1 "
}
if ( PhotometricInterp == GDCM_UNFOUND )
{
- dbg.Verbose(0, "gdcmHeader::IsMonochrome: absent Photometric "
+ dbg.Verbose(0, "Header::IsMonochrome: absent Photometric "
"Interpretation");
}
return false;
* the "Photometric Interpretation" tag ( 0x0028, 0x0004 ).
* @return true when "PALETTE COLOR". False otherwise.
*/
-bool gdcmHeader::IsPaletteColor()
+bool Header::IsPaletteColor()
{
std::string PhotometricInterp = GetEntryByNumber( 0x0028, 0x0004 );
if ( PhotometricInterp == "PALETTE COLOR " )
}
if ( PhotometricInterp == GDCM_UNFOUND )
{
- dbg.Verbose(0, "gdcmHeader::IsPaletteColor: absent Photometric "
+ dbg.Verbose(0, "Header::IsPaletteColor: absent Photometric "
"Interpretation");
}
return false;
* the "Photometric Interpretation" tag ( 0x0028, 0x0004 ).
* @return true when "YBR_FULL". False otherwise.
*/
-bool gdcmHeader::IsYBRFull()
+bool Header::IsYBRFull()
{
std::string PhotometricInterp = GetEntryByNumber( 0x0028, 0x0004 );
if ( PhotometricInterp == "YBR_FULL" )
}
if ( PhotometricInterp == GDCM_UNFOUND )
{
- dbg.Verbose(0, "gdcmHeader::IsYBRFull: absent Photometric "
+ dbg.Verbose(0, "Header::IsYBRFull: absent Photometric "
"Interpretation");
}
return false;
* (0 : RGB Pixels , 1 : R Plane + G Plane + B Plane)
* @return The encountered Planar Configuration, 0 by default.
*/
-int gdcmHeader::GetPlanarConfiguration()
+int Header::GetPlanarConfiguration()
{
std::string strSize = GetEntryByNumber(0x0028,0x0006);
if ( strSize == GDCM_UNFOUND )
* @return The size in bytes of a single pixel of data; 0 by default
* 0 means the file is NOT USABLE; the caller will have to check
*/
-int gdcmHeader::GetPixelSize()
+int Header::GetPixelSize()
{
// 0028 0100 US IMG Bits Allocated
// (in order no to be messed up by old RGB images)
- // if (gdcmHeader::GetEntryByNumber(0x0028,0x0100) == "24")
+ // if (Header::GetEntryByNumber(0x0028,0x0100) == "24")
// return 3;
std::string pixelType = GetPixelType();
{
return 8;
}
- dbg.Verbose(0, "gdcmHeader::GetPixelSize: Unknown pixel type");
+ dbg.Verbose(0, "Header::GetPixelSize: Unknown pixel type");
return 0;
}
* 24 bit images appear as 8 bit
* @return 0S if nothing found. NOT USABLE file. The caller has to check
*/
-std::string gdcmHeader::GetPixelType()
+std::string Header::GetPixelType()
{
std::string bitsAlloc = GetEntryByNumber(0x0028, 0x0100); // Bits Allocated
if ( bitsAlloc == GDCM_UNFOUND )
{
- dbg.Verbose(0, "gdcmHeader::GetPixelType: unfound Bits Allocated");
+ dbg.Verbose(0, "Header::GetPixelType: unfound Bits Allocated");
bitsAlloc = "16";
}
if (sign == GDCM_UNFOUND )
{
- dbg.Verbose(0, "gdcmHeader::GetPixelType: unfound Pixel Representation");
+ dbg.Verbose(0, "Header::GetPixelType: unfound Pixel Representation");
bitsAlloc = "0";
}
if ( sign == "0" )
* of *image* pixels (not *icone image* pixels, if any !)
* @return Pixel Offset
*/
-size_t gdcmHeader::GetPixelOffset()
+size_t Header::GetPixelOffset()
{
- gdcmDocEntry* pxlElement = GetDocEntryByNumber(GrPixel,NumPixel);
+ DocEntry* pxlElement = GetDocEntryByNumber(GrPixel,NumPixel);
if ( pxlElement )
{
return pxlElement->GetOffset();
* -in case of embeded compressed image-)
* 0 : NOT USABLE file. The caller has to check.
*/
-size_t gdcmHeader::GetPixelAreaLength()
+size_t Header::GetPixelAreaLength()
{
- gdcmDocEntry* pxlElement = GetDocEntryByNumber(GrPixel,NumPixel);
+ DocEntry* pxlElement = GetDocEntryByNumber(GrPixel,NumPixel);
if ( pxlElement )
{
return pxlElement->GetLength();
* Please warn me if you know sbdy that *does* know ... jprx
* @return true if LUT Descriptors and LUT Tables were found
*/
-bool gdcmHeader::HasLUT()
+bool Header::HasLUT()
{
// Check the presence of the LUT Descriptors, and LUT Tables
// LutDescriptorRed
* when (0028,0004),Photometric Interpretation = [PALETTE COLOR ]
* @ return bit number of each LUT item
*/
-int gdcmHeader::GetLUTNbits()
+int Header::GetLUTNbits()
{
std::vector<std::string> tokens;
int lutNbits;
}
tokens.clear(); // clean any previous value
- gdcmUtil::Tokenize ( lutDescription, tokens, "\\" );
+ Util::Tokenize ( lutDescription, tokens, "\\" );
//LutLength=atoi(tokens[0].c_str());
//LutDepth=atoi(tokens[1].c_str());
* no known Dicom reader deals with them :-(
* @return a RGBA Lookup Table
*/
-uint8_t* gdcmHeader::GetLUTRGBA()
+uint8_t* Header::GetLUTRGBA()
{
// Not so easy : see
// http://www.barre.nom.fr/medical/dicom2/limitations.html#Color%20Lookup%20Tables
&lengthR, &debR, &nbitsR );
if( nbRead != 3 )
{
- dbg.Verbose(0, "gdcmHeader::GetLUTRGBA: trouble reading red LUT");
+ dbg.Verbose(0, "Header::GetLUTRGBA: trouble reading red LUT");
}
// lengthG: Green LUT length in Bytes
&lengthG, &debG, &nbitsG );
if( nbRead != 3 )
{
- dbg.Verbose(0, "gdcmHeader::GetLUTRGBA: trouble reading green LUT");
+ dbg.Verbose(0, "Header::GetLUTRGBA: trouble reading green LUT");
}
// lengthB: Blue LUT length in Bytes
&lengthB, &debB, &nbitsB );
if( nbRead != 3 )
{
- dbg.Verbose(0, "gdcmHeader::GetLUTRGBA: trouble reading blue LUT");
+ dbg.Verbose(0, "Header::GetLUTRGBA: trouble reading blue LUT");
}
// Load LUTs into memory, (as they were stored on disk)
if ( !lutR || !lutG || !lutB )
{
- dbg.Verbose(0, "gdcmHeader::GetLUTRGBA: trouble with one of the LUT");
+ dbg.Verbose(0, "Header::GetLUTRGBA: trouble with one of the LUT");
return NULL;
}
// forge the 4 * 8 Bits Red/Green/Blue/Alpha LUT
}
/**
- * \brief Accesses the info from 0002,0010 : Transfert Syntax and gdcmTS
+ * \brief Accesses the info from 0002,0010 : Transfert Syntax and TS
* else 1.
* @return The full Transfert Syntax Name (as opposed to Transfert Syntax UID)
*/
-std::string gdcmHeader::GetTransfertSyntaxName()
+std::string Header::GetTransfertSyntaxName()
{
- // use the gdcmTS (TS : Transfert Syntax)
+ // use the TS (TS : Transfert Syntax)
std::string transfertSyntax = GetEntryByNumber(0x0002,0x0010);
if ( transfertSyntax == GDCM_NOTLOADED )
}
if ( transfertSyntax == GDCM_UNFOUND )
{
- dbg.Verbose(0, "gdcmHeader::GetTransfertSyntaxName:"
+ dbg.Verbose(0, "Header::GetTransfertSyntaxName:"
" unfound Transfert Syntax (0002,0010)");
return "Uncompressed ACR-NEMA";
}
transfertSyntax.erase(transfertSyntax.length()-1, 1);
}
// we do it only when we need it
- gdcmTS* ts = gdcmGlobal::GetTS();
+ TS* ts = Global::GetTS();
std::string tsName = ts->GetValue( transfertSyntax );
//delete ts; /// \todo Seg Fault when deleted ?!
* @param ImageDataSize new Pixel Area Size
* warning : nothing else is checked
*/
-void gdcmHeader::SetImageDataSize(size_t ImageDataSize)
+void Header::SetImageDataSize(size_t ImageDataSize)
{
///FIXME I don't understand this code wh ydo we set two times 'car' ?
- std::string car = gdcmUtil::Format("%d", ImageDataSize);
+ std::string car = Util::Format("%d", ImageDataSize);
- gdcmDocEntry *a = GetDocEntryByNumber(GrPixel, NumPixel);
+ DocEntry *a = GetDocEntryByNumber(GrPixel, NumPixel);
a->SetLength(ImageDataSize);
ImageDataSize += 8;
- car = gdcmUtil::Format("%d", ImageDataSize);
+ car = Util::Format("%d", ImageDataSize);
SetEntryByNumber(car, GrPixel, NumPixel);
}
* \brief anonymize a Header (removes Patient's personal info)
* (read the code to see which ones ...)
*/
-bool gdcmHeader::AnonymizeHeader()
+bool Header::AnonymizeHeader()
{
// If exist, replace by spaces
SetEntryByNumber (" ",0x0010, 0x2154); // Telephone
SetEntryByNumber (" ",0x0010, 0x1040); // Adress
SetEntryByNumber (" ",0x0010, 0x0020); // Patient ID
- gdcmDocEntry* patientNameHE = GetDocEntryByNumber (0x0010, 0x0010);
+ DocEntry* patientNameHE = GetDocEntryByNumber (0x0010, 0x0010);
if ( patientNameHE ) // we replace it by Study Instance UID (why not)
{
* @param iop adress of the (6)float aray to receive values
* @return cosines of image orientation patient
*/
-void gdcmHeader::GetImageOrientationPatient( float iop[6] )
+void Header::GetImageOrientationPatient( float iop[6] )
{
std::string strImOriPat;
//iop is supposed to be float[6]
if( sscanf( strImOriPat.c_str(), "%f\\%f\\%f\\%f\\%f\\%f",
&iop[0], &iop[1], &iop[2], &iop[3], &iop[4], &iop[5]) != 6 )
{
- dbg.Verbose(0, "gdcmHeader::GetImageOrientationPatient: "
+ dbg.Verbose(0, "Header::GetImageOrientationPatient: "
"wrong Image Orientation Patient (0020,0037)");
}
}
if( sscanf( strImOriPat.c_str(), "%f\\%f\\%f\\%f\\%f\\%f",
&iop[0], &iop[1], &iop[2], &iop[3], &iop[4], &iop[5]) != 6 )
{
- dbg.Verbose(0, "gdcmHeader::GetImageOrientationPatient: "
+ dbg.Verbose(0, "Header::GetImageOrientationPatient: "
"wrong Image Orientation Patient (0020,0035)");
}
}
// Private
//-----------------------------------------------------------------------------
+
+} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmHeader.h,v $
Language: C++
- Date: $Date: 2004/09/29 17:33:17 $
- Version: $Revision: 1.88 $
+ Date: $Date: 2004/10/12 04:35:46 $
+ Version: $Revision: 1.89 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmCommon.h"
#include "gdcmDocument.h"
+namespace gdcm
+{
+
+
//-----------------------------------------------------------------------------
/**
* \brief
- * The purpose of an instance of gdcmHeader is to act as a container of
+ * The purpose of an instance of Header is to act as a container of
* all the DICOM elements and their corresponding values (and
* additionaly the corresponding DICOM dictionary entry) of the header
* of a DICOM file.
*
- * The typical usage of instances of class gdcmHeader is to classify a set of
+ * The typical usage of instances of class Header is to classify a set of
* dicom files according to header information e.g. to create a file hierarchy
* reflecting the Patient/Study/Serie informations, or extracting a given
* SerieId. Accessing the content (image[s] or volume[s]) is beyond the
* functionality of this class and belongs to gdmcFile.
* \note The various entries of the explicit value representation (VR) shall
- * be managed within a dictionary which is shared by all gdcmHeader
+ * be managed within a dictionary which is shared by all Header
* instances.
- * \note The gdcmHeader::Set*Tag* family members cannot be defined as
+ * \note The Header::Set*Tag* family members cannot be defined as
* protected due to Swig limitations for as Has_a dependency between
- * gdcmFile and gdcmHeader.
+ * File and Header.
*/
//-----------------------------------------------------------------------------
};
//-----------------------------------------------------------------------------
-class GDCM_EXPORT gdcmHeader : public gdcmDocument
+class GDCM_EXPORT Header : public Document
{
protected:
/// \brief In some cases (e.g. for some ACR-NEMA images) the Header Entry Element
/// Number of the 'Pixel Element' is *not* found at 0x0010. In order to
/// make things easier the parser shall store the proper value in
/// NumPixel to provide a unique access facility. See also the constructor
- /// \ref gdcmHeader::gdcmHeader
+ /// \ref Header::Header
uint16_t NumPixel;
/// \brief In some cases (e.g. for some ACR-NEMA images) the header entry for
/// the group of pixels is *not* found at 0x7fe0. In order to
/// make things easier the parser shall store the proper value in
/// GrPixel to provide a unique access facility. See also the constructor
- /// \ref gdcmHeader::gdcmHeader
+ /// \ref Header::Header
uint16_t GrPixel;
public:
- gdcmHeader();
- gdcmHeader( std::string const & filename );
+ Header();
+ Header( std::string const & filename );
- virtual ~gdcmHeader();
+ virtual ~Header();
// Standard values and informations contained in the header
virtual bool IsReadable();
std::string GetTransfertSyntaxName();
- /// Accessor to \ref gdcmHeader::GrPixel
+ /// Accessor to \ref Header::GrPixel
uint16_t GetGrPixel() { return GrPixel; }
- /// Accessor to \ref gdcmHeader::NumPixel
+ /// Accessor to \ref Header::NumPixel
uint16_t GetNumPixel() { return NumPixel; }
- /// Read (used in gdcmFile)
+ /// Read (used in File)
void SetImageDataSize(size_t expectedSize);
void Write(FILE* fp, FileType filetype);
void GetImageOrientationPatient( float iop[6] );
private:
- friend class gdcmSerieHeader;
+ friend class SerieHeader;
};
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmHeaderHelper.cxx,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:07 $
- Version: $Revision: 1.42 $
+ Date: $Date: 2004/10/12 04:35:46 $
+ Version: $Revision: 1.43 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmHeaderHelper.h"
#include "gdcmDirList.h"
-
#include "gdcmDebug.h"
+
#include <math.h>
#include <algorithm>
#include <vector>
-typedef std::vector<gdcmHeader* > GdcmHeaderVector;
+namespace gdcm
+{
+
+typedef std::vector<Header* > GdcmHeaderVector;
//-----------------------------------------------------------------------------
// Constructor / Destructor
-gdcmSerieHeader::gdcmSerieHeader()
+SerieHeader::SerieHeader()
{
CoherentGdcmFileList.clear();
}
-gdcmSerieHeader::~gdcmSerieHeader()
+SerieHeader::~SerieHeader()
{
/// \todo
for ( GdcmHeaderList::const_iterator it = CoherentGdcmFileList.begin();
//-----------------------------------------------------------------------------
// Public
/**
- * \brief add a gdcmFile to the list based on file name
+ * \brief add a File to the list based on file name
* @param filename Name of the file to deal with
*/
-void gdcmSerieHeader::AddFileName(std::string const & filename)
+void SerieHeader::AddFileName(std::string const & filename)
{
- gdcmHeader *header = new gdcmHeader( filename );
+ Header *header = new Header( filename );
CoherentGdcmFileList.push_back( header );
}
/**
- * \brief add a gdcmFile to the list
- * @param file gdcmHeader to add
+ * \brief add a File to the list
+ * @param file Header to add
*/
-void gdcmSerieHeader::AddGdcmFile(gdcmHeader *file)
+void SerieHeader::AddGdcmFile(Header *file)
{
CoherentGdcmFileList.push_back( file );
}
* \brief Sets the Directory
* @param dir Name of the directory to deal with
*/
-void gdcmSerieHeader::SetDirectory(std::string const & dir)
+void SerieHeader::SetDirectory(std::string const & dir)
{
- gdcmDirList filenames_list(dir); //OS specific
+ DirList filenames_list(dir); //OS specific
- for( gdcmDirList::const_iterator it = filenames_list.begin();
+ for( DirList::const_iterator it = filenames_list.begin();
it != filenames_list.end(); ++it)
{
//use string and not const char*:
- gdcmHeader *header = new gdcmHeader( *it );
+ Header *header = new Header( *it );
CoherentGdcmFileList.push_back( header );
}
}
* But as I don't know how to do it, I leave it this way
* BTW, this is also a Strategy, I don't know this is the best approach :)
*/
-void gdcmSerieHeader::OrderGdcmFileList()
+void SerieHeader::OrderGdcmFileList()
{
if( ImagePositionPatientOrdering() )
{
//-----------------------------------------------------------------------------
// Private
/**
- * \ingroup gdcmHeader
+ * \ingroup Header
* \brief sorts the images, according to their Patient Position
* We may order, considering :
* -# Image Number
* -# More to come :)
* @return false only if the header is bugged !
*/
-bool gdcmSerieHeader::ImagePositionPatientOrdering()
+bool SerieHeader::ImagePositionPatientOrdering()
//based on Jolinda's algorithm
{
//iop is calculated based on the file file
}
/**
- * \ingroup gdcmHeader
+ * \ingroup Header
* \brief sorts the images, according to their Image Number
* @return false only if the header is bugged !
*/
-bool gdcmSerieHeader::ImageNumberOrdering()
+bool SerieHeader::ImageNumberOrdering()
{
int min, max, pos;
int n = 0;//CoherentGdcmFileList.size() is a O(N) operation !!
/**
- * \ingroup gdcmHeader
+ * \ingroup Header
* \brief sorts the images, according to their File Name
* @return false only if the header is bugged !
*/
-bool gdcmSerieHeader::FileNameOrdering()
+bool SerieHeader::FileNameOrdering()
{
//using the sort
//sort(CoherentGdcmFileList.begin(), CoherentGdcmFileList.end());
return true;
}
+} // end namespace gdcm
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmHeaderHelper.h,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:07 $
- Version: $Revision: 1.21 $
+ Date: $Date: 2004/10/12 04:35:46 $
+ Version: $Revision: 1.22 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmHeader.h"
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
/*
- * \defgroup gdcmSerieHeader
+ * \defgroup SerieHeader
* \brief
*
* - This class should be used for a stack of 2D dicom images.
- * - For a multiframe dicom image better use directly gdcmHeaderHelper
+ * - For a multiframe dicom image better use directly HeaderHelper
*/
-class GDCM_EXPORT gdcmSerieHeader
+class GDCM_EXPORT SerieHeader
{
public:
- gdcmSerieHeader();
- ~gdcmSerieHeader();
+ SerieHeader();
+ ~SerieHeader();
/// \todo should return bool or throw error ?
void AddFileName(std::string const & filename);
- void AddGdcmFile(gdcmHeader *file);
+ void AddGdcmFile(Header *file);
void SetDirectory(std::string const & dir);
void OrderGdcmFileList();
/// \warning Assumes all elements in the list have the same global infos.
/// Assumes the list is not empty.
- gdcmHeader* GetGdcmHeader() { return CoherentGdcmFileList.front(); }
+ Header* GetGdcmHeader() { return CoherentGdcmFileList.front(); }
- typedef std::list<gdcmHeader* > GdcmHeaderList;
+ typedef std::list<Header* > GdcmHeaderList;
/// \brief Gets the *coherent* File List
/// @return the *coherent* File List
GdcmHeaderList CoherentGdcmFileList;
};
+} // end namespace gdcm
+
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmJPEGFragment.h,v $
Language: C++
- Date: $Date: 2004/10/10 16:44:00 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2004/10/12 04:35:46 $
+ Version: $Revision: 1.2 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#define GDCMJPEGFRAGMENT_H
#include "gdcmCommon.h"
+namespace gdcm
+{
/**
* \brief Utility class for summerizing the informations of a JPEG
* - the fragment length
*
* Each instance of this class (they can be as many instances for
- * a given gdcmDocument as they are JPEG fragments and they are
- * collected in a \ref gdcmJPEGFragmentsInfo )
+ * a given Document as they are JPEG fragments and they are
+ * collected in a \ref JPEGFragmentsInfo )
*/
-class GDCM_EXPORT gdcmJPEGFragment
+class GDCM_EXPORT JPEGFragment
{
-friend class gdcmDocument;
-friend class gdcmFile;
-friend class gdcmPixelConvert;
+friend class Document;
+friend class File;
+friend class PixelConvert;
long Offset;
long Length;
- gdcmJPEGFragment()
+ JPEGFragment()
{
Offset = 0;
Length = 0;
}
};
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmJPEGFragmentsInfo.cxx,v $
Language: C++
- Date: $Date: 2004/10/10 16:44:00 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2004/10/12 04:35:46 $
+ Version: $Revision: 1.2 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmJPEGFragmentsInfo.h"
-gdcmJPEGFragmentsInfo::~gdcmJPEGFragmentsInfo()
+namespace gdcm
+{
+
+JPEGFragmentsInfo::~JPEGFragmentsInfo()
{
for(JPEGFragmentsList::iterator it = Fragments.begin();
it != Fragments.end();
}
Fragments.clear();
}
+} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmJPEGFragmentsInfo.h,v $
Language: C++
- Date: $Date: 2004/10/10 16:44:00 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2004/10/12 04:35:46 $
+ Version: $Revision: 1.2 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmJPEGFragment.h"
#include <list>
+namespace gdcm
+{
/**
* \brief Utility class for gathering the informations of the collection
- * of JPEG fragment[s] (see \ref gdcmJPEGFragment) when handling
+ * of JPEG fragment[s] (see \ref JPEGFragment) when handling
* "Encapsulated JPEG Compressed Images".
* The informations on each frame are obtained during the parsing
- * of a gdcmDocument (refer to
- * \ref gdcmDocument::ComputeJPEGFragmentInfo() ).
+ * of a Document (refer to
+ * \ref Document::ComputeJPEGFragmentInfo() ).
* They shall be used when (if necessary) decoding the fragments.
*
- * This class is simply a stl list<> of \ref gdcmJPEGFragment.
+ * This class is simply a stl list<> of \ref JPEGFragment.
*/
-class GDCM_EXPORT gdcmJPEGFragmentsInfo
+class GDCM_EXPORT JPEGFragmentsInfo
{
- typedef std::list< gdcmJPEGFragment* > JPEGFragmentsList;
-friend class gdcmDocument;
-friend class gdcmFile;
-friend class gdcmPixelConvert;
+ typedef std::list< JPEGFragment* > JPEGFragmentsList;
+friend class Document;
+friend class File;
+friend class PixelConvert;
JPEGFragmentsList Fragments;
public:
- ~gdcmJPEGFragmentsInfo();
+ ~JPEGFragmentsInfo();
};
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmJpeg12.cxx,v $
Language: C++
- Date: $Date: 2004/10/10 16:44:00 $
- Version: $Revision: 1.20 $
+ Date: $Date: 2004/10/12 04:35:46 $
+ Version: $Revision: 1.21 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "src/jpeg/libijg12/jpeglib.h"
#include <setjmp.h>
}
+namespace gdcm
+{
/******************** JPEG COMPRESSION SAMPLE INTERFACE *******************/
//
*/
/**
- * \ingroup gdcmFile
+ * \ingroup File
* \brief routine for JPEG decompression
* @param fp pointer to an already open file descriptor
* 12 significant bits per pixel
int row_stride;/* physical row width in output buffer */
#ifdef GDCM_JPG_DEBUG
- printf("entree dans gdcmFile::gdcm_read_JPEG_file12, depuis gdcmJpeg\n");
+ printf("entree dans File::gdcm_read_JPEG_file12, depuis gdcmJpeg\n");
#endif //GDCM_JPG_DEBUG
/* In this example we want to open the input file before doing anything else,
*/
//-----------------------------------------------------------------------------
+
+} // end namespace gdcm
+
Program: gdcm
Module: $RCSfile: gdcmJpeg2000.cxx,v $
Language: C++
- Date: $Date: 2004/10/10 16:44:00 $
- Version: $Revision: 1.11 $
+ Date: $Date: 2004/10/12 04:35:46 $
+ Version: $Revision: 1.12 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
//-----------------------------------------------------------------------------
#include "gdcmFile.h"
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
/**
* \brief routine for JPEG decompression
std::cout << "Sorry JPEG 2000 File not yet taken into account" << std::endl;
return false;
}
+} // end namespace gdcm
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmJpeg8.cxx,v $
Language: C++
- Date: $Date: 2004/10/10 16:44:00 $
- Version: $Revision: 1.5 $
+ Date: $Date: 2004/10/12 04:35:46 $
+ Version: $Revision: 1.6 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <setjmp.h>
}
+namespace gdcm
+{
/******************** JPEG COMPRESSION SAMPLE INTERFACE *******************/
*/
/**
- * \ingroup gdcmFile
+ * \ingroup File
* \brief routine for JPEG decompression
* @param fp pointer to an already open file descriptor
* 8 significant bits per pixel
int row_stride;/* physical row width in output buffer */
#ifdef GDCM_JPG_DEBUG
- printf("entree dans gdcmFile::gdcm_read_JPEG_file (i.e. 8), depuis gdcmJpeg\n");
+ printf("entree dans File::gdcm_read_JPEG_file (i.e. 8), depuis gdcmJpeg\n");
#endif //GDCM_JPG_DEBUG
/* In this example we want to open the input file before doing anything else,
*/
//----------------------------------------------------------------------------
+
+} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmParsePixels.cxx,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:07 $
- Version: $Revision: 1.11 $
+ Date: $Date: 2004/10/12 04:35:46 $
+ Version: $Revision: 1.12 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmCommon.h"
#include "gdcmFile.h"
+namespace gdcm
+{
+
#define str2num(str, typeNum) *((typeNum *)(str))
//-----------------------------------------------------------------------------
/**
- * \ingroup gdcmFile
+ * \ingroup File
* \brief Parse pixel data from disk and *prints* the result
* \ For multi-fragment Jpeg/Rle files checking purpose *only*
* \ Allows to 'see' if the file *does* conform
* \ with Dicom Part 3, Annex A (PS 3.5-2003, page 58, page 85)
*
*/
-bool gdcmFile::ParsePixelData(void) {
+bool File::ParsePixelData(void) {
// DO NOT remove the printf s.
// The ONLY purpose of this method is to PRINT the content
FILE* fp;
- if ( !(fp=Header->OpenFile()))
+ if ( !(fp=GetHeader()->OpenFile()))
return false;
- if ( fseek(fp, Header->GetPixelOffset(), SEEK_SET) == -1 ) {
- Header->CloseFile();
+ if ( fseek(fp, GetHeader()->GetPixelOffset(), SEEK_SET) == -1 ) {
+ GetHeader()->CloseFile();
return false;
}
- if ( !Header->IsDicomV3() ||
- Header->IsImplicitVRLittleEndianTransferSyntax() ||
- Header->IsExplicitVRLittleEndianTransferSyntax() ||
- Header->IsExplicitVRBigEndianTransferSyntax() ||
- Header->IsDeflatedExplicitVRLittleEndianTransferSyntax() ) {
+ if ( !GetHeader()->IsDicomV3() ||
+ GetHeader()->IsImplicitVRLittleEndianTransferSyntax() ||
+ GetHeader()->IsExplicitVRLittleEndianTransferSyntax() ||
+ GetHeader()->IsExplicitVRBigEndianTransferSyntax() ||
+ GetHeader()->IsDeflatedExplicitVRLittleEndianTransferSyntax() ) {
- printf ("gdcmFile::ParsePixelData : non JPEG/RLE File\n");
+ printf ("File::ParsePixelData : non JPEG/RLE File\n");
return false;
}
int nb;
- std::string str_nb=Header->GetEntryByNumber(0x0028,0x0100);
+ std::string str_nb=GetHeader()->GetEntryByNumber(0x0028,0x0100);
if (str_nb == GDCM_UNFOUND ) {
nb = 16;
} else {
}
//int nBytes= nb/8; //FIXME
- //int taille = Header->GetXSize() * Header->GetYSize() * Header->GetSamplesPerPixel();
+ //int taille = GetHeader()->GetXSize() * GetHeader()->GetYSize() * GetHeader()->GetSamplesPerPixel();
printf ("Checking the Dicom-encapsulated Jpeg/RLE Pixels\n");
// -------------------- for Parsing : Position on begining of Jpeg/RLE Pixels
- if( !Header->IsRLELossLessTransferSyntax()) {
+ if( !GetHeader()->IsRLELossLessTransferSyntax()) {
// JPEG Image
ftellRes=ftell(fp);
fread(&ItemTagGr,2,1,fp); //Reading (fffe):Basic Offset Table Item Tag Gr
fread(&ItemTagEl,2,1,fp); //Reading (e000):Basic Offset Table Item Tag El
- if(Header->GetSwapCode()) {
- ItemTagGr=Header->SwapShort(ItemTagGr);
- ItemTagEl=Header->SwapShort(ItemTagEl);
+ if(GetHeader()->GetSwapCode()) {
+ ItemTagGr=GetHeader()->SwapShort(ItemTagGr);
+ ItemTagEl=GetHeader()->SwapShort(ItemTagEl);
}
printf ("at %x : ItemTag (should be fffe,e000): %04x,%04x\n",
(unsigned)ftellRes,ItemTagGr,ItemTagEl );
ftellRes=ftell(fp);
fread(&ln,4,1,fp);
- if(Header->GetSwapCode())
- ln=Header->SwapLong(ln); // Basic Offset Table Item Length
+ if(GetHeader()->GetSwapCode())
+ ln=GetHeader()->SwapLong(ln); // Basic Offset Table Item Length
printf("at %x : Basic Offset Table Item Length (\?\?) %d x(%08x)\n",
(unsigned)ftellRes,ln,ln);
if (ln != 0) {
ftellRes=ftell(fp);
fread(&ItemTagGr,2,1,fp); // Reading (fffe) : Item Tag Gr
fread(&ItemTagEl,2,1,fp); // Reading (e000) : Item Tag El
- if(Header->GetSwapCode()) {
- ItemTagGr=Header->SwapShort(ItemTagGr);
- ItemTagEl=Header->SwapShort(ItemTagEl);
+ if(GetHeader()->GetSwapCode()) {
+ ItemTagGr=GetHeader()->SwapShort(ItemTagGr);
+ ItemTagEl=GetHeader()->SwapShort(ItemTagEl);
}
printf ("at %x : ItemTag (should be fffe,e000 or e0dd): %04x,%04x\n",
(unsigned)ftellRes,ItemTagGr,ItemTagEl );
ftellRes=ftell(fp);
fread(&ln,4,1,fp);
- if(Header->GetSwapCode())
- ln=Header->SwapLong(ln); // length
+ if(GetHeader()->GetSwapCode())
+ ln=GetHeader()->SwapLong(ln); // length
printf(" at %x : fragment length %d x(%08x)\n",
(unsigned)ftellRes, ln,ln);
ftellRes=ftell(fp);
fread(&ItemTagGr,2,1,fp); // Reading (fffe) : Item Tag Gr
fread(&ItemTagEl,2,1,fp); // Reading (e000) : Item Tag El
- if(Header->GetSwapCode()) {
- ItemTagGr=Header->SwapShort(ItemTagGr);
- ItemTagEl=Header->SwapShort(ItemTagEl);
+ if(GetHeader()->GetSwapCode()) {
+ ItemTagGr=GetHeader()->SwapShort(ItemTagGr);
+ ItemTagEl=GetHeader()->SwapShort(ItemTagEl);
}
printf ("at %x : ItemTag (should be fffe,e000 or e0dd): %04x,%04x\n",
(unsigned)ftellRes,ItemTagGr,ItemTagEl );
// Item Tag
fread(&ItemTagGr,2,1,fp); //Reading (fffe):Basic Offset Table Item Tag Gr
fread(&ItemTagEl,2,1,fp); //Reading (e000):Basic Offset Table Item Tag El
- if(Header->GetSwapCode()) {
- ItemTagGr=Header->SwapShort(ItemTagGr);
- ItemTagEl=Header->SwapShort(ItemTagEl);
+ if(GetHeader()->GetSwapCode()) {
+ ItemTagGr=GetHeader()->SwapShort(ItemTagGr);
+ ItemTagEl=GetHeader()->SwapShort(ItemTagEl);
}
printf ("at %x : ItemTag (should be fffe,e000): %04x,%04x\n",
(unsigned)ftellRes,ItemTagGr,ItemTagEl );
// Item Length
ftellRes=ftell(fp);
fread(&ln,4,1,fp);
- if(Header->GetSwapCode())
- ln=Header->SwapLong(ln); // Basic Offset Table Item Length
+ if(GetHeader()->GetSwapCode())
+ ln=GetHeader()->SwapLong(ln); // Basic Offset Table Item Length
printf("at %x : Basic Offset Table Item Length (\?\?) %d x(%08x)\n",
(unsigned)ftellRes,ln,ln);
if (ln != 0) {
ftellRes=ftell(fp);
fread(&ItemTagGr,2,1,fp); // Reading (fffe) : Item Tag Gr
fread(&ItemTagEl,2,1,fp); // Reading (e000) : Item Tag El
- if(Header->GetSwapCode()) {
- ItemTagGr=Header->SwapShort(ItemTagGr);
- ItemTagEl=Header->SwapShort(ItemTagEl);
+ if(GetHeader()->GetSwapCode()) {
+ ItemTagGr=GetHeader()->SwapShort(ItemTagGr);
+ ItemTagEl=GetHeader()->SwapShort(ItemTagEl);
}
printf ("at %x : ItemTag (should be fffe,e000 or e0dd): %04x,%04x\n",
(unsigned)ftellRes,ItemTagGr,ItemTagEl );
// Parse fragments of the current Fragment (Frame)
ftellRes=ftell(fp);
fread(&fragmentLength,4,1,fp);
- if(Header->GetSwapCode())
- fragmentLength=Header->SwapLong(fragmentLength); // length
+ if(GetHeader()->GetSwapCode())
+ fragmentLength=GetHeader()->SwapLong(fragmentLength); // length
printf(" at %x : 'fragment' length %d x(%08x)\n",
(unsigned)ftellRes, (unsigned)fragmentLength,(unsigned)fragmentLength);
//------------------ scanning (not reading) fragment pixels
fread(&nbRleSegments,4,1,fp); // Reading : Number of RLE Segments
- if(Header->GetSwapCode())
- nbRleSegments=Header->SwapLong(nbRleSegments);
+ if(GetHeader()->GetSwapCode())
+ nbRleSegments=GetHeader()->SwapLong(nbRleSegments);
printf(" Nb of RLE Segments : %d\n",nbRleSegments);
for(int k=1; k<=15; k++) { // Reading RLE Segments Offset Table
ftellRes=ftell(fp);
fread(&RleSegmentOffsetTable[k],4,1,fp);
- if(Header->GetSwapCode())
- RleSegmentOffsetTable[k]=Header->SwapLong(RleSegmentOffsetTable[k]);
+ if(GetHeader()->GetSwapCode())
+ RleSegmentOffsetTable[k]=GetHeader()->SwapLong(RleSegmentOffsetTable[k]);
printf(" at : %x Offset Segment %d : %d (%x)\n",
(unsigned)ftellRes,k,RleSegmentOffsetTable[k],
RleSegmentOffsetTable[k]);
ftellRes=ftell(fp);
fread(&ItemTagGr,2,1,fp); // Reading (fffe) : Item Tag Gr
fread(&ItemTagEl,2,1,fp); // Reading (e000) : Item Tag El
- if(Header->GetSwapCode()) {
- ItemTagGr=Header->SwapShort(ItemTagGr);
- ItemTagEl=Header->SwapShort(ItemTagEl);
+ if(GetHeader()->GetSwapCode()) {
+ ItemTagGr=GetHeader()->SwapShort(ItemTagGr);
+ ItemTagEl=GetHeader()->SwapShort(ItemTagEl);
}
printf ("at %x : ItemTag (should be fffe,e000 or e0dd): %04x,%04x\n",
(unsigned)ftellRes,ItemTagGr,ItemTagEl );
}
//-----------------------------------------------------------------------------
+} // end namespace gdcm
+
Program: gdcm
Module: $RCSfile: gdcmPixelConvert.cxx,v $
Language: C++
- Date: $Date: 2004/10/11 03:47:50 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2004/10/12 04:35:47 $
+ Version: $Revision: 1.8 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// Removing the prefix fixMem and dealing with allocations should do the trick
//
// grep PIXELCONVERT everywhere and clean up !
-
-
-#define str2num(str, typeNum) *((typeNum *)(str))
-
#include "gdcmDebug.h"
#include "gdcmPixelConvert.h"
// for JPEGLosslessDecodeImage
#include "jpeg/ljpg/jpegless.h"
+
+namespace gdcm
+{
+
+#define str2num(str, typeNum) *((typeNum *)(str))
+
// For JPEG 2000, body in file gdcmJpeg2000.cxx
bool gdcm_read_JPEG2000_file (FILE* fp, void* image_buffer);
//-----------------------------------------------------------------------------
// Constructor / Destructor
-gdcmPixelConvert::gdcmPixelConvert()
+PixelConvert::PixelConvert()
{
RGB = 0;
RGBSize = 0;
UncompressedSize = 0;
}
-void gdcmPixelConvert::Squeeze()
+void PixelConvert::Squeeze()
{
if ( RGB ) {
delete [] RGB;
}
}
-gdcmPixelConvert::~gdcmPixelConvert()
+PixelConvert::~PixelConvert()
{
Squeeze();
}
-void gdcmPixelConvert::AllocateRGB()
+void PixelConvert::AllocateRGB()
{
if ( RGB ) {
delete [] RGB;
RGB = new uint8_t[RGBSize];
}
-void gdcmPixelConvert::AllocateUncompressed()
+void PixelConvert::AllocateUncompressed()
{
if ( Uncompressed ) {
delete [] Uncompressed;
* \brief Read from file a 12 bits per pixel image and uncompress it
* into a 16 bits per pixel image.
*/
-void gdcmPixelConvert::ConvertDecompress12BitsTo16Bits(
+void PixelConvert::ConvertDecompress12BitsTo16Bits(
uint8_t* pixelZone,
int sizeX,
int sizeY,
FILE* filePtr)
- throw ( gdcmFormatError )
+ throw ( FormatError )
{
int nbPixels = sizeX * sizeY;
uint16_t* destination = (uint16_t*)pixelZone;
ItemRead = fread( &b0, 1, 1, filePtr);
if ( ItemRead != 1 )
{
- throw gdcmFormatError( "gdcmFile::ConvertDecompress12BitsTo16Bits()",
- "Unfound first block" );
+ throw FormatError( "File::ConvertDecompress12BitsTo16Bits()",
+ "Unfound first block" );
}
ItemRead = fread( &b1, 1, 1, filePtr);
if ( ItemRead != 1 )
{
- throw gdcmFormatError( "gdcmFile::ConvertDecompress12BitsTo16Bits()",
- "Unfound second block" );
+ throw FormatError( "File::ConvertDecompress12BitsTo16Bits()",
+ "Unfound second block" );
}
ItemRead = fread( &b2, 1, 1, filePtr);
if ( ItemRead != 1 )
{
- throw gdcmFormatError( "gdcmFile::ConvertDecompress12BitsTo16Bits()",
- "Unfound second block" );
+ throw FormatError( "File::ConvertDecompress12BitsTo16Bits()",
+ "Unfound second block" );
}
// Two steps are necessary to please VC++
* High Byte 'Planes'...(for what it may mean)
* @return Boolean
*/
-bool gdcmPixelConvert::UncompressRLE16BitsFromRLE8Bits(
+bool PixelConvert::UncompressRLE16BitsFromRLE8Bits(
int XSize,
int YSize,
int NumberOfFrames,
* \brief Implementation of the RLE decoding algorithm for uncompressing
* a RLE fragment. [refer to PS 3.5-2003, section G.3.2 p 86]
*/
-bool gdcmPixelConvert::ReadAndUncompressRLEFragment( uint8_t* decodedZone,
+bool PixelConvert::ReadAndUncompressRLEFragment( uint8_t* decodedZone,
long fragmentSize,
long uncompressedSegmentSize,
FILE* fp )
if ( numberOfReadBytes > fragmentSize )
{
- dbg.Verbose(0, "gdcmFile::gdcm_read_RLE_fragment: we read more "
+ dbg.Verbose(0, "File::gdcm_read_RLE_fragment: we read more "
"bytes than the segment size.");
return false;
}
* at which the pixel data should be copied
* @return Boolean
*/
-bool gdcmPixelConvert::ReadAndDecompressRLEFile( void* image_buffer,
+bool PixelConvert::ReadAndDecompressRLEFile( void* image_buffer,
int XSize,
int YSize,
int ZSize,
int BitsAllocated,
- gdcmRLEFramesInfo* RLEInfo,
+ RLEFramesInfo* RLEInfo,
FILE* fp )
{
uint8_t* im = (uint8_t*)image_buffer;
// Loop on the frame[s]
- for( gdcmRLEFramesInfo::RLEFrameList::iterator
+ for( RLEFramesInfo::RLEFrameList::iterator
it = RLEInfo->Frames.begin();
it != RLEInfo->Frames.end();
++it )
for( unsigned int k = 1; k <= (*it)->NumberFragments; k++ )
{
fseek( fp, (*it)->Offset[k] ,SEEK_SET );
- (void)gdcmPixelConvert::ReadAndUncompressRLEFragment(
+ (void)PixelConvert::ReadAndUncompressRLEFragment(
(uint8_t*) im, (*it)->Length[k],
uncompressedSegmentSize, fp );
im += uncompressedSegmentSize;
if ( BitsAllocated == 16 )
{
// Try to deal with RLE 16 Bits
- (void)gdcmPixelConvert::UncompressRLE16BitsFromRLE8Bits(
+ (void)PixelConvert::UncompressRLE16BitsFromRLE8Bits(
XSize,
YSize,
ZSize,
* @param lgr Area Length
* @param nb Pixels Bit number
*/
-void gdcmPixelConvert::SwapZone(void* im, int swap, int lgr, int nb)
+void PixelConvert::SwapZone(void* im, int swap, int lgr, int nb)
{
int i;
/**
* \brief Deal with endianity i.e. re-arange bytes inside the integer
*/
-void gdcmPixelConvert::ConvertReorderEndianity( uint8_t* pixelZone,
+void PixelConvert::ConvertReorderEndianity( uint8_t* pixelZone,
size_t imageDataSize,
int numberBitsStored,
int numberBitsAllocated,
* @param destination Where decompressed fragments should end up
* @return Boolean
*/
-bool gdcmPixelConvert::ReadAndDecompressJPEGFile( uint8_t* destination,
+bool PixelConvert::ReadAndDecompressJPEGFile( uint8_t* destination,
int XSize,
int YSize,
int BitsAllocated,
int PixelSize,
bool isJPEG2000,
bool isJPEGLossless,
- gdcmJPEGFragmentsInfo* JPEGInfo,
+ JPEGFragmentsInfo* JPEGInfo,
FILE* fp )
{
// Loop on the fragment[s]
- for( gdcmJPEGFragmentsInfo::JPEGFragmentsList::iterator
+ for( JPEGFragmentsInfo::JPEGFragmentsList::iterator
it = JPEGInfo->Fragments.begin();
it != JPEGInfo->Fragments.end();
++it )
else
{
// other JPEG lossy not supported
- dbg.Error(" gdcmFile::ReadPixelData : unknown jpeg lossy "
+ dbg.Error(" File::ReadPixelData : unknown jpeg lossy "
" compression ");
return false;
}
* @param destination Where decompressed fragments should end up
* @return Boolean
*/
-bool gdcmPixelConvert::ConvertReArrangeBits(
+bool PixelConvert::ConvertReArrangeBits(
uint8_t* pixelZone,
size_t imageDataSize,
int numberBitsStored,
int numberBitsAllocated,
int highBitPosition )
- throw ( gdcmFormatError )
+ throw ( FormatError )
{
if ( numberBitsStored != numberBitsAllocated )
{
}
else
{
- dbg.Verbose(0, "gdcmPixelConvert::ConvertReArrangeBits: weird image");
- throw gdcmFormatError( "gdcmFile::ConvertReArrangeBits()",
+ dbg.Verbose(0, "PixelConvert::ConvertReArrangeBits: weird image");
+ throw FormatError( "File::ConvertReArrangeBits()",
"weird image !?" );
}
}
return true; //???
}
-
+} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmPixelConvert.h,v $
Language: C++
- Date: $Date: 2004/10/10 16:44:00 $
- Version: $Revision: 1.5 $
+ Date: $Date: 2004/10/12 04:35:47 $
+ Version: $Revision: 1.6 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmJPEGFragmentsInfo.h"
#include "gdcmException.h"
+namespace gdcm
+{
+
/*
* \brief Utility container for gathering the various forms the pixel data
* migth take during the user demanded processes.
*/
-class GDCM_EXPORT gdcmPixelConvert {
-friend class gdcmFile;
+class GDCM_EXPORT PixelConvert {
+friend class File;
/// Pixel data represented as RGB after color interpretation
uint8_t* RGB;
size_t RGBSize; //aka ImageDataSize
uint8_t* Uncompressed;
size_t UncompressedSize;
public:
- gdcmPixelConvert();
- ~gdcmPixelConvert();
+ PixelConvert();
+ ~PixelConvert();
uint8_t* GetRGB() { return RGB; }
void SetRGBSize( size_t size ) { RGBSize = size; }
int YSize,
int ZSize,
int BitsAllocated,
- gdcmRLEFramesInfo* RLEInfo,
+ RLEFramesInfo* RLEInfo,
FILE* fp );
static void ConvertDecompress12BitsTo16Bits(
uint8_t* pixelZone,
int sizeX,
int sizeY,
- FILE* filePtr) throw ( gdcmFormatError );
+ FILE* filePtr) throw ( FormatError );
static void SwapZone(void* im, int swap, int lgr, int nb);
static void ConvertReorderEndianity(
uint8_t* pixelZone,
int PixelSize,
bool isJPEG2000,
bool isJPEGLossless,
- gdcmJPEGFragmentsInfo* JPEGInfo,
+ JPEGFragmentsInfo* JPEGInfo,
FILE* fp );
- static bool gdcmPixelConvert::ConvertReArrangeBits(
+ static bool PixelConvert::ConvertReArrangeBits(
uint8_t* pixelZone,
size_t imageDataSize,
int numberBitsStored,
int numberBitsAllocated,
- int highBitPosition ) throw ( gdcmFormatError );
+ int highBitPosition ) throw ( FormatError );
};
-
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmRLEFrame.h,v $
Language: C++
- Date: $Date: 2004/10/08 16:27:20 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2004/10/12 04:35:47 $
+ Version: $Revision: 1.5 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#define GDCMRLEFRAME_H
#include "gdcmCommon.h"
-
+namespace gdcm
+{
/**
* \brief Utility class for summerizing the informations of a SINGLE RLE
* frame of an "Encapsulated RLE Compressed Image" (refer to
* both the above RLE Header and the itemlength of the frame).
*
* Each instance of this class (they can be as many instances for
- * a given gdcmDocument as they are frames and they are collected in
- * a \ref gdcmRLEFramesInfo ) describes :
+ * a given Document as they are frames and they are collected in
+ * a \ref RLEFramesInfo ) describes :
* - the total number of segments (up to 15),
* - the offsets of each segment of the frame,
* - the (corresponding) lengths of each segment of the frame.
*/
-class GDCM_EXPORT gdcmRLEFrame
+class GDCM_EXPORT RLEFrame
{
-friend class gdcmDocument;
-friend class gdcmFile;
-friend class gdcmPixelConvert;
+friend class Document;
+friend class File;
+friend class PixelConvert;
int NumberFragments;
long Offset[15];
long Length[15];
- gdcmRLEFrame() { NumberFragments = 0; }
+ RLEFrame() { NumberFragments = 0; }
};
-
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmRLEFramesInfo.cxx,v $
Language: C++
- Date: $Date: 2004/10/06 09:58:08 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2004/10/12 04:35:47 $
+ Version: $Revision: 1.2 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmRLEFramesInfo.h"
-gdcmRLEFramesInfo::~gdcmRLEFramesInfo()
+namespace gdcm
+{
+
+RLEFramesInfo::~RLEFramesInfo()
{
for(RLEFrameList::iterator it = Frames.begin(); it != Frames.end(); ++it)
{
}
Frames.clear();
}
+} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmRLEFramesInfo.h,v $
Language: C++
- Date: $Date: 2004/10/10 16:44:00 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2004/10/12 04:35:47 $
+ Version: $Revision: 1.5 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmRLEFrame.h"
#include <list>
+namespace gdcm
+{
/**
* \brief Utility class for gathering the informations of the collection
- * of RLE frame[s] (see \ref gdcmRLEFrame) when handling
+ * of RLE frame[s] (see \ref RLEFrame) when handling
* "Encapsulated RLE Compressed Images" (see PS 3.5-2003 annex G).
* Note: a classical image can be considered as the degenerated case
* of a multiframe image. In this case the collection is limited
* to a single individual frame.
* The informations on each frame are obtained during the parsing
- * of a gdcmDocument (refer to
- * \ref gdcmDocument::ComputeRLEInfo() ).
+ * of a Document (refer to
+ * \ref Document::ComputeRLEInfo() ).
* They shall be used when (if necessary) decoding the frames.
*
- * This class is simply a stl list<> of \ref gdcmRLEFrame.
+ * This class is simply a stl list<> of \ref RLEFrame.
*/
-class GDCM_EXPORT gdcmRLEFramesInfo
+class GDCM_EXPORT RLEFramesInfo
{
- typedef std::list< gdcmRLEFrame* > RLEFrameList;
-friend class gdcmDocument;
-friend class gdcmFile;
-friend class gdcmPixelConvert;
+ typedef std::list< RLEFrame* > RLEFrameList;
+friend class Document;
+friend class File;
+friend class PixelConvert;
RLEFrameList Frames;
public:
- ~gdcmRLEFramesInfo();
+ ~RLEFramesInfo();
};
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmSQItem.cxx,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:07 $
- Version: $Revision: 1.28 $
+ Date: $Date: 2004/10/12 04:35:47 $
+ Version: $Revision: 1.29 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmBinEntry.h"
#include "gdcmGlobal.h"
#include "gdcmUtil.h"
-
#include "gdcmDebug.h"
+namespace gdcm
+{
//-----------------------------------------------------------------------------
// Constructor / Destructor
/**
- * \ingroup gdcmSQItem
- * \brief Constructor from a given gdcmSQItem
+ * \ingroup SQItem
+ * \brief Constructor from a given SQItem
*/
-gdcmSQItem::gdcmSQItem(int depthLevel )
- : gdcmDocEntrySet( )
+SQItem::SQItem(int depthLevel )
+ : DocEntrySet( )
{
SQDepthLevel = depthLevel;
}
/**
* \brief Canonical destructor.
*/
-gdcmSQItem::~gdcmSQItem()
+SQItem::~SQItem()
{
for(ListDocEntry::iterator cc = docEntries.begin();
cc != docEntries.end();
/*
* \brief canonical Printer
*/
- void gdcmSQItem::Print(std::ostream& os)
+ void SQItem::Print(std::ostream& os)
{
std::ostringstream s;
i != docEntries.end();
++i)
{
- gdcmDocEntry* Entry = *i;
+ DocEntry* Entry = *i;
bool PrintEndLine = true;
os << s.str();
Entry->SetPrintLevel(2);
Entry->Print(os);
- if ( gdcmSeqEntry* SeqEntry = dynamic_cast<gdcmSeqEntry*>(Entry) )
+ if ( SeqEntry* seqEntry = dynamic_cast<SeqEntry*>(Entry) )
{
- (void)SeqEntry; //not used
+ (void)seqEntry; //not used
PrintEndLine = false;
}
if (PrintEndLine)
}
/*
- * \ingroup gdcmSQItem
+ * \ingroup SQItem
* \brief canonical Writer
*/
-void gdcmSQItem::Write(FILE* fp,FileType filetype)
+void SQItem::Write(FILE* fp,FileType filetype)
{
uint16_t item[4] = { 0xfffe, 0xe000, 0xffff, 0xffff };
uint16_t itemt[4]= { 0xfffe, 0xe00d, 0xffff, 0xffff };
/**
* \brief adds any Entry (Dicom Element) to the Sequence Item
*/
-bool gdcmSQItem::AddEntry(gdcmDocEntry* entry)
+bool SQItem::AddEntry(DocEntry* entry)
{
docEntries.push_back(entry);
//TODO : check if it worked
* @return true if element was found or created successfully
*/
-bool gdcmSQItem::SetEntryByNumber(std::string val, uint16_t group,
+bool SQItem::SetEntryByNumber(std::string val, uint16_t group,
uint16_t element)
{
for(ListDocEntry::iterator i = docEntries.begin(); i != docEntries.end(); ++i)
||( group == (*i)->GetGroup() && element < (*i)->GetElement()) )
{
// instead of ReplaceOrCreateByNumber
- // that is a method of gdcmDocument :-(
- gdcmValEntry* entry = 0;
- gdcmTagKey key = gdcmDictEntry::TranslateToKey(group, element);
+ // that is a method of Document :-(
+ ValEntry* entry = 0;
+ TagKey key = DictEntry::TranslateToKey(group, element);
if ( ! PtagHT->count(key))
{
// we assume a Public Dictionnary *is* loaded
- gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
+ Dict *pubDict = Global::GetDicts()->GetDefaultPubDict();
// if the invoked (group,elem) doesn't exist inside the Dictionary
// we create a VirtualDictEntry
- gdcmDictEntry *dictEntry = pubDict->GetDictEntryByNumber(group,
+ DictEntry *dictEntry = pubDict->GetDictEntryByNumber(group,
element);
if (dictEntry == NULL)
{
dictEntry =
- gdcmGlobal::GetDicts()->NewVirtualDictEntry(group, element,
+ Global::GetDicts()->NewVirtualDictEntry(group, element,
"UN", "??", "??");
}
// we assume the constructor didn't fail
- entry = new gdcmValEntry(dictEntry);
+ entry = new ValEntry(dictEntry);
/// \todo
/// ----
/// better we don't assume too much !
- /// gdcmSQItem is now used to describe any DICOMDIR related object
+ /// SQItem is now used to describe any DICOMDIR related object
}
else
{
- gdcmDocEntry* foundEntry = PtagHT->find(key)->second;
- entry = dynamic_cast<gdcmValEntry*>(foundEntry);
+ DocEntry* foundEntry = PtagHT->find(key)->second;
+ entry = dynamic_cast<ValEntry*>(foundEntry);
if (!entry)
{
- dbg.Verbose(0, "gdcmSQItem::SetEntryByNumber: docEntries"
- " contains non gdcmValEntry occurences");
+ dbg.Verbose(0, "SQItem::SetEntryByNumber: docEntries"
+ " contains non ValEntry occurences");
}
}
if (entry)
}
if (group == (*i)->GetGroup() && element == (*i)->GetElement() )
{
- if ( gdcmValEntry* entry = dynamic_cast<gdcmValEntry*>(*i) )
+ if ( ValEntry* entry = dynamic_cast<ValEntry*>(*i) )
{
entry->SetValue(val);
}
* \brief Gets a Dicom Element inside a SQ Item Entry, by number
* @return
*/
-gdcmDocEntry* gdcmSQItem::GetDocEntryByNumber(uint16_t group, uint16_t element)
+DocEntry* SQItem::GetDocEntryByNumber(uint16_t group, uint16_t element)
{
for(ListDocEntry::iterator i = docEntries.begin();
i != docEntries.end(); ++i)
* @return
*/
-std::string gdcmSQItem::GetEntryByNumber(uint16_t group, uint16_t element)
+std::string SQItem::GetEntryByNumber(uint16_t group, uint16_t element)
{
for(ListDocEntry::iterator i = docEntries.begin();
i != docEntries.end(); ++i)
{
if ( (*i)->GetGroup() == group && (*i)->GetElement() == element)
{
- return ((gdcmValEntry *)(*i))->GetValue(); //FIXME
+ return ((ValEntry *)(*i))->GetValue(); //FIXME
}
}
return GDCM_UNFOUND;
//-----------------------------------------------------------------------------
+
+} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmSQItem.h,v $
Language: C++
- Date: $Date: 2004/10/07 21:01:10 $
- Version: $Revision: 1.18 $
+ Date: $Date: 2004/10/12 04:35:47 $
+ Version: $Revision: 1.19 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#ifndef GDCMSQITEM_H
#define GDCMSQITEM_H
-#include "gdcmDocEntry.h"
#include "gdcmDocEntrySet.h"
-#include "gdcmDocument.h"
+#include "gdcmElementSet.h"
+
+//#include "gdcmDocEntry.h"
+//#include "gdcmDocument.h"
+//#include "gdcmBinEntry.h"
+
#include <list>
-class gdcmBinEntry;
+namespace gdcm
+{
+class DocEntry;
//-----------------------------------------------------------------------------
-typedef std::list<gdcmDocEntry *> ListDocEntry;
+typedef std::list<DocEntry *> ListDocEntry;
//-----------------------------------------------------------------------------
-class GDCM_EXPORT gdcmSQItem : public gdcmDocEntrySet
+class GDCM_EXPORT SQItem
+ :
+ public DocEntrySet
{
public:
- gdcmSQItem(int);
- ~gdcmSQItem();
+ SQItem(int);
+ ~SQItem();
virtual void Print(std::ostream &os = std::cout);
virtual void Write(FILE *fp, FileType filetype);
/// \brief adds the passed DocEntry to the DocEntry chained List for
/// this SQ Item.
- void AddDocEntry(gdcmDocEntry *e) { docEntries.push_back(e); };
+ void AddDocEntry(DocEntry *e) { docEntries.push_back(e); };
- virtual bool AddEntry(gdcmDocEntry *Entry); // add to the List
+ virtual bool AddEntry(DocEntry *Entry); // add to the List
- gdcmDocEntry *GetDocEntryByNumber(uint16_t group, uint16_t element);
+ DocEntry *GetDocEntryByNumber(uint16_t group, uint16_t element);
// FIXME method to write
- //gdcmDocEntry *GetDocEntryByName (std::string Name);
+ //DocEntry *GetDocEntryByName (std::string Name);
bool SetEntryByNumber(std::string val, uint16_t group, uint16_t element);
void SetDepthLevel(int depth) { SQDepthLevel = depth; }
/// Accessor on \ref BaseTagKey.
- void SetBaseTagKey( gdcmBaseTagKey key ) { BaseTagKey = key; }
+ void SetBaseTagKey( BaseTagKey key ) { BaseTagKeyNested = key; }
/// Accessor on \ref BaseTagKey.
- gdcmBaseTagKey GetBaseTagKey( ) { return BaseTagKey; }
+ BaseTagKey GetBaseTagKey( ) { return BaseTagKeyNested; }
protected:
/// \brief SQ Item ordinal number
int SQItemNumber;
- ///\brief pointer to the HTable of the gdcmDocument,
- /// (because we don't know it within any gdcmDicomDirObject nor any gdcmSQItem)
+ ///\brief pointer to the HTable of the Document,
+ /// (because we don't know it within any DicomDirObject nor any SQItem)
TagDocEntryHT *PtagHT;
/// \brief Sequences can be nested. This \ref SQDepthLevel represents
/// the level of the nesting of instances of this class.
- /// \ref SQDepthLevel and its \ref gdcmSeqEntry::SQDepthLevel
+ /// \ref SQDepthLevel and its \ref SeqEntry::SQDepthLevel
/// counterpart are only defined on printing purposes
/// (see \ref Print).
int SQDepthLevel;
- /// \brief A TagKey of a gdcmDocEntry nested in a sequence is prepended
+ /// \brief A TagKey of a DocEntry nested in a sequence is prepended
/// with this BaseTagKey.
- gdcmBaseTagKey BaseTagKey;
+ BaseTagKey BaseTagKeyNested;
};
-
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmSeqEntry.cxx,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:07 $
- Version: $Revision: 1.30 $
+ Date: $Date: 2004/10/12 04:35:48 $
+ Version: $Revision: 1.31 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <iostream>
#include <iomanip>
+
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
// Constructor / Destructor
/**
- * \ingroup gdcmSeqEntry
- * \brief Constructor from a given gdcmSeqEntry
+ * \ingroup SeqEntry
+ * \brief Constructor from a given SeqEntry
*/
-gdcmSeqEntry::gdcmSeqEntry( gdcmDictEntry* e )
- : gdcmDocEntry(e)
+SeqEntry::SeqEntry( DictEntry* e )
+ : DocEntry(e)
{
UsableLength = 0;
ReadLength = 0xffffffff;
}
/**
- * \brief Constructor from a given gdcmSeqEntry
+ * \brief Constructor from a given SeqEntry
* @param e Pointer to existing Doc entry
* @param depth depth level of the current Seq entry
*/
-gdcmSeqEntry::gdcmSeqEntry( gdcmDocEntry* e, int depth )
- : gdcmDocEntry( e->GetDictEntry() )
+SeqEntry::SeqEntry( DocEntry* e, int depth )
+ : DocEntry( e->GetDictEntry() )
{
this->UsableLength = 0;
this->ReadLength = 0xffffffff;
/**
* \brief Canonical destructor.
*/
-gdcmSeqEntry::~gdcmSeqEntry() {
+SeqEntry::~SeqEntry() {
for(ListSQItem::iterator cc = items.begin();cc != items.end();++cc)
{
delete *cc;
/**
* \brief canonical Printer
*/
-void gdcmSeqEntry::Print( std::ostream &os )
+void SeqEntry::Print( std::ostream &os )
{
// First, Print the Dicom Element itself.
SetPrintLevel(2);
- gdcmDocEntry::Print(os);
+ DocEntry::Print(os);
os << std::endl;
if (GetReadLength() == 0)
/*
* \brief canonical Writer
*/
-void gdcmSeqEntry::Write(FILE* fp, FileType filetype)
+void SeqEntry::Write(FILE* fp, FileType filetype)
{
uint16_t seq_term_gr = 0xfffe;
uint16_t seq_term_el = 0xe0dd;
//uint16_t item_term_gr = 0xfffe;
//uint16_t item_term_el = 0xe00d;
- gdcmDocEntry::Write(fp, filetype);
+ DocEntry::Write(fp, filetype);
for(ListSQItem::iterator cc = GetSQItems().begin();
cc != GetSQItems().end();
++cc)
// Public
/// \brief adds the passed ITEM to the ITEM chained List for this SeQuence.
-void gdcmSeqEntry::AddEntry(gdcmSQItem *sqItem, int itemNumber)
+void SeqEntry::AddEntry(SQItem *sqItem, int itemNumber)
{
sqItem->SetSQItemNumber(itemNumber);
items.push_back(sqItem);
* Returns the last item when argument is bigget than the total
* item number.
*/
-gdcmSQItem* gdcmSeqEntry::GetSQItemByOrdinalNumber(int nb)
+SQItem* SeqEntry::GetSQItemByOrdinalNumber(int nb)
{
if (nb<0)
return (*(items.begin()));
// Private
//-----------------------------------------------------------------------------
+} // end namespace gdcm
+
Program: gdcm
Module: $RCSfile: gdcmSeqEntry.h,v $
Language: C++
- Date: $Date: 2004/10/07 21:05:40 $
- Version: $Revision: 1.19 $
+ Date: $Date: 2004/10/12 04:35:48 $
+ Version: $Revision: 1.20 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmSQItem.h"
#include "gdcmDocEntry.h"
#include <list>
+namespace gdcm
+{
//-----------------------------------------------------------------------------
-typedef std::list<gdcmSQItem *> ListSQItem;
+typedef std::list<SQItem *> ListSQItem;
//-----------------------------------------------------------------------------
-class GDCM_EXPORT gdcmSeqEntry : public gdcmDocEntry
+class GDCM_EXPORT SeqEntry : public DocEntry
{
public:
- gdcmSeqEntry( gdcmDictEntry* );
- gdcmSeqEntry(gdcmDocEntry* d, int depth);
- virtual ~gdcmSeqEntry();
+ SeqEntry( DictEntry* );
+ SeqEntry(DocEntry* d, int depth);
+ virtual ~SeqEntry();
virtual void Print(std::ostream &os = std::cout);
virtual void Write(FILE *fp, FileType);
void SetDelimitorMode(bool dm) { delimitor_mode = dm;}
/// Sets the Sequence Delimitation Item
- void SetSequenceDelimitationItem(gdcmDocEntry * e) { seq_term = e;}
+ void SetSequenceDelimitationItem(DocEntry * e) { seq_term = e;}
- void AddEntry(gdcmSQItem *it, int itemNumber);
- gdcmSQItem *GetSQItemByOrdinalNumber(int itemNumber);
+ void AddEntry(SQItem *it, int itemNumber);
+ SQItem *GetSQItemByOrdinalNumber(int itemNumber);
/// Gets the depth level
int GetDepthLevel() { return SQDepthLevel; }
ListSQItem items;
/// sequence terminator item
- gdcmDocEntry *seq_term;
+ DocEntry *seq_term;
- /// \brief Defines the depth level of this \ref gdcmSeqEntry inside
+ /// \brief Defines the depth level of this \ref SeqEntry inside
/// the (optionaly) nested sequences. \ref SQDepthLevel
- /// and its \ref gdcmSQItem::SQDepthLevel counterpart
+ /// and its \ref SQItem::SQDepthLevel counterpart
/// are only defined on printing purposes (see \ref Print).
int SQDepthLevel;
};
-
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmTS.cxx,v $
Language: C++
- Date: $Date: 2004/10/08 04:43:38 $
- Version: $Revision: 1.25 $
+ Date: $Date: 2004/10/12 04:35:48 $
+ 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
#include <string>
#include <iostream>
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
// Constructor / Destructor
-gdcmTS::gdcmTS()
+TS::TS()
{
- std::string filename=gdcmDictSet::BuildDictPath() + std::string(DICT_TS);
+ std::string filename=DictSet::BuildDictPath() + std::string(DICT_TS);
std::ifstream from(filename.c_str());
- dbg.Error(!from, "gdcmTS::gdcmTS: can't open dictionary",filename.c_str());
+ dbg.Error(!from, "TS::TS: can't open dictionary",filename.c_str());
std::string key;
std::string name;
}
//-----------------------------------------------------------------------------
-gdcmTS::~gdcmTS()
+TS::~TS()
{
ts.clear();
}
//-----------------------------------------------------------------------------
// Print
/**
- * \ingroup gdcmVR
+ * \ingroup VR
* \brief Print all
* @param os The output stream to be written to.
*/
-void gdcmTS::Print(std::ostream &os)
+void TS::Print(std::ostream &os)
{
std::ostringstream s;
//-----------------------------------------------------------------------------
// Public
-int gdcmTS::Count(TSKey key)
+int TS::Count(TSKey key)
{
return ts.count(key);
}
-std::string gdcmTS::GetValue(TSKey key)
+std::string TS::GetValue(TSKey key)
{
if (ts.count(key) == 0)
{
// Private
//-----------------------------------------------------------------------------
+
+} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmTS.h,v $
Language: C++
- Date: $Date: 2004/10/07 21:05:40 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2004/10/12 04:35:48 $
+ Version: $Revision: 1.10 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <map>
#include <string>
#include <iostream>
+namespace gdcm
+{
//-----------------------------------------------------------------------------
typedef std::string TSKey;
* Container for dicom Transfert Syntax Hash Table
* \note This is a singleton
*/
-class GDCM_EXPORT gdcmTS
+class GDCM_EXPORT TS
{
public:
- gdcmTS();
- ~gdcmTS();
+ TS();
+ ~TS();
void Print(std::ostream &os = std::cout);
private:
TSHT ts;
};
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmUtil.cxx,v $
Language: C++
- Date: $Date: 2004/10/10 00:42:55 $
- Version: $Revision: 1.53 $
+ Date: $Date: 2004/10/12 04:35:48 $
+ Version: $Revision: 1.54 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmUtil.h"
#include "gdcmDebug.h"
+#include <stdarg.h> //only included in implementation file
+#include <stdio.h> //only included in implementation file
+
+namespace gdcm
+{
/**
* \ingroup Globals
* << std::hex << element;
* buf.str();
*/
-#include <stdarg.h> //only included in implementation file
-#include <stdio.h> //only included in implementation file
-std::string gdcmUtil::Format(const char* format, ...)
+std::string Util::Format(const char* format, ...)
{
char buffer[2048];
va_list args;
* \ingroup Globals
* \brief Because not available in C++ (?)
*/
-void gdcmUtil::Tokenize (const std::string& str,
+void Util::Tokenize (const std::string& str,
std::vector<std::string>& tokens,
const std::string& delimiters)
{
* Counts the number of occurences of a substring within a string
*/
-int gdcmUtil::CountSubstring (const std::string& str,
+int Util::CountSubstring (const std::string& str,
const std::string& subStr)
{
int count = 0; // counts how many times it appears
* to avoid corrupting the terminal of invocation when printing)
* @param s string to remove non printable characters from
*/
-std::string gdcmUtil::CreateCleanString(std::string s)
+std::string Util::CreateCleanString(std::string s)
{
std::string str = s;
* \brief Add a SEPARATOR to the end of the name is necessary
* @param name file/directory name to normalize
*/
-void gdcmUtil::NormalizePath(std::string &name)
+void Util::NormalizePath(std::string &name)
{
const char SEPARATOR_X = '/';
const char SEPARATOR_WIN = '\\';
* \brief Get the (directory) path from a full path file name
* @param fullName file/directory name to extract Path from
*/
-std::string gdcmUtil::GetPath(std::string &fullName)
+std::string Util::GetPath(std::string &fullName)
{
int pos1 = fullName.rfind("/");
int pos2 = fullName.rfind("\\");
* \brief Get the (last) name of a full path file name
* @param fullName file/directory name to extract end name from
*/
-std::string gdcmUtil::GetName(std::string &fullName)
+std::string Util::GetName(std::string &fullName)
{
int fin = fullName.length()-1;
char a =fullName.c_str()[fin];
return lastName;
}
+
+} // end namespace gdcm
+
Program: gdcm
Module: $RCSfile: gdcmUtil.h,v $
Language: C++
- Date: $Date: 2004/10/10 00:42:55 $
- Version: $Revision: 1.35 $
+ Date: $Date: 2004/10/12 04:35:48 $
+ Version: $Revision: 1.36 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <vector>
#include <string>
-
+namespace gdcm
+{
/**
* \defgroup Globals Utility functions
* \brief Here are some utility functions, belonging to NO class,
//-----------------------------------------------------------------------------
-class GDCM_EXPORT gdcmUtil
+class GDCM_EXPORT Util
{
public:
static std::string Format(const char* format, ...);
static std::string GetPath(std::string &fullName);
static std::string GetName(std::string &fullName);
};
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmVR.cxx,v $
Language: C++
- Date: $Date: 2004/10/08 04:43:38 $
- Version: $Revision: 1.18 $
+ Date: $Date: 2004/10/12 04:35:48 $
+ Version: $Revision: 1.19 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <fstream>
#include <iostream>
+namespace gdcm
+{
+
//-----------------------------------------------------------------------------
/**
* \brief Constructor
*/
-gdcmVR::gdcmVR()
+VR::VR()
{
- std::string filename=gdcmDictSet::BuildDictPath() + std::string(DICT_VR);
+ std::string filename=DictSet::BuildDictPath() + std::string(DICT_VR);
std::ifstream from(filename.c_str());
- dbg.Error(!from, "gdcmVR::gdcmVR: can't open dictionary",filename.c_str());
+ dbg.Error(!from, "VR::VR: can't open dictionary",filename.c_str());
char buff[1024];
std::string key;
/**
* \brief Destructor
*/
-gdcmVR::~gdcmVR()
+VR::~VR()
{
vr.clear();
}
* \brief Print all
* @param os The output stream to be written to.
*/
-void gdcmVR::Print(std::ostream &os)
+void VR::Print(std::ostream &os)
{
std::ostringstream s;
- for (gdcmVRHT::iterator it = vr.begin(); it != vr.end(); ++it)
+ for (VRHT::iterator it = vr.begin(); it != vr.end(); ++it)
{
s << "VR : "<<it->first<<" = "<<it->second<<std::endl;
}
* \brief Get the count for an element
* @param key key to count
*/
-int gdcmVR::Count(gdcmVRKey key)
+int VR::Count(VRKey key)
{
return vr.count(key);
}
//-----------------------------------------------------------------------------
/**
* \brief Simple predicate that checks wether the given argument
- * corresponds to the Value Representation of a \ref gdcmBinEntry .
+ * corresponds to the Value Representation of a \ref BinEntry .
* This predicate is the negation of
- * \ref gdcmVR::IsVROfGdcmStringRepresentable .
+ * \ref VR::IsVROfGdcmStringRepresentable .
* @param tested value representation to check for.
*/
-bool gdcmVR::IsVROfGdcmBinaryRepresentable(gdcmVRKey tested)
+bool VR::IsVROfGdcmBinaryRepresentable(VRKey tested)
{
- //std::cout << "gdcmVR::IsVROfGdcmBinaryRepresentable===================="
+ //std::cout << "VR::IsVROfGdcmBinaryRepresentable===================="
// << tested << std::endl;
if ( tested == "unkn")
if ( ! Count(tested) )
{
- dbg.Verbose(0, "gdcmVR::IsVROfGdcmBinaryRepresentable: tested not a VR!");
+ dbg.Verbose(0, "VR::IsVROfGdcmBinaryRepresentable: tested not a VR!");
return false;
}
if ( IsVROfGdcmStringRepresentable(tested) )
{
- dbg.Verbose(0, "gdcmVR::IsVROfGdcmBinaryRepresentable: binary VR !");
+ dbg.Verbose(0, "VR::IsVROfGdcmBinaryRepresentable: binary VR !");
return false;
}
//-----------------------------------------------------------------------------
/**
* \brief Simple predicate that checks wether the given argument
- * corresponds to the Value Representation of a \ref gdcmValEntry
- * but NOT a \ref gdcmBinEntry.
+ * corresponds to the Value Representation of a \ref ValEntry
+ * but NOT a \ref BinEntry.
* @param tested value representation to check for.
*/
-bool gdcmVR::IsVROfGdcmStringRepresentable(gdcmVRKey tested)
+bool VR::IsVROfGdcmStringRepresentable(VRKey tested)
{
if ( ! Count(tested) )
{
- dbg.Verbose(0, "gdcmVR::IsVROfGdcmStringRepresentable: tested not a VR!");
+ dbg.Verbose(0, "VR::IsVROfGdcmStringRepresentable: tested not a VR!");
return false;
}
// Private
//-----------------------------------------------------------------------------
+
+} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmVR.h,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:08 $
- Version: $Revision: 1.11 $
+ Date: $Date: 2004/10/12 04:35:48 $
+ Version: $Revision: 1.12 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <map>
#include <string>
#include <iostream>
+namespace gdcm
+{
//-----------------------------------------------------------------------------
-typedef std::string gdcmVRKey;
-typedef std::string gdcmVRAtr;
+typedef std::string VRKey;
+typedef std::string VRAtr;
/// Value Representation Hash Table
-typedef std::map<gdcmVRKey, gdcmVRAtr> gdcmVRHT;
+typedef std::map<VRKey, VRAtr> VRHT;
//-----------------------------------------------------------------------------
/*
* Container for dicom Value Representation Hash Table
* \note This is a singleton
*/
-class GDCM_EXPORT gdcmVR
+class GDCM_EXPORT VR
{
public:
- gdcmVR(void);
- ~gdcmVR();
+ VR(void);
+ ~VR();
void Print(std::ostream &os = std::cout);
- int Count(gdcmVRKey key);
- bool IsVROfGdcmBinaryRepresentable(gdcmVRKey);
- bool IsVROfGdcmStringRepresentable(gdcmVRKey);
+ int Count(VRKey key);
+ bool IsVROfGdcmBinaryRepresentable(VRKey);
+ bool IsVROfGdcmStringRepresentable(VRKey);
private:
- gdcmVRHT vr;
+ VRHT vr;
};
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmValEntry.cxx,v $
Language: C++
- Date: $Date: 2004/10/10 00:42:55 $
- Version: $Revision: 1.29 $
+ Date: $Date: 2004/10/12 04:35:48 $
+ 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
#include "gdcmGlobal.h"
#include "gdcmUtil.h"
+namespace gdcm
+{
+
// CLEAN ME
#define MAX_SIZE_PRINT_ELEMENT_VALUE 128
//-----------------------------------------------------------------------------
// Constructor / Destructor
/**
- * \brief Constructor from a given gdcmDictEntry
+ * \brief Constructor from a given DictEntry
* @param e Pointer to existing dictionary entry
*/
-gdcmValEntry::gdcmValEntry(gdcmDictEntry* e) : gdcmDocEntry(e)
+ValEntry::ValEntry(DictEntry* e) : DocEntry(e)
{
}
/**
- * \brief Constructor from a given gdcmDocEntry
+ * \brief Constructor from a given DocEntry
* @param e Pointer to existing Doc entry
*/
-gdcmValEntry::gdcmValEntry(gdcmDocEntry* e)
- : gdcmDocEntry(e->GetDictEntry())
+ValEntry::ValEntry(DocEntry* e)
+ : DocEntry(e->GetDictEntry())
{
UsableLength = e->GetLength();
ReadLength = e->GetReadLength();
/**
* \brief Canonical destructor.
*/
-gdcmValEntry::~gdcmValEntry ()
+ValEntry::~ValEntry ()
{
}
/**
* \brief canonical Printer
*/
-void gdcmValEntry::Print(std::ostream & os)
+void ValEntry::Print(std::ostream & os)
{
uint16_t g = GetGroup();
uint16_t e = GetElement();
TSKey v;
std::string d2;
- gdcmDocEntry::Print(os);
+ DocEntry::Print(os);
if (g == 0xfffe)
{
return;
}
- gdcmTS * ts = gdcmGlobal::GetTS();
+ TS * ts = Global::GetTS();
v = GetValue(); // not applicable for SQ ...
- d2 = gdcmUtil::CreateCleanString(v); // replace non printable characters by '.'
+ d2 = Util::CreateCleanString(v); // replace non printable characters by '.'
if( (GetLength()<=MAX_SIZE_PRINT_ELEMENT_VALUE) ||
//(PrintLevel>=3) || (d2.find("gdcm::NotLoaded.") < d2.length()) )
(PrintLevel>=3) || (d2.find(GDCM_NOTLOADED) < d2.length()) )
{
if (v == "4294967295") // to avoid troubles in convertion
{
- st = gdcmUtil::Format(" x(ffffffff)");
+ st = Util::Format(" x(ffffffff)");
}
else
{
if ( GetLength() !=0 )
{
- st = gdcmUtil::Format(" x(%x)", atoi(v.c_str()));//FIXME
+ st = Util::Format(" x(%x)", atoi(v.c_str()));//FIXME
}
else
{
- st = gdcmUtil::Format(" ");
+ st = Util::Format(" ");
}
}
s << st;
/*
* \brief canonical Writer
*/
-void gdcmValEntry::Write(FILE* fp, FileType filetype)
+void ValEntry::Write(FILE* fp, FileType filetype)
{
- gdcmDocEntry::Write(fp, filetype);
+ DocEntry::Write(fp, filetype);
//std::cout << "=====================================" << GetVR() << std::endl;
// we split the string and write each value as a short int
std::vector<std::string> tokens;
tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
- gdcmUtil::Tokenize (GetValue(), tokens, "\\");
+ Util::Tokenize (GetValue(), tokens, "\\");
for (unsigned int i=0; i<tokens.size();i++)
{
uint16_t val_uint16 = atoi(tokens[i].c_str());
// along the '\' and write each value as an int:
std::vector<std::string> tokens;
tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
- gdcmUtil::Tokenize (GetValue(), tokens, "\\");
+ Util::Tokenize (GetValue(), tokens, "\\");
for (unsigned int i=0; i<tokens.size();i++)
{
uint32_t val_uint32 = atoi(tokens[i].c_str());
// Private
//-----------------------------------------------------------------------------
+} // end namespace gdcm
+
Program: gdcm
Module: $RCSfile: gdcmValEntry.h,v $
Language: C++
- Date: $Date: 2004/10/10 00:42:55 $
- Version: $Revision: 1.25 $
+ Date: $Date: 2004/10/12 04:35:48 $
+ 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
#include "gdcmDocEntry.h"
#include <iostream>
+namespace gdcm
+{
//-----------------------------------------------------------------------------
/**
- * \ingroup gdcmValEntry
+ * \ingroup ValEntry
* \brief The dicom header of a Dicom file contains a set of such entries
* (when successfuly parsed against a given Dicom dictionary)
*/
-class GDCM_EXPORT gdcmValEntry : public gdcmDocEntry
+class GDCM_EXPORT ValEntry : public DocEntry
{
public:
- gdcmValEntry(gdcmDictEntry* e);
- gdcmValEntry(gdcmDocEntry* d);
- virtual ~gdcmValEntry();
+ ValEntry(DictEntry* e);
+ ValEntry(DocEntry* d);
+ virtual ~ValEntry();
/// \brief Returns the 'Value' (e.g. "Dupond Marcel") converted into a
/// 'string', if it's stored as an integer in the header of the
// Members :
/// \brief Document Entry value, internaly represented as a std::string
- /// The Value Representation (\ref gdcmVR) is independently used
+ /// The Value Representation (\ref VR) is independently used
/// in order to interpret (decode) this field.
std::string Value;
};
+} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif
#include <vtkPointData.h>
#include <vtkLookupTable.h>
-vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.50 $");
+vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.51 $");
vtkStandardNewMacro(vtkGdcmReader);
//-----------------------------------------------------------------------------
fclose(fp);
// Stage 1.2: check for Gdcm parsability
- gdcmHeader GdcmHeader(filename->c_str() );
+ gdcm::Header 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 file( fileName.c_str() );
+ gdcm::File file( fileName.c_str() );
size_t size;
// If the data structure of vtk for image/volume representation