Program: gdcm
Module: $RCSfile: gdcmDict.cxx,v $
Language: C++
- Date: $Date: 2004/10/12 04:35:45 $
- Version: $Revision: 1.45 $
+ Date: $Date: 2004/10/18 02:17:06 $
+ Version: $Revision: 1.46 $
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
{
while (!from.eof())
{
from >> std::hex;
- from >> group; /// MEMORY LEAK in std::istream::operator>>
+ from >> group;
from >> element;
from >> vr;
from >> fourth;
- from >> std::ws; // used to be eatwhite(from);
- std::getline(from, name); /// MEMORY LEAK in std::getline<>
+ from >> std::ws; //remove white space
+ std::getline(from, name);
- DictEntry * newEntry = new DictEntry(group, element,
- vr, fourth, name);
+ DictEntry * newEntry = new DictEntry(group, element, vr, fourth, name);
AddNewEntry(newEntry);
}
from.close();
* the name MAY CHANGE between two versions !
* @return the corresponding dictionnary entry when existing, NULL otherwise
*/
-DictEntry* Dict::GetDictEntryByName(TagName name)
+DictEntry* Dict::GetDictEntryByName(TagName const & name)
{
if ( !NameHt.count(name))
{
* \sa DictSet::GetPubDictTagNamesByCategory
* @return A list of all entries of the public dicom dictionnary.
*/
-std::list<std::string>* Dict::GetDictEntryNames()
+EntryNamesList* Dict::GetDictEntryNames()
{
- std::list<std::string> *result = new std::list<std::string>;
+ EntryNamesList *result = new EntryNamesList;
for (TagKeyHT::iterator tag = KeyHt.begin(); tag != KeyHt.end(); ++tag)
{
result->push_back( tag->second->GetName() );
* corresponding values are lists of all the dictionnary entries
* among that group.
*/
-std::map<std::string, std::list<std::string> > *Dict::GetDictEntryNamesByCategory(void)
+EntryNamesByCatMap *Dict::GetDictEntryNamesByCategory()
{
- std::map<std::string, std::list<std::string> > *result = new std::map<std::string, std::list<std::string> >;
+ EntryNamesByCatMap *result = new EntryNamesByCatMap;
for (TagKeyHT::iterator tag = KeyHt.begin(); tag != KeyHt.end(); ++tag)
{
Program: gdcm
Module: $RCSfile: gdcmDict.h,v $
Language: C++
- Date: $Date: 2004/10/12 04:35:45 $
- Version: $Revision: 1.19 $
+ Date: $Date: 2004/10/18 02:17:06 $
+ 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 <iostream>
#include <list>
#include <map>
+
namespace gdcm
{
//-----------------------------------------------------------------------------
typedef std::map<TagKey, DictEntry*> TagKeyHT;
typedef std::map<TagName, DictEntry*> TagNameHT;
-
+typedef std::list<std::string> EntryNamesList;
+typedef std::map<std::string, std::list<std::string> > EntryNamesByCatMap;
//-----------------------------------------------------------------------------
/*
* \defgroup Dict
class GDCM_EXPORT Dict
{
public:
- Dict(std::string const & FileName);
+ Dict(std::string const & filename);
~Dict();
// Print
void PrintByName(std::ostream &os = std::cout);
// Entries
- bool AddNewEntry (DictEntry *NewEntry);
- bool ReplaceEntry(DictEntry *NewEntry);
+ bool AddNewEntry (DictEntry *newEntry);
+ bool ReplaceEntry(DictEntry *newEntry);
bool RemoveEntry (TagKey key);
bool RemoveEntry (uint16_t group, uint16_t element);
// Tag
- DictEntry *GetDictEntryByName(TagName name);
+ DictEntry *GetDictEntryByName(TagName const & name);
DictEntry *GetDictEntryByNumber(uint16_t group, uint16_t element);
- std::list<std::string> *GetDictEntryNames();
- std::map<std::string, std::list<std::string> > *
- GetDictEntryNamesByCategory();
+ EntryNamesList *GetDictEntryNames();
+ EntryNamesByCatMap *GetDictEntryNamesByCategory();
/// \brief Returns a ref to the Dicom Dictionary H table (map)
/// @return the Dicom Dictionary H table
- TagKeyHT & GetEntriesByKey() { return KeyHt; }
+ const TagKeyHT & GetEntriesByKey() const { return KeyHt; }
/// \brief Returns a ref to the Dicom Dictionary H table (map)
/// @return the Dicom Dictionary H table
- TagNameHT & GetEntriesByName() { return NameHt; }
+ const TagNameHT & GetEntriesByName() const { return NameHt; }
private:
/// ASCII file holding the Dictionnary
std::string Filename;
+
/// Access through TagKey (see alternate access with NameHt)
TagKeyHT KeyHt;
+
/// Access through TagName (see alternate access with KeyHt)
TagNameHT NameHt;
};
Program: gdcm
Module: $RCSfile: gdcmDictEntry.cxx,v $
Language: C++
- Date: $Date: 2004/10/12 04:35:45 $
- Version: $Revision: 1.26 $
+ Date: $Date: 2004/10/18 02:17:06 $
+ 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
*/
DictEntry::DictEntry(uint16_t group, uint16_t element,
- std::string vr, std::string fourth,
- std::string name)
+ TagName vr, TagName fourth,
+ TagName name)
{
Group = group;
Element = element;
* \ is unset then overwrite it.
* @param vr New V(alue) R(epresentation) to be set.
*/
-void DictEntry::SetVR(std::string const & vr)
+void DictEntry::SetVR(TagName const & vr)
{
if ( IsVRUnknown() )
{
Program: gdcm
Module: $RCSfile: gdcmDictEntry.h,v $
Language: C++
- Date: $Date: 2004/10/12 04:35:45 $
- Version: $Revision: 1.18 $
+ Date: $Date: 2004/10/18 02:17:06 $
+ 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
{
public:
DictEntry(uint16_t group,
- uint16_t element,
- std::string vr = "Unknown",
- std::string fourth = "Unknown",
- std::string name = "Unknown");
+ uint16_t element,
+ TagName vr = "Unknown",
+ TagName fourth = "Unknown",
+ TagName name = "Unknown");
static TagKey TranslateToKey(uint16_t group, uint16_t element);
- void SetVR(std::string const & vr);
+ void SetVR(TagName const & vr);
/// \brief tells if the V(alue) R(epresentation) is known (?!)
/// @return
/// \brief Returns the Dicom Value Representation of the current
/// DictEntry
/// @return the Dicom Value Representation
- std::string GetVR() { return VR; }
+ const TagName & GetVR() const { return VR; }
/// \brief sets the key of the current DictEntry
/// @param k New key to be set.
- void SetKey(std::string const & k) { Key = k; }
+ void SetKey(TagName const & k) { Key = k; }
/// \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; }
+ const TagName & GetFourth() const { return Fourth; }
/// \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; }
+ const TagName & GetName() const { return Name; }
/// \brief Gets the key of the current DictEntry
/// @return the key.
- std::string GetKey() { return Key; }
+ const TagName & GetKey() const { return Key; }
private:
/// \todo FIXME
/// \brief Value Representation i.e. some clue about the nature
/// of the data represented e.g. "FD" short for
/// "Floating Point Double" (see \ref VR)
- std::string VR;
+ TagName VR;
/**
* \brief AVOID using the following fourth field at all costs.
* - LLO = Left Lateral Oblique
* .
*/
- std::string Fourth;
+ TagName Fourth;
/// e.g. "Patient's Name"
- std::string Name;
+ TagName Name;
/// Redundant with (group, element) but we add it for efficiency purpose.
TagKey Key;
Program: gdcm
Module: $RCSfile: gdcmDictSet.cxx,v $
Language: C++
- Date: $Date: 2004/10/12 04:35:45 $
- Version: $Revision: 1.38 $
+ Date: $Date: 2004/10/18 02:17:07 $
+ Version: $Revision: 1.39 $
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
{
* \sa DictSet::GetPubDictTagNamesByCategory
* @return A list of all entries of the public dicom dictionnary.
*/
-std::list<std::string> *DictSet::GetPubDictEntryNames()
+EntryNamesList * DictSet::GetPubDictEntryNames()
{
return GetDefaultPubDict()->GetDictEntryNames();
}
* corresponding values are lists of all the dictionnary entries
* among that group.
*/
-std::map<std::string, std::list<std::string> > *
- DictSet::GetPubDictEntryNamesByCategory()
+EntryNamesByCatMap * DictSet::GetPubDictEntryNamesByCategory()
{
return GetDefaultPubDict()->GetDictEntryNamesByCategory();
}
* created dictionary.
*/
Dict *DictSet::LoadDictFromFile(std::string const & fileName,
- DictKey const & name)
+ DictKey const & name)
{
Dict *newDict = new Dict(fileName);
AppendDict(newDict, name);
* in no dictionnary
* @return virtual entry
*/
-DictEntry *DictSet::NewVirtualDictEntry(uint16_t group,
- uint16_t element,
- std::string vr,
- std::string fourth,
- std::string name)
+DictEntry *DictSet::NewVirtualDictEntry( uint16_t group,
+ uint16_t element,
+ TagName vr,
+ TagName fourth,
+ TagName name)
{
DictEntry* entry;
const std::string tag = DictEntry::TranslateToKey(group,element)
Program: gdcm
Module: $RCSfile: gdcmDictSet.h,v $
Language: C++
- Date: $Date: 2004/10/12 04:35:45 $
- Version: $Revision: 1.27 $
+ Date: $Date: 2004/10/18 02:17:07 $
+ Version: $Revision: 1.28 $
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, Dict*> DictSetHT;
void Print(std::ostream& os);
- std::list<std::string>* GetPubDictEntryNames();
- std::map<std::string, std::list<std::string> > *
- GetPubDictEntryNamesByCategory();
+ EntryNamesList * GetPubDictEntryNames();
+ EntryNamesByCatMap * GetPubDictEntryNamesByCategory();
Dict* LoadDictFromFile( std::string const & fileName,
- DictKey const & name );
+ DictKey const & name );
Dict* GetDict( DictKey const & DictName );
// Dict* GetVirtualDict() { return &VirtualEntry; };
DictEntry* NewVirtualDictEntry(uint16_t group, uint16_t element,
- std::string vr = "Unknown",
- std::string fourth = "Unknown",
- std::string name = "Unknown");
+ TagName vr = "Unknown",
+ TagName fourth = "Unknown",
+ TagName name = "Unknown");
static std::string BuildDictPath();
private:
/// 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 DictEntries
TagKeyHT VirtualEntry;
};
Program: gdcm
Module: $RCSfile: gdcmJpeg.cxx,v $
Language: C++
- Date: $Date: 2004/10/15 15:44:42 $
- Version: $Revision: 1.26 $
+ Date: $Date: 2004/10/18 02:17:07 $
+ 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
* more than one scanline at a time if that's more convenient.
*/
+ //printf( "scanlines: %d\n",cinfo.output_scanline);
(void) jpeg_read_scanlines(&cinfo, buffer, 1);
memcpy( pimage, *buffer,rowsize);
pimage+=rowsize;