Hi Brano,<br><br>Sorry for the delay in my response.<br>I have not yet submitted that article. I still have to fix some things in my code.<br><br>I was previously writing the sequence data into a DICOM file, but not reading.<br>
Thanks to the suggestions of Mathieu for writing DICOM sequences.<br><br>I will mention here how I was writing the DICOM sequences. Similar approach may be helpful for loading as well.<br><br><br>// Each sequence is encapsulated inside a dictionary, and this dictionary is<br>
// further encapsulated inside the final dictionary which is passed to the writer.<br><br>// Each Sequence can contain multiple items.<br>// So, for separating the items within a sequence, they are also encapsulated<br>// inside dictionary. <br>
// But for distinguishing the dictionary of sequence from a dictionary of Item,<br>// a special string is used for items.<br>//<br>//<br>// For instance, the following special string is used for distinguishing the<br>// encapsulation of an Item of DICOM sequence from the encapsulation of the<br>
// DICOM sequence itself.<br>//<br>const std::string ITEM_ENCAPSULATE_STRING(&quot;DICOM_ITEM_ENCAPSULATE&quot;);<br><br><br>// Here is an Example:<br>// The following is the sequence to be written along with it&#39;s associated tags:<br>
<br>//&nbsp; Structure Set ROI Sequence:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (3006|0020)<br>//&nbsp;&nbsp;&nbsp; &gt; ROI Number&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (3006|0022)<br>//&nbsp;&nbsp;&nbsp; &gt; Referenced Frame of ref. UID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (3006|0024)<br>//&nbsp;&nbsp;&nbsp; &gt; ROI Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (3006|0026)<br>
//&nbsp;&nbsp;&nbsp; &gt; ROI Generation Algorithm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (3006|0036)<br>//<br><br>&nbsp; <br><br>&nbsp; // Declaration of strings<br>&nbsp; string roiNumber = &quot;1&quot;;<br>&nbsp; string roiName = &quot;External Contour&quot;;<br>&nbsp; string frameOfReferenceUID = &quot;1.2.840.113619.2.55.3.464283444.427.1208496883.210.11425.1&quot;;<br>
&nbsp; string roiGenAlgorithm = &quot;ITK-GDCM based algorithm&quot;;<br>&nbsp;&nbsp; <br>&nbsp; // string for distinguishing items inside sequence:<br>&nbsp; string tempString = ITEM_ENCAPSULATE_STRING + &quot;01&quot;;<br><br>&nbsp; typedef itk::RTSTRUCTIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; STRUCTOutType;<br>
&nbsp; typedef itk::MetaDataDictionary&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DictionaryType;<br><br>&nbsp;&nbsp; // Final Dictionary that will be passed to RTSTRUCTIO<br>&nbsp; STRUCTOutType::Pointer gdcmIO2 = STRUCTOutType::New();<br>&nbsp; DictionaryType&amp; dictWriter = gdcmIO2-&gt;GetMetaDataDictionary();<br>
<br>&nbsp; // Dictionary for encapsulating the sequences.<br>&nbsp; STRUCTOutType::Pointer gdcmIOStructureSetRoi = STRUCTOutType::New();<br>&nbsp; DictionaryType &amp;structureSetRoiSeq = gdcmIOStructureSetRoi-&gt;GetMetaDataDictionary();<br>
<br>&nbsp; // Dictionary for encapsulating the items within sequences<br>&nbsp; STRUCTOutType::Pointer gdcmIOItem = STRUCTOutType::New();<br>&nbsp; DictionaryType &amp;itemDict = gdcmIOItem-&gt;GetMetaDataDictionary();<br><br>&nbsp; itk::EncapsulateMetaData&lt;string&gt;(itemDict, &quot;3006|0022&quot;, roiNumber);<br>
&nbsp; itk::EncapsulateMetaData&lt;string&gt;(itemDict, &quot;3006|0024&quot;, frameOfReferenceUID);<br>&nbsp; itk::EncapsulateMetaData&lt;string&gt;(itemDict, &quot;3006|0026&quot;, roiName);<br>&nbsp; itk::EncapsulateMetaData&lt;string&gt;(itemDict, &quot;3006|0036&quot;, roiGenAlgorithm);<br>
<br>&nbsp; itk::EncapsulateMetaData&lt;DictionaryType&gt;(structureSetRoiSeq, tempString, itemDict);<br><br><br>&nbsp; itk::EncapsulateMetaData&lt;DictionaryType&gt;(dictWriter, &quot;3006|0020&quot;, structureSetRoiSeq);<br><br><br>
// The above dictWriter is passed in the RTSTRUCTIO class.<br>// While parsing, if the type of object inside dictWriter is another dictionary,<br>// it is passed to the following function:<br>//<br><br>bool RTSTRUCTIO::InsertDICOMSequence(MetaDataDictionary &amp;sub_dict,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const unsigned int itemDepthLevel,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gdcm::SeqEntry&nbsp;&nbsp;&nbsp;&nbsp; *seqEntry)<br><br>{<br>&nbsp; gdcm::SQItem *sqItem = NULL;<br><br>&nbsp; itk::MetaDataDictionary::ConstIterator itr = sub_dict.Begin();<br>
&nbsp; itk::MetaDataDictionary::ConstIterator end = sub_dict.End();<br><br>&nbsp; while(itr != end)<br>&nbsp; {<br>&nbsp;&nbsp;&nbsp; // Get the key<br>&nbsp;&nbsp;&nbsp; const std::string &amp;inside_key = itr-&gt;first;<br><br>&nbsp;&nbsp;&nbsp; // To separate the items from each other, each item is<br>
&nbsp;&nbsp;&nbsp; // encapsulated inside a dictionary and to distinguish them against sub-sequences,<br>&nbsp;&nbsp;&nbsp; // special-predefined-strings are associated with those dictionaries.<br>&nbsp;&nbsp;&nbsp; // <br>&nbsp;&nbsp;&nbsp; // In such cases, inside sub-dictionary associated with those<br>
&nbsp;&nbsp;&nbsp; // special-predefined-strings is passed to this self-calling function.<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; if (ITEM_ENCAPSULATE_STRING == inside_key.substr(0, ITEM_ENCAPSULATE_STRING.length()))<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Get the dictionary associted with that string...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; itk::MetaDataDictionary actual_sub_dict;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ExposeMetaData&lt;itk::MetaDataDictionary&gt;(sub_dict, inside_key, actual_sub_dict);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Call this function on that sub-dictionary<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InsertDICOMSequence(actual_sub_dict, itemDepthLevel, seqEntry);<br>
&nbsp;&nbsp;&nbsp; } else<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( itr == sub_dict.Begin() )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sqItem = new gdcm::SQItem(itemDepthLevel);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; assert( sqItem != NULL );<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // if the value associated with this key is again a dictionary,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // recursively call this function to insert a sub-sequence:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if( typeid(sub_dict).name() == (sub_dict[inside_key].GetPointer())-&gt;GetMetaDataObjectTypeName() )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; itk::MetaDataDictionary inside_sub_dict;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ExposeMetaData&lt;itk::MetaDataDictionary&gt;(sub_dict, inside_key, inside_sub_dict);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // if the attached sub-dictinary is a sequence, then.......<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gdcm::SeqEntry *sub_seqEntry = new gdcm::SeqEntry(<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gdcm::Global::GetDicts()-&gt;GetDefaultPubDict()-&gt;GetEntry(inside_key));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InsertDICOMSequence(inside_sub_dict, itemDepthLevel+1, sub_seqEntry);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sqItem-&gt;AddEntry(sub_seqEntry);<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else // if the value associated with the key is a string, directly add it to the sequence<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::string inside_value;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ExposeMetaData&lt;std::string&gt;(sub_dict, inside_key, inside_value);<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gdcm::ValEntry *inside_valEntry = new gdcm::ValEntry(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gdcm::Global::GetDicts()-&gt;GetDefaultPubDict()-&gt;GetEntry(inside_key) );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inside_valEntry-&gt;SetValue(inside_value);<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sqItem-&gt;AddEntry(inside_valEntry);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; ++itr; <br>&nbsp; }<br>&nbsp; if (sqItem != NULL)<br>&nbsp; {<br>&nbsp;&nbsp;&nbsp; // 2nd argument: ordinal number of the seq-item<br>&nbsp;&nbsp;&nbsp; // seqEntry-&gt;AddSQItem(sqItem, seqEntry-&gt;GetNumberOfSQItems()+1);<br>
&nbsp;&nbsp;&nbsp; seqEntry-&gt;AddSQItem(sqItem, seqEntry-&gt;GetNumberOfSQItems());<br>&nbsp; }<br>&nbsp; return true;<br>}<br><br><br>Thank you.<br><br>Warm Regards,<br>Subrahmanyam Gorthi.<br><br><br><br><br><div class="gmail_quote">On Sat, Nov 22, 2008 at 3:11 PM, Dan Mueller <span dir="ltr">&lt;<a href="mailto:dan.muel@gmail.com">dan.muel@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Brano,<br>
<br>
I guess you&#39;ll need check with the author...I don&#39;t recall seeing the<br>
IJ article yet.<br>
<br>
Cheers, Dan<br>
<br>
2008/11/22 Branislav Goga &lt;<a href="mailto:brano.goga@centrum.sk">brano.goga@centrum.sk</a>&gt;:<br>
&gt;<br>
&gt; Thanks for that link, very interesting, but is there some link to<br>
&gt; implementation, I didn`t found any in IJ, do I miss something? Are there<br>
&gt; some plans to integrate it into future ITK builds? I think for a lot of<br>
&gt; people this could be very interesting and will simplify usage of ITK for<br>
&gt; several research tasks.<br>
&gt;<br>
&gt; regards<br>
&gt; Brano<br>
&gt;<br>
&gt;<br>
&gt; Dan Mueller-2 wrote:<br>
&gt;&gt;<br>
&gt;&gt; Hi Siqi,<br>
&gt;&gt;<br>
&gt;&gt; AFAIK, ITK does not provide support for reading/writing &quot;ROI Contour<br>
&gt;&gt; Sequences&quot;.<br>
&gt;&gt;<br>
&gt;&gt; By the way, do you actually mean RTSTRUCT sets? If so, then you may be<br>
&gt;&gt; interested in the following discussion thread regarding the addition<br>
&gt;&gt; of a writer for RTSTRUCT sets to ITK. Though I don&#39;t think the reader<br>
&gt;&gt; has been implemented yet...<br>
&gt;&gt;<br>
&gt;&gt; <a href="http://www.cmake.org/pipermail/insight-users/2008-September/027272.html" target="_blank">http://www.cmake.org/pipermail/insight-users/2008-September/027272.html</a><br>
&gt;&gt;<br>
&gt;&gt; Hope this helps.<br>
&gt;&gt;<br>
&gt;&gt; Regards, Dan<br>
&gt;&gt;<br>
&gt;&gt; 2008/11/21 chensiqi &lt;<a href="mailto:pidanchen@hotmail.com">pidanchen@hotmail.com</a>&gt;:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Hi, ITKers,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Does anybody know how to load sequence items using ITK? Such as &quot;ROI<br>
&gt;&gt;&gt; Contour<br>
&gt;&gt;&gt; Sequence&quot;.<br>
&gt;&gt;&gt; Or if you know how to do it in GDCM, and integrate into ITK, that will<br>
&gt;&gt;&gt; also<br>
&gt;&gt;&gt; be very helpful.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Thanks<br>
&gt;&gt;&gt; Siqi<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; ________________________________<br>
&gt;&gt;&gt; 更多热辣资讯尽在新版MSN首页! 立刻访问!<br>
&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt; Insight-users mailing list<br>
&gt;&gt;&gt; <a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br>
&gt;&gt;&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Insight-users mailing list<br>
&gt;&gt; <a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br>
&gt;&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt; --<br>
&gt; View this message in context: <a href="http://www.nabble.com/How-to-load-sequence-items-tp20622657p20635416.html" target="_blank">http://www.nabble.com/How-to-load-sequence-items-tp20622657p20635416.html</a><br>
&gt; Sent from the ITK - Users mailing list archive at Nabble.com.<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Insight-users mailing list<br>
&gt; <a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br>
&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;<br>
</blockquote></div><br>