- * \brief Get the value of a Dicom Element inside a SQ Item Entry, by number
- * @return
- */
-
-std::string gdcmSQItem::GetEntryByNumber(guint16 group, guint16 element) {
- for(ListDocEntry::iterator i=docEntries.begin();i!=docEntries.end();++i) {
- if ( (*i)->GetGroup()==group && (*i)->GetElement()==element) {
- return ((gdcmValEntry *)(*i))->GetValue();
- }
- }
- return GDCM_UNFOUND;
+ * \brief Get the first ValEntry while visiting theSQItem
+ * This method is designed for Python users
+ * \return The first ValEntry if found, otherwhise NULL
+ */
+ValEntry *SQItem::GetFirstValEntry()
+{
+ gdcm::ValEntry *valEntry;
+ gdcm::DocEntry *d = GetFirstEntry();
+ // an other iterator is needed to allow user iterate
+ // at the same time both on DocEntries and ValEntries
+ ItValEntries = ItDocEntries;
+ if ( (valEntry = dynamic_cast<gdcm::ValEntry*>(d)))
+ return valEntry;
+ return GetNextValEntry();
+}
+
+/**
+ * \brief Get the next ValEntry while visiting the SQItem
+ * \return The next ValEntry if found, otherwhise NULL
+ */
+ValEntry *SQItem::GetNextValEntry()
+{
+ gdcm::ValEntry *valEntry;
+ gdcm::DocEntry *d = *ItValEntries;
+ ++ItValEntries;
+ while( d )
+ {
+ if ( (valEntry = dynamic_cast<gdcm::ValEntry*>(d)))
+ return valEntry;
+ else
+ return GetNextValEntry();
+ }
+ return 0;
+}
+
+/**
+ * \brief Gets a Dicom Element inside a SQ Item Entry
+ * @param group Group number of the Entry
+ * @param elem Element number of the Entry
+ * @return Entry whose (group,elem) was passed. 0 if not found
+ */
+DocEntry *SQItem::GetDocEntry(uint16_t group, uint16_t elem)
+{
+ for(ListDocEntry::iterator i = DocEntries.begin();
+ i != DocEntries.end();
+ ++i)
+ {
+ if ( (*i)->GetGroup() == group && (*i)->GetElement() == elem )
+ return *i;
+ }
+ return NULL;