Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2004/09/21 10:46:10 $
- Version: $Revision: 1.83 $
+ Date: $Date: 2004/09/27 08:39:06 $
+ Version: $Revision: 1.92 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
- http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details.
+ http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
std::string PhotometricInterpretation = GetEntryByNumber(0x0028,0x0004);
if( PhotometricInterpretation == "PALETTE COLOR " )
{
- LoadEntryVoidArea(0x0028,0x1200); // gray LUT
+ LoadEntryBinArea(0x0028,0x1200); // gray LUT
/// FIXME FIXME FIXME
/// The tags refered by the three following lines used to be CORRECTLY
/// defined as having an US Value Representation in the public
/// 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.
- LoadEntryVoidArea(0x0028,0x1201); // R LUT
- LoadEntryVoidArea(0x0028,0x1202); // G LUT
- LoadEntryVoidArea(0x0028,0x1203); // B LUT
+ LoadEntryBinArea(0x0028,0x1201); // R LUT
+ LoadEntryBinArea(0x0028,0x1202); // G LUT
+ LoadEntryBinArea(0x0028,0x1203); // B LUT
// Segmented Red Palette Color LUT Data
- LoadEntryVoidArea(0x0028,0x1221);
+ LoadEntryBinArea(0x0028,0x1221);
// Segmented Green Palette Color LUT Data
- LoadEntryVoidArea(0x0028,0x1222);
+ LoadEntryBinArea(0x0028,0x1222);
// Segmented Blue Palette Color LUT Data
- LoadEntryVoidArea(0x0028,0x1223);
+ LoadEntryBinArea(0x0028,0x1223);
}
//FIXME later : how to use it?
- LoadEntryVoidArea(0x0028,0x3006); //LUT Data (CTX dependent)
+ LoadEntryBinArea(0x0028,0x3006); //LUT Data (CTX dependent)
CloseFile();
/**
* \brief Get the public dictionary used
*/
-gdcmDict *gdcmDocument::GetPubDict()
+gdcmDict* gdcmDocument::GetPubDict()
{
return RefPubDict;
}
/**
* \brief Get the shadow dictionary used
*/
-gdcmDict *gdcmDocument::GetShaDict()
+gdcmDict* gdcmDocument::GetShaDict()
{
return RefShaDict;
}
* \return pointer to the modified/created Header Entry (NULL when creation
* failed).
*/
-gdcmValEntry * gdcmDocument::ReplaceOrCreateByNumber(
+gdcmValEntry* gdcmDocument::ReplaceOrCreateByNumber(
std::string const & value,
uint16_t group,
uint16_t elem,
// Find out if the tag we received is in the dictionaries:
gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
- gdcmDictEntry *dictEntry = pubDict->GetDictEntryByNumber(group, elem);
+ gdcmDictEntry* dictEntry = pubDict->GetDictEntryByNumber(group, elem);
if (!dictEntry)
{
currentEntry = NewDocEntryByNumber(group, elem,VR);
/*
* \brief Modifies the value of a given Header Entry (Dicom Element)
* when it exists. Create it with the given value when unexistant.
- * @param voidArea (binary) value to be set
+ * @param binArea (binary) value to be set
* @param Group Group number of the Entry
* @param Elem Element number of the Entry
* \return pointer to the modified/created Header Entry (NULL when creation
* failed).
*/
-gdcmBinEntry * gdcmDocument::ReplaceOrCreateByNumber(
- void *voidArea,
+gdcmBinEntry* gdcmDocument::ReplaceOrCreateByNumber(
+ uint8_t* binArea,
int lgth,
uint16_t group,
uint16_t elem,
- std::string const & VR )
+ std::string const& VR )
{
gdcmBinEntry* binEntry = 0;
gdcmDocEntry* currentEntry = GetDocEntryByNumber( group, elem);
if (!dictEntry)
{
- currentEntry = NewDocEntryByNumber(group, elem,VR);
+ currentEntry = NewDocEntryByNumber(group, elem, VR);
}
else
{
}
}
- SetEntryByNumber(voidArea, lgth, group, elem);
+ SetEntryByNumber(binArea, lgth, group, elem);
return binEntry;
}
* \return pointer to the modified/created SeqEntry (NULL when creation
* failed).
*/
-gdcmSeqEntry * gdcmDocument::ReplaceOrCreateByNumber(
+gdcmSeqEntry* gdcmDocument::ReplaceOrCreateByNumber(
uint16_t group,
uint16_t elem)
{
* @return Corresponding element value when it exists,
* and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
*/
-std::string gdcmDocument::GetEntryByName(TagName const & tagName)
+std::string gdcmDocument::GetEntryByName(TagName const& tagName)
{
- gdcmDictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName);
+ gdcmDictEntry* 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 gdcmDocument::GetEntryVRByName(TagName const& tagName)
{
gdcmDictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName);
if( dictEntry == NULL)
* @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 gdcmDocument::SetEntryByNumber(std::string const& content,
uint16_t group,
uint16_t element)
{
* \brief Accesses an existing gdcmDocEntry (i.e. a Dicom Element)
* through it's (group, element) and modifies it's content with
* the given value.
- * @param content new value (void *) to substitute with
+ * @param content new value (void* -> uint8_t*) to substitute with
* @param lgth new value length
* @param group group number of the Dicom Element to modify
* @param element element number of the Dicom Element to modify
*/
-bool gdcmDocument::SetEntryByNumber(void *content,
+bool gdcmDocument::SetEntryByNumber(uint8_t*content,
int lgth,
uint16_t group,
uint16_t element)
}
*/
gdcmBinEntry* a = (gdcmBinEntry *)TagHT[key];
- a->SetVoidArea(content);
+ a->SetBinArea(content);
a->SetLength(lgth);
+ a->SetValue(GDCM_BINLOADED);
return true;
}
* @param elem element number of the Entry
* @return Pointer to the 'non string' area
*/
-void * gdcmDocument::GetEntryVoidAreaByNumber(uint16_t group, uint16_t elem)
+void* gdcmDocument::GetEntryBinAreaByNumber(uint16_t group, uint16_t elem)
{
gdcmDocEntry* entry = GetDocEntryByNumber(group, elem);
if (!entry)
dbg.Verbose(1, "gdcmDocument::GetDocEntryByNumber: no entry");
return 0;
}
- return ((gdcmBinEntry *)entry)->GetVoidArea();
+ return ((gdcmBinEntry *)entry)->GetBinArea();
}
/**
* @param group group number of the Entry
* @param elem element number of the Entry
*/
-void* gdcmDocument::LoadEntryVoidArea(uint16_t group, uint16_t elem)
+void* gdcmDocument::LoadEntryBinArea(uint16_t group, uint16_t elem)
{
gdcmDocEntry *docElement = GetDocEntryByNumber(group, elem);
if ( !docElement )
size_t o =(size_t)docElement->GetOffset();
fseek(Fp, o, SEEK_SET);
size_t l = docElement->GetLength();
- char* a = new char[l];
+ uint8_t* a = new uint8_t[l];
if(!a)
{
- dbg.Verbose(0, "gdcmDocument::LoadEntryVoidArea cannot allocate a");
+ dbg.Verbose(0, "gdcmDocument::LoadEntryBinArea cannot allocate a");
return NULL;
}
size_t l2 = fread(a, 1, l , Fp);
return NULL;
}
/// \todo Drop any already existing void area! JPR
- if( !SetEntryVoidAreaByNumber( a, group, elem ) );
+ if( !SetEntryBinAreaByNumber( a, group, elem ) );
{
- dbg.Verbose(0, "gdcmDocument::LoadEntryVoidArea setting failed.");
+ dbg.Verbose(0, "gdcmDocument::LoadEntryBinArea setting failed.");
}
return a;
}
/**
* \brief Loads (from disk) the element content
* when a string is not suitable
- * @param element Entry whose voidArea is going to be loaded
+ * @param element Entry whose binArea is going to be loaded
*/
-void *gdcmDocument::LoadEntryVoidArea(gdcmBinEntry *element)
+void* gdcmDocument::LoadEntryBinArea(gdcmBinEntry* element)
{
size_t o =(size_t)element->GetOffset();
fseek(Fp, o, SEEK_SET);
size_t l = element->GetLength();
- char* a = new char[l];
+ uint8_t* a = new uint8_t[l];
if( !a )
{
- dbg.Verbose(0, "gdcmDocument::LoadEntryVoidArea cannot allocate a");
+ dbg.Verbose(0, "gdcmDocument::LoadEntryBinArea cannot allocate a");
return NULL;
}
- element->SetVoidArea((void *)a);
+ element->SetBinArea((uint8_t*)a);
/// \todo check the result
size_t l2 = fread(a, 1, l , Fp);
if( l != l2 )
* @param element Element number of the searched Dicom Element
* @return
*/
-bool gdcmDocument::SetEntryVoidAreaByNumber(void * area,
+bool gdcmDocument::SetEntryBinAreaByNumber(uint8_t* area,
uint16_t group,
uint16_t element)
{
}
if ( gdcmBinEntry* binEntry = dynamic_cast<gdcmBinEntry*>(currentEntry) )
{
- binEntry->SetVoidArea( area );
+ binEntry->SetBinArea( area );
return true;
}
return true;
// hierarchy and the Key is simply of the form ( group, elem )...
if (gdcmDocument* dummy = dynamic_cast< gdcmDocument* > ( set ) )
{
+ (void)dummy;
newValEntry->SetKey( newValEntry->GetKey() );
}
// ...but when "set" is a gdcmSQItem, we are inserting this new
// form ( group, elem )...
if (gdcmDocument* dummy = dynamic_cast< gdcmDocument* > ( set ) )
{
+ (void)dummy;
newBinEntry->SetKey( newBinEntry->GetKey() );
}
// but when "this" is a SQItem, we are inserting this new
// level of one:
if (gdcmDocument* dummy = dynamic_cast< gdcmDocument* > ( set ) )
{
+ (void)dummy;
newSeqEntry->SetDepthLevel( 1 );
newSeqEntry->SetKey( newSeqEntry->GetKey() );
}
// When we find a BinEntry not very much can be done :
if (gdcmBinEntry* binEntryPtr = dynamic_cast< gdcmBinEntry* >(entry) )
{
- s << "gdcm::Loaded (BinEntry)";
+ s << GDCM_BINLOADED;
binEntryPtr->SetValue(s.str());
- LoadEntryVoidArea(binEntryPtr); // last one, not to erase length !
+ LoadEntryBinArea(binEntryPtr); // last one, not to erase length !
return;
}
* 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 gdcmElemenSet used
- * to build it. Hence if the underlying \ref gdcmElemenSet is
+ * returned \ref TagDocEntryHT and the \ref gdcmElementSet used
+ * to build it. Hence if the underlying \ref gdcmElementSet is
* altered, then it is the caller responsability to invoke
* \ref BuildFlatHashTable again...
* @return The flat std::map<> we juste build.