#include <gdcmSQItem.h>
Inheritance diagram for gdcm::SQItem:
Public Member Functions | |
virtual void | Print (std::ostream &os=std::cout, std::string const &indent="") |
Printer. | |
void | WriteContent (std::ofstream *fp, FileType filetype) |
write any type of entry to the entry set | |
uint32_t | ComputeFullLength () |
Compute the full length of the SQItem (not only value length) depending on the VR. | |
bool | AddEntry (DocEntry *Entry) |
Inserts *in the right place* any Entry (Dicom Element) into the Sequence Item. | |
bool | RemoveEntry (DocEntry *EntryToRemove) |
Clear the std::list from given entry AND delete the entry. | |
void | ClearEntry () |
Remove all entry in the Sequence Item. | |
DocEntry * | GetFirstEntry () |
Get the first Dicom entry while visiting the SQItem. | |
DocEntry * | GetNextEntry () |
Get the next Dicom entry while visiting the SQItem. | |
DocEntry * | GetDocEntry (uint16_t group, uint16_t elem) |
Gets a Dicom Element inside a SQ Item Entry. | |
bool | IsEmpty () |
Tells us if the set contains no entry. | |
int | GetSQItemNumber () |
returns the ordinal position of a given SQItem | |
void | SetSQItemNumber (int itemNumber) |
Sets the ordinal position of a given SQItem. | |
int | GetDepthLevel () |
Accessor on SQDepthLevel. | |
void | SetDepthLevel (int depth) |
Accessor on SQDepthLevel. | |
virtual void | Copy (DocEntrySet *set) |
Copies all the attributes from an other DocEntrySet. | |
virtual std::string | GetEntryString (uint16_t group, uint16_t elem) |
Get the "std::string representable" value of the Dicom entry. | |
virtual void * | GetEntryBinArea (uint16_t group, uint16_t elem) |
Gets (from Header) a 'non string' element value. | |
virtual int | GetEntryLength (uint16_t group, uint16_t elem) |
Searches within the DocEntrySet for the value length of a given tag.. | |
DataEntry * | GetDataEntry (uint16_t group, uint16_t elem) |
Same as Document::GetDocEntry except it returns a result only when the corresponding entry is of type DataEntry. | |
SeqEntry * | GetSeqEntry (uint16_t group, uint16_t elem) |
Same as Document::GetDocEntry except it returns a result only when the corresponding entry is of type SeqEntry. | |
bool | SetEntryString (std::string const &content, uint16_t group, uint16_t elem) |
Accesses an existing DocEntry (i.e. a Dicom Element) through it's (group, element) and modifies it's content with the given value. | |
bool | SetEntryString (std::string const &content, DataEntry *entry) |
Accesses an existing DocEntry (i.e. a Dicom Element) and modifies it's content with the given value. | |
bool | SetEntryBinArea (uint8_t *content, int lgth, uint16_t group, uint16_t elem) |
Accesses an existing DocEntry (i.e. a Dicom Element) through it's (group, element) and modifies it's content with the given value. | |
bool | SetEntryBinArea (uint8_t *content, int lgth, DataEntry *entry) |
Accesses an existing DataEntry (i.e. a Dicom Element) and modifies it's content with the given value. | |
DataEntry * | InsertEntryString (std::string const &value, uint16_t group, uint16_t elem, VRKey const &vr=GDCM_VRUNKNOWN) |
Modifies the value of a given Doc Entry (Dicom Element) when it exists. Create it with the given value when unexistant. | |
DataEntry * | InsertEntryBinArea (uint8_t *binArea, int lgth, uint16_t group, uint16_t elem, VRKey const &vr=GDCM_VRUNKNOWN) |
Modifies the value of a given Header Entry (Dicom Element) when it exists. Create it with the given value when unexistant. A copy of the binArea is made to be kept in the Document. | |
SeqEntry * | InsertSeqEntry (uint16_t group, uint16_t elem) |
Creates a new gdcm::SeqEntry and adds it to the current DocEntrySet. (remove any existing entry with same group,elem). | |
virtual bool | CheckIfEntryExist (uint16_t group, uint16_t elem) |
Checks if a given Dicom Element exists within the DocEntrySet. | |
DataEntry * | NewDataEntry (uint16_t group, uint16_t elem, VRKey const &vr=GDCM_VRUNKNOWN) |
Build a new DataEntry from all the low level arguments. Check for existence of dictionary entry, and build a default one when absent. | |
SeqEntry * | NewSeqEntry (uint16_t group, uint16_t elem) |
Build a new SeqEntry from all the low level arguments. Check for existence of dictionary entry, and build a default one when absent. | |
void | Delete () |
Delete the object. | |
void | Register () |
Register the object. | |
void | Unregister () |
Unregister the object. | |
const unsigned long & | GetRefCount () const |
Get the reference counting. | |
void | SetPrintLevel (int level) |
Sets the print level for the Dicom Header Elements. | |
int | GetPrintLevel () |
Gets the print level for the Dicom Entries. | |
Static Public Member Functions | |
static SQItem * | New (int depthLevel) |
Protected Member Functions | |
SQItem (int depthLevel) | |
Constructor from a given SQItem. | |
~SQItem () | |
Canonical destructor. | |
DictEntry * | GetDictEntry (uint16_t group, uint16_t elem) |
Searches [both] the public [and the shadow dictionary (when they exist)] for the presence of the DictEntry with given group and element. The public dictionary has precedence on the shadow one(s), if any. | |
DictEntry * | GetDictEntry (uint16_t group, uint16_t elem, VRKey const &vr) |
Searches [both] the public [and the shadow dictionary (when they exist)] for the presence of the DictEntry with given group and element, and create a new virtual DictEntry if necessary. | |
Protected Attributes | |
ListDocEntry | DocEntries |
Chained list of Doc Entries. | |
ListDocEntry::iterator | ItDocEntries |
Iterator, used to visit the entries. | |
DocEntry * | PreviousDocEntry |
To be able to backtrack (Private Sequence, Implicit VR related pb). | |
int | PrintLevel |
Amount of printed details for each Dicom Entries : 0 : stands for the least detail level. | |
Private Member Functions | |
gdcmTypeMacro (SQItem) | |
Private Attributes | |
int | SQDepthLevel |
Sequences can be nested. This SQDepthLevel represents the level of the nesting of instances of this class. SQDepthLevel and its SeqEntry::SQDepthLevel counterpart are only defined on printing purposes (see Print). | |
int | SQItemNumber |
SQ Item ordinal number. |
Definition at line 41 of file gdcmSQItem.h.
|
Constructor from a given SQItem.
Definition at line 35 of file gdcmSQItem.cxx. References SQDepthLevel, and SQItemNumber. 00036 : DocEntrySet( ) 00037 { 00038 SQDepthLevel = depthLevel; 00039 SQItemNumber = 0; 00040 }
|
|
Canonical destructor.
Definition at line 45 of file gdcmSQItem.cxx. References ClearEntry(). 00046 { 00047 ClearEntry(); 00048 }
|
|
Inserts *in the right place* any Entry (Dicom Element) into the Sequence Item.
Implements gdcm::DocEntrySet. Definition at line 131 of file gdcmSQItem.cxx. References DocEntries, gdcm::DocEntry::GetElement(), gdcm::DocEntry::GetGroup(), and gdcm::RefCounter::Register(). Referenced by gdcm::FileHelper::CheckMandatoryElements(), gdcm::DicomDirObject::FillObject(), gdcm::DicomDir::NewMeta(), and gdcm::DicomDir::SetElement(). 00132 { 00133 if (DocEntries.empty() ) 00134 { 00135 DocEntries.push_back(entry); 00136 entry->Register(); 00137 return true; 00138 } 00139 00140 ListDocEntry::iterator insertSpot; 00141 ListDocEntry::iterator it = DocEntries.end(); 00142 do 00143 { 00144 it--; 00145 00146 if ( (*it)->IsItemDelimitor() ) 00147 { 00148 continue; 00149 } 00150 if ( (*it)->GetGroup() < entry->GetGroup() ) 00151 break; 00152 else 00153 if ( (*it)->GetGroup() == entry->GetGroup() && 00154 (*it)->GetElement() < entry->GetElement() ) 00155 break; 00156 } while (it != DocEntries.begin() ); 00157 00158 ++it; 00159 insertSpot = it; 00160 DocEntries.insert(insertSpot, entry); 00161 entry->Register(); 00162 return true; 00163 }
|
|
Checks if a given Dicom Element exists within the DocEntrySet.
Definition at line 392 of file gdcmDocEntrySet.cxx. References gdcm::DocEntrySet::GetDocEntry(). 00393 { 00394 return GetDocEntry(group,elem)!=NULL; 00395 }
|
|
Remove all entry in the Sequence Item.
Implements gdcm::DocEntrySet. Definition at line 191 of file gdcmSQItem.cxx. References DocEntries. Referenced by Copy(), and ~SQItem(). 00192 { 00193 for(ListDocEntry::iterator cc = DocEntries.begin(); 00194 cc != DocEntries.end(); 00195 ++cc) 00196 { 00197 (*cc)->Unregister(); 00198 } 00199 DocEntries.clear(); 00200 }
|
|
Compute the full length of the SQItem (not only value length) depending on the VR.
Definition at line 106 of file gdcmSQItem.cxx. References DocEntries. 00107 { 00108 uint32_t l = 8; // Item Starter length 00109 for (ListDocEntry::iterator it = DocEntries.begin(); 00110 it != DocEntries.end(); 00111 ++it) 00112 { 00113 // we skip delimitors (start and end one) because 00114 // we force them as 'no length' 00115 if ( (*it)->GetGroup() == 0xfffe ) 00116 { 00117 continue; 00118 } 00119 l += (*it)->ComputeFullLength(); 00120 } 00121 l += 8; // 'Item Delimitation' item 00122 return l; 00123 }
|
|
Copies all the attributes from an other DocEntrySet.
Reimplemented from gdcm::DocEntrySet. Reimplemented in gdcm::DicomDirPatient, gdcm::DicomDirSerie, and gdcm::DicomDirStudy. Definition at line 249 of file gdcmSQItem.cxx. References ClearEntry(), gdcm::DocEntrySet::Copy(), DocEntries, ItDocEntries, SQDepthLevel, and SQItemNumber. Referenced by gdcm::DicomDirStudy::Copy(), gdcm::DicomDirSerie::Copy(), gdcm::DicomDirPatient::Copy(), and gdcm::DicomDir::CreateDicomDir(). 00250 { 00251 // Remove all previous entries 00252 ClearEntry(); 00253 00254 DocEntrySet::Copy(set); 00255 00256 SQItem *sq = dynamic_cast<SQItem *>(set); 00257 if( sq ) 00258 { 00259 SQDepthLevel = sq->SQDepthLevel; 00260 SQItemNumber = sq->SQItemNumber; 00261 00262 DocEntries = sq->DocEntries; 00263 for(ItDocEntries = DocEntries.begin();ItDocEntries != DocEntries.end();++ItDocEntries) 00264 (*ItDocEntries)->Register(); 00265 } 00266 }
|
|
|
|
|
|
Accessor on SQDepthLevel.
Definition at line 70 of file gdcmSQItem.h. 00070 { return SQDepthLevel; }
|
|
Searches [both] the public [and the shadow dictionary (when they exist)] for the presence of the DictEntry with given group and element, and create a new virtual DictEntry if necessary.
Definition at line 484 of file gdcmDocEntrySet.cxx. References gdcm::GDCM_VRUNKNOWN, gdcmWarningMacro, gdcm::DocEntrySet::GetDictEntry(), gdcm::DictEntry::GetVM(), gdcm::DictEntry::GetVR(), gdcm::DictEntry::New(), gdcm::RefCounter::Register(), and gdcm::RefCounter::Unregister(). 00486 { 00487 DictEntry *dictEntry = GetDictEntry(group,elem); 00488 DictEntry *goodEntry = dictEntry; 00489 VRKey goodVR = vr; 00490 TagName vm; 00491 if (elem == 0x0000) 00492 goodVR="UL"; 00493 00494 if ( goodEntry ) 00495 { 00496 if ( goodVR != goodEntry->GetVR() 00497 && goodVR != GDCM_VRUNKNOWN ) 00498 { 00499 gdcmWarningMacro("For (" << std::hex << group << "|" 00500 << elem << "), found VR : [" << vr << "]" 00501 << " expected: [" << goodEntry->GetVR() << "]" ) ; 00502 // avoid confusing further validator with "FIXME" VM 00503 // when possible 00504 vm = dictEntry->GetVM(); 00505 goodEntry = NULL; 00506 } 00507 dictEntry->Unregister(); 00508 } 00509 else 00510 { 00511 vm = "FIXME"; 00512 } 00513 // Create a new virtual DictEntry if necessary 00514 if (!goodEntry) 00515 { 00516 if (dictEntry) 00517 { 00518 00519 goodEntry = DictEntry::New(group, elem, goodVR, vm,//"FIXME", 00520 dictEntry->GetName() ); 00521 } 00522 else 00523 { 00524 goodEntry = DictEntry::New(group, elem, goodVR); 00525 } 00526 } 00527 else 00528 { 00529 goodEntry->Register(); 00530 } 00531 return goodEntry; 00532 }
|
|
Searches [both] the public [and the shadow dictionary (when they exist)] for the presence of the DictEntry with given group and element. The public dictionary has precedence on the shadow one(s), if any.
Definition at line 457 of file gdcmDocEntrySet.cxx. References gdcmWarningMacro, gdcm::DictSet::GetDefaultPubDict(), gdcm::Global::GetDicts(), gdcm::Dict::GetEntry(), and gdcm::RefCounter::Register(). Referenced by gdcm::DocEntrySet::GetDictEntry(), gdcm::DocEntrySet::NewDataEntry(), gdcm::DocEntrySet::NewSeqEntry(), and gdcm::Document::ReadNextDocEntry(). 00458 { 00459 DictEntry *found = 0; 00460 Dict *pubDict = Global::GetDicts()->GetDefaultPubDict(); 00461 if (!pubDict) 00462 { 00463 gdcmWarningMacro( "We SHOULD have a default dictionary"); 00464 } 00465 else 00466 { 00467 found = pubDict->GetEntry(group, elem); 00468 if( found ) 00469 found->Register(); 00470 } 00471 return found; 00472 }
|
|
Gets a Dicom Element inside a SQ Item Entry.
Implements gdcm::DocEntrySet. Definition at line 232 of file gdcmSQItem.cxx. References DocEntries. Referenced by gdcm::DicomDir::CreateDicomDir(). 00233 { 00234 for(ListDocEntry::iterator i = DocEntries.begin(); 00235 i != DocEntries.end(); 00236 ++i) 00237 { 00238 if ( (*i)->GetGroup() == group && (*i)->GetElement() == elem ) 00239 return *i; 00240 } 00241 return NULL; 00242 }
|
|
Gets (from Header) a 'non string' element value.
Definition at line 69 of file gdcmDocEntrySet.cxx. References gdcm::DataEntry::GetBinArea(), and gdcm::DocEntrySet::GetDataEntry(). Referenced by gdcm::PixelReadConvert::GrabInformationsFromFile(). 00070 { 00071 DataEntry *entry = GetDataEntry(group, elem); 00072 if ( entry ) 00073 return entry->GetBinArea(); 00074 return 0; 00075 }
|
|
Searches within the DocEntrySet for the value length of a given tag..
Definition at line 84 of file gdcmDocEntrySet.cxx. References gdcm::DocEntrySet::GetDocEntry(), and gdcm::DocEntry::GetLength(). Referenced by gdcm::DicomDir::SetElement(), and gdcm::File::Write(). 00085 { 00086 DocEntry *entry = GetDocEntry(group, elem); 00087 if ( entry ) 00088 return entry->GetLength(); 00089 return -1; 00090 }
|
|
Get the "std::string representable" value of the Dicom entry.
Definition at line 47 of file gdcmDocEntrySet.cxx. References gdcm::GDCM_NOTLOADED, gdcm::GDCM_UNFOUND, gdcm::GDCM_UNREAD, gdcm::DocEntrySet::GetDocEntry(), gdcm::DataEntry::GetString(), gdcm::DataEntry::IsNotLoaded(), gdcm::DataEntry::IsUnfound(), and gdcm::DataEntry::IsUnread(). Referenced by gdcm::SerieHelper::AddFileName(), gdcm::File::AnonymizeFile(), gdcm::FileHelper::CheckMandatoryElements(), gdcm::SerieHelper::CreateUniqueSeriesIdentifier(), gdcm::SerieHelper::CreateUserDefinedFileIdentifier(), gdcm::Document::DoTheLoadingDocumentJob(), gdcm::File::DoTheLoadingJob(), gdcm::File::GetImageNumber(), gdcm::File::GetImageOrientationPatient(), gdcm::File::GetLUTNbits(), gdcm::File::GetModality(), gdcm::File::GetNumberOfScalarComponents(), gdcm::File::GetNumberOfScalarComponentsRaw(), gdcm::File::GetPixelSize(), gdcm::File::GetPixelType(), gdcm::Document::GetTransferSyntaxName(), gdcm::PixelReadConvert::GrabInformationsFromFile(), gdcm::File::IsMonochrome(), gdcm::File::IsMonochrome1(), gdcm::File::IsPaletteColor(), gdcm::File::IsReadable(), gdcm::File::IsYBRFull(), gdcm::Document::operator<(), and gdcm::DicomDir::SetElement(). 00048 { 00049 DataEntry *entry = dynamic_cast<DataEntry *>(GetDocEntry(group,elem)); 00050 if ( entry ) 00051 { 00052 if( entry->IsNotLoaded() ) 00053 return GDCM_NOTLOADED; 00054 if( entry->IsUnfound() ) 00055 return GDCM_UNFOUND; 00056 if( entry->IsUnread() ) 00057 return GDCM_UNREAD; 00058 return entry->GetString(); 00059 } 00060 return GDCM_UNFOUND; 00061 }
|
|
Get the first Dicom entry while visiting the SQItem.
Implements gdcm::DocEntrySet. Definition at line 206 of file gdcmSQItem.cxx. References DocEntries, and ItDocEntries. Referenced by gdcm::DicomDirMeta::ComputeGroup0002Length(). 00207 { 00208 ItDocEntries = DocEntries.begin(); 00209 if ( ItDocEntries != DocEntries.end() ) 00210 return *ItDocEntries; 00211 return 0; 00212 }
|
|
Get the next Dicom entry while visiting the SQItem.
Implements gdcm::DocEntrySet. Definition at line 218 of file gdcmSQItem.cxx. References DocEntries, and ItDocEntries. Referenced by gdcm::DicomDirMeta::ComputeGroup0002Length(). 00219 { 00220 ++ItDocEntries; 00221 if ( ItDocEntries != DocEntries.end() ) 00222 return *ItDocEntries; 00223 return NULL; 00224 }
|
|
Gets the print level for the Dicom Entries.
Definition at line 50 of file gdcmBase.h. 00050 { return PrintLevel; }
|
|
Get the reference counting.
Definition at line 56 of file gdcmRefCounter.h. 00057 { 00058 return RefCount; 00059 }
|
|
Same as Document::GetDocEntry except it returns a result only when the corresponding entry is of type SeqEntry.
Definition at line 115 of file gdcmDocEntrySet.cxx. References gdcm::DocEntrySet::GetDocEntry(). Referenced by gdcm::Document::DoTheLoadingDocumentJob(). 00116 { 00117 DocEntry *currentEntry = GetDocEntry(group, elem); 00118 if ( !currentEntry ) 00119 return NULL; 00120 00121 return dynamic_cast<SeqEntry*>(currentEntry); 00122 }
|
|
returns the ordinal position of a given SQItem
Definition at line 65 of file gdcmSQItem.h. 00065 { return SQItemNumber; }
|
|
Modifies the value of a given Header Entry (Dicom Element) when it exists. Create it with the given value when unexistant. A copy of the binArea is made to be kept in the Document.
Definition at line 270 of file gdcmDocEntrySet.cxx. References gdcm::DocEntrySet::AddEntry(), gdcm::RefCounter::Delete(), gdcmWarningMacro, gdcm::DocEntrySet::GetDocEntry(), gdcm::DocEntry::GetVR(), gdcm::DocEntrySet::NewDataEntry(), gdcm::DocEntrySet::RemoveEntry(), and gdcm::DocEntrySet::SetEntryBinArea(). Referenced by gdcm::FileHelper::InsertEntryBinArea(). 00273 { 00274 DataEntry *dataEntry = 0; 00275 DocEntry *currentEntry = GetDocEntry( group, elem ); 00276 00277 // Verify the currentEntry 00278 if (currentEntry) 00279 { 00280 dataEntry = dynamic_cast<DataEntry *>(currentEntry); 00281 00282 // Verify the VR 00283 if ( dataEntry ) 00284 if ( dataEntry->GetVR()!=vr ) 00285 dataEntry = NULL; 00286 00287 // if currentEntry doesn't correspond to the requested dataEntry 00288 if ( !dataEntry) 00289 { 00290 if ( !RemoveEntry(currentEntry) ) 00291 { 00292 gdcmWarningMacro( "Removal of previous DocEntry failed."); 00293 return NULL; 00294 } 00295 } 00296 } 00297 00298 // Create a new dataEntry if necessary 00299 if ( !dataEntry) 00300 { 00301 dataEntry = NewDataEntry(group, elem, vr); 00302 00303 if ( !AddEntry(dataEntry) ) 00304 { 00305 gdcmWarningMacro( "AddEntry failed although this is a creation."); 00306 dataEntry->Delete(); 00307 return NULL; 00308 } 00309 dataEntry->Delete(); 00310 } 00311 00312 // Set the dataEntry value 00313 uint8_t *tmpArea; 00314 if ( lgth>0 && binArea ) 00315 { 00316 tmpArea = new uint8_t[lgth]; 00317 memcpy(tmpArea,binArea,lgth); 00318 } 00319 else 00320 { 00321 tmpArea = 0; 00322 } 00323 if ( !SetEntryBinArea(tmpArea,lgth,dataEntry) ) 00324 { 00325 if ( tmpArea ) 00326 { 00327 delete[] tmpArea; 00328 } 00329 } 00330 return dataEntry; 00331 }
|
|
Modifies the value of a given Doc Entry (Dicom Element) when it exists. Create it with the given value when unexistant.
Definition at line 212 of file gdcmDocEntrySet.cxx. References gdcm::DocEntrySet::AddEntry(), gdcm::RefCounter::Delete(), gdcmWarningMacro, gdcm::DocEntrySet::GetDocEntry(), gdcm::DocEntry::GetVR(), gdcm::DocEntrySet::NewDataEntry(), gdcm::DocEntrySet::RemoveEntry(), and gdcm::DocEntrySet::SetEntryString(). Referenced by gdcm::FileHelper::InsertEntryString(), gdcm::FileHelper::Write(), and gdcm::File::Write(). 00215 { 00216 DataEntry *dataEntry = 0; 00217 DocEntry *currentEntry = GetDocEntry( group, elem ); 00218 00219 if (currentEntry) 00220 { 00221 dataEntry = dynamic_cast<DataEntry *>(currentEntry); 00222 00223 // Verify the VR 00224 if ( dataEntry ) 00225 if ( dataEntry->GetVR()!=vr ) 00226 dataEntry = NULL; 00227 00228 // if currentEntry doesn't correspond to the requested dataEntry 00229 if ( !dataEntry) 00230 { 00231 if ( !RemoveEntry(currentEntry) ) 00232 { 00233 gdcmWarningMacro( "Removal of previous DocEntry failed."); 00234 return NULL; 00235 } 00236 } 00237 } 00238 00239 // Create a new dataEntry if necessary 00240 if ( !dataEntry ) 00241 { 00242 dataEntry = NewDataEntry( group, elem, vr ); 00243 00244 if ( !AddEntry(dataEntry) ) 00245 { 00246 gdcmWarningMacro("AddEntry failed although this is a creation."); 00247 dataEntry->Delete(); 00248 return NULL; 00249 } 00250 dataEntry->Delete(); 00251 } 00252 00253 // Set the dataEntry value 00254 SetEntryString(value, dataEntry); // The std::string value 00255 return dataEntry; 00256 }
|
|
Creates a new gdcm::SeqEntry and adds it to the current DocEntrySet. (remove any existing entry with same group,elem).
Definition at line 341 of file gdcmDocEntrySet.cxx. References gdcm::DocEntrySet::AddEntry(), gdcm::RefCounter::Delete(), gdcmWarningMacro, gdcm::DocEntrySet::GetDocEntry(), gdcm::DocEntrySet::NewSeqEntry(), and gdcm::DocEntrySet::RemoveEntry(). Referenced by gdcm::FileHelper::InsertSeqEntry(). 00342 { 00343 SeqEntry *seqEntry = 0; 00344 DocEntry *currentEntry = GetDocEntry( group, elem ); 00345 00346 // Verify the currentEntry 00347 if ( currentEntry ) 00348 { 00349 seqEntry = dynamic_cast<SeqEntry *>(currentEntry); 00350 00351 // Verify the VR 00352 if ( seqEntry ) 00353 seqEntry = NULL; 00354 00355 // if currentEntry doesn't correspond to the requested seqEntry 00356 if ( !seqEntry ) 00357 { 00358 if (!RemoveEntry(currentEntry)) 00359 { 00360 gdcmWarningMacro( "Removal of previous DocEntry failed for (" 00361 <<std::hex << group << "|" << elem <<")" ); 00362 return NULL; 00363 } 00364 } 00365 } 00366 // Create a new seqEntry if necessary 00367 if ( !seqEntry ) 00368 { 00369 seqEntry = NewSeqEntry(group, elem); 00370 00371 if ( !AddEntry(seqEntry) ) 00372 { 00373 gdcmWarningMacro( "AddEntry failed although this is a creation for (" 00374 <<std::hex << group << "|" << elem <<")" ); 00375 seqEntry->Delete(); 00376 return NULL; 00377 } 00378 seqEntry->Delete(); 00379 } 00380 // Remark : 00381 // SequenceDelimitationItem will be added at the end of the SeqEntry, 00382 // at write time 00383 return seqEntry; 00384 }
|
|
Tells us if the set contains no entry.
Implements gdcm::DocEntrySet. Definition at line 62 of file gdcmSQItem.h. 00062 { return DocEntries.empty(); }
|
|
Definition at line 46 of file gdcmSQItem.h. Referenced by gdcm::FileHelper::CheckMandatoryElements(), and gdcm::Document::ParseSQ(). 00046 {return new SQItem(depthLevel);}
|
|
Build a new DataEntry from all the low level arguments. Check for existence of dictionary entry, and build a default one when absent.
Definition at line 406 of file gdcmDocEntrySet.cxx. References gdcmWarningMacro, gdcm::DocEntrySet::GetDictEntry(), gdcm::DataEntry::New(), and gdcm::RefCounter::Unregister(). Referenced by gdcm::FileHelper::CopyDataEntry(), gdcm::DocEntrySet::InsertEntryBinArea(), gdcm::DocEntrySet::InsertEntryString(), and gdcm::Document::ReadNextDocEntry(). 00408 { 00409 DictEntry *dictEntry = GetDictEntry(group, elem, vr); 00410 00411 DataEntry *newEntry = DataEntry::New(dictEntry); 00412 dictEntry->Unregister(); // GetDictEntry register it 00413 if (!newEntry) 00414 { 00415 gdcmWarningMacro( "Failed to allocate DataEntry for (" 00416 <<std::hex << group << "|" << elem <<")" ); 00417 return 0; 00418 } 00419 return newEntry; 00420 }
|
|
Build a new SeqEntry from all the low level arguments. Check for existence of dictionary entry, and build a default one when absent.
Definition at line 430 of file gdcmDocEntrySet.cxx. References gdcmWarningMacro, gdcm::DocEntrySet::GetDictEntry(), gdcm::SeqEntry::New(), and gdcm::RefCounter::Unregister(). Referenced by gdcm::Document::Backtrack(), gdcm::DocEntrySet::InsertSeqEntry(), and gdcm::Document::ReadNextDocEntry(). 00431 { 00432 DictEntry *dictEntry = GetDictEntry(group, elem, "SQ"); 00433 00434 SeqEntry *newEntry = SeqEntry::New( dictEntry ); 00435 dictEntry->Unregister(); // GetDictEntry register it 00436 if (!newEntry) 00437 { 00438 gdcmWarningMacro( "Failed to allocate SeqEntry for (" 00439 <<std::hex << group << "|" << elem <<")" ); 00440 return 0; 00441 } 00442 return newEntry; 00443 }
|
|
Printer.
Reimplemented from gdcm::Base. Reimplemented in gdcm::DicomDirImage, gdcm::DicomDirMeta, gdcm::DicomDirPatient, gdcm::DicomDirSerie, gdcm::DicomDirStudy, and gdcm::DicomDirVisit. Definition at line 281 of file gdcmSQItem.cxx. References DocEntries, gdcm::DocEntry::Print(), gdcm::Base::PrintLevel, gdcm::Base::SetPrintLevel(), SQDepthLevel, and SQItemNumber. Referenced by gdcm::DicomDirVisit::Print(), gdcm::DicomDirStudy::Print(), gdcm::DicomDirSerie::Print(), gdcm::DicomDirPatient::Print(), and gdcm::DicomDirImage::Print(). 00282 { 00283 std::ostringstream s; 00284 00285 if (SQDepthLevel > 0) 00286 { 00287 for (int i = 0; i < SQDepthLevel; ++i) 00288 { 00289 s << " | " ; 00290 } 00291 } 00292 os << s.str() << " --- SQItem number " << SQItemNumber << std::endl; 00293 for (ListDocEntry::iterator i = DocEntries.begin(); 00294 i != DocEntries.end(); 00295 ++i) 00296 { 00297 DocEntry *Entry = *i; 00298 bool PrintEndLine = true; 00299 00300 os << s.str(); 00301 Entry->SetPrintLevel(PrintLevel); 00302 Entry->Print(os); 00303 if ( dynamic_cast<SeqEntry*>(Entry) ) 00304 { 00305 PrintEndLine = false; 00306 } 00307 if (PrintEndLine) 00308 { 00309 os << std::endl; 00310 } 00311 } 00312 }
|
|
Register the object.
Definition at line 44 of file gdcmRefCounter.h. Referenced by AddEntry(), gdcm::ElementSet::AddEntry(), gdcm::Dict::AddEntry(), gdcm::SeqEntry::AddSQItem(), gdcm::SeqEntry::Copy(), gdcm::DicomDir::Copy(), gdcm::DocEntry::DocEntry(), gdcm::FileHelper::FileHelper(), gdcm::DocEntrySet::GetDictEntry(), gdcm::CommandManager::InSetCommand(), gdcm::DocEntryArchive::Push(), gdcm::Dict::ReplaceEntry(), and gdcm::SeqEntry::SetDelimitationItem(). 00044 { RefCount++; }
|
|
Clear the std::list from given entry AND delete the entry.
Implements gdcm::DocEntrySet. Definition at line 170 of file gdcmSQItem.cxx. References DocEntries, gdcmDebugMacro, gdcmWarningMacro, gdcm::DocEntry::GetKey(), and gdcm::RefCounter::Unregister(). 00171 { 00172 for(ListDocEntry::iterator it = DocEntries.begin(); 00173 it != DocEntries.end(); 00174 ++it) 00175 { 00176 if ( *it == entryToRemove ) 00177 { 00178 DocEntries.erase(it); 00179 gdcmDebugMacro( "One element erased: " << entryToRemove->GetKey() ); 00180 entryToRemove->Unregister(); 00181 return true; 00182 } 00183 } 00184 gdcmWarningMacro( "Entry not found: " << entryToRemove->GetKey() ); 00185 return false ; 00186 }
|
|
Accessor on SQDepthLevel.
Definition at line 73 of file gdcmSQItem.h. 00073 { SQDepthLevel = depth; }
|
|
Accesses an existing DataEntry (i.e. a Dicom Element) and modifies it's content with the given value.
Definition at line 191 of file gdcmDocEntrySet.cxx. References gdcm::DataEntry::SetBinArea(), and gdcm::DocEntry::SetLength(). 00192 { 00193 if (entry) 00194 { 00195 entry->SetLength(lgth); 00196 entry->SetBinArea(content); 00197 return true; 00198 } 00199 return false; 00200 }
|
|
Accesses an existing DocEntry (i.e. a Dicom Element) through it's (group, element) and modifies it's content with the given value.
Definition at line 154 of file gdcmDocEntrySet.cxx. References gdcmWarningMacro, and gdcm::DocEntrySet::GetDataEntry(). Referenced by gdcm::DocEntrySet::InsertEntryBinArea(), and gdcm::FileHelper::SetEntryBinArea(). 00156 { 00157 DataEntry *entry = GetDataEntry(group, elem); 00158 if (!entry ) 00159 { 00160 gdcmWarningMacro( "No corresponding DataEntry " << std::hex << group << 00161 "," << elem << " element (try promotion first)."); 00162 return false; 00163 } 00164 00165 return SetEntryBinArea(content,lgth,entry); 00166 }
|
|
Accesses an existing DocEntry (i.e. a Dicom Element) and modifies it's content with the given value.
Definition at line 174 of file gdcmDocEntrySet.cxx. References gdcm::DataEntry::SetString(). 00175 { 00176 if (entry) 00177 { 00178 entry->SetString(content); 00179 return true; 00180 } 00181 return false; 00182 }
|
|
Accesses an existing DocEntry (i.e. a Dicom Element) through it's (group, element) and modifies it's content with the given value.
Definition at line 132 of file gdcmDocEntrySet.cxx. References gdcmWarningMacro, and gdcm::DocEntrySet::GetDataEntry(). Referenced by gdcm::File::AnonymizeFile(), gdcm::Document::DoTheLoadingDocumentJob(), gdcm::DocEntrySet::InsertEntryString(), and gdcm::FileHelper::SetEntryString(). 00134 { 00135 DataEntry *entry = GetDataEntry(group, elem); 00136 if (!entry ) 00137 { 00138 gdcmWarningMacro( "No corresponding DataEntry " << std::hex << group << 00139 "," << elem << " element (try promotion first)."); 00140 return false; 00141 } 00142 return SetEntryString(content,entry); 00143 }
|
|
Sets the print level for the Dicom Header Elements.
Definition at line 47 of file gdcmBase.h. Referenced by Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), and gdcm::DicomDir::Print(). 00047 { PrintLevel = level; }
|
|
Sets the ordinal position of a given SQItem.
Definition at line 67 of file gdcmSQItem.h. Referenced by gdcm::SeqEntry::AddSQItem(), and gdcm::DicomDir::NewMeta(). 00067 { SQItemNumber = itemNumber; }
|
|
Unregister the object.
Definition at line 48 of file gdcmRefCounter.h. Referenced by gdcm::SeqEntry::ClearSQItem(), gdcm::DicomDir::Copy(), gdcm::DocEntrySet::GetDictEntry(), gdcm::CommandManager::InSetCommand(), gdcm::DocEntrySet::NewDataEntry(), gdcm::DocEntrySet::NewSeqEntry(), gdcm::Document::ReadNextDocEntry(), RemoveEntry(), gdcm::ElementSet::RemoveEntry(), gdcm::SeqEntry::SetDelimitationItem(), gdcm::DocEntry::~DocEntry(), and gdcm::FileHelper::~FileHelper().
|
|
write any type of entry to the entry set
Implements gdcm::DocEntrySet. Reimplemented in gdcm::DicomDirMeta, gdcm::DicomDirPatient, gdcm::DicomDirSerie, and gdcm::DicomDirStudy. Definition at line 57 of file gdcmSQItem.cxx. References gdcm::binary_write(), and DocEntries. Referenced by gdcm::DicomDirStudy::WriteContent(), gdcm::DicomDirSerie::WriteContent(), and gdcm::DicomDirPatient::WriteContent(). 00058 { 00059 int j; 00060 uint16_t item[4] = { 0xfffe, 0xe000, 0xffff, 0xffff }; 00061 uint16_t itemt[4]= { 0xfffe, 0xe00d, 0x0000, 0x0000 }; 00062 00063 //we force the writting of an 'Item' Start Element 00064 // because we want to write the Item as a 'No Length' item 00065 for(j=0;j<4;++j) 00066 { 00067 binary_write( *fp, item[j]); // fffe e000 ffff ffff 00068 } 00069 00070 for (ListDocEntry::iterator it = DocEntries.begin(); 00071 it != DocEntries.end(); 00072 ++it) 00073 { 00074 // we skip delimitors (start and end one) because 00075 // we force them as 'no length' 00076 if ( (*it)->GetGroup() == 0xfffe ) 00077 { 00078 continue; 00079 } 00080 00081 // Fix in order to make some MR PHILIPS images e-film readable 00082 // see gdcmData/gdcm-MR-PHILIPS-16-Multi-Seq.dcm: 00083 // we just *always* ignore spurious fffe|0000 tag ! 00084 if ( (*it)->GetGroup() == 0xfffe && (*it)->GetElement() == 0x0000 ) 00085 { 00086 break; // FIXME : break or continue; ?!? 00087 // --> makes no difference since the only bugged file we have 00088 // contains 'impossible tag' fffe|0000 in last position ! 00089 } 00090 00091 (*it)->WriteContent(fp, filetype); 00092 } 00093 00094 //we force the writting of an 'Item Delimitation' item 00095 // because we wrote the Item as a 'no Length' item 00096 for(j=0;j<4;++j) 00097 { 00098 binary_write( *fp, itemt[j]); // fffe e000 0000 0000 00099 } 00100 }
|
|
Chained list of Doc Entries.
Definition at line 83 of file gdcmSQItem.h. Referenced by AddEntry(), ClearEntry(), ComputeFullLength(), Copy(), GetDocEntry(), GetFirstEntry(), GetNextEntry(), Print(), gdcm::DicomDirVisit::Print(), gdcm::DicomDirMeta::Print(), gdcm::DicomDirImage::Print(), RemoveEntry(), WriteContent(), and gdcm::DicomDirMeta::WriteContent(). |
|
Iterator, used to visit the entries.
Definition at line 85 of file gdcmSQItem.h. Referenced by Copy(), GetFirstEntry(), and GetNextEntry(). |
|
To be able to backtrack (Private Sequence, Implicit VR related pb).
Definition at line 127 of file gdcmDocEntrySet.h. Referenced by gdcm::Document::Backtrack(), gdcm::DocEntrySet::DocEntrySet(), and gdcm::Document::ParseDES(). |
|
Amount of printed details for each Dicom Entries : 0 : stands for the least detail level.
Definition at line 55 of file gdcmBase.h. Referenced by Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), gdcm::DocEntry::Print(), gdcm::DictEntry::Print(), gdcm::DicomDirStudy::Print(), gdcm::DicomDirSerie::Print(), gdcm::DicomDirPatient::Print(), gdcm::DicomDirMeta::Print(), gdcm::DicomDir::Print(), and gdcm::DataEntry::Print(). |
|
Sequences can be nested. This SQDepthLevel represents the level of the nesting of instances of this class. SQDepthLevel and its SeqEntry::SQDepthLevel counterpart are only defined on printing purposes (see Print).
Definition at line 93 of file gdcmSQItem.h. |
|
SQ Item ordinal number.
Definition at line 96 of file gdcmSQItem.h. |