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("DICOM_ITEM_ENCAPSULATE");<br><br><br>// Here is an Example:<br>// The following is the sequence to be written along with it's associated tags:<br>
<br>// Structure Set ROI Sequence: (3006|0020)<br>// > ROI Number (3006|0022)<br>// > Referenced Frame of ref. UID (3006|0024)<br>// > ROI Name (3006|0026)<br>
// > ROI Generation Algorithm (3006|0036)<br>//<br><br> <br><br> // Declaration of strings<br> string roiNumber = "1";<br> string roiName = "External Contour";<br> string frameOfReferenceUID = "1.2.840.113619.2.55.3.464283444.427.1208496883.210.11425.1";<br>
string roiGenAlgorithm = "ITK-GDCM based algorithm";<br> <br> // string for distinguishing items inside sequence:<br> string tempString = ITEM_ENCAPSULATE_STRING + "01";<br><br> typedef itk::RTSTRUCTIO STRUCTOutType;<br>
typedef itk::MetaDataDictionary DictionaryType;<br><br> // Final Dictionary that will be passed to RTSTRUCTIO<br> STRUCTOutType::Pointer gdcmIO2 = STRUCTOutType::New();<br> DictionaryType& dictWriter = gdcmIO2->GetMetaDataDictionary();<br>
<br> // Dictionary for encapsulating the sequences.<br> STRUCTOutType::Pointer gdcmIOStructureSetRoi = STRUCTOutType::New();<br> DictionaryType &structureSetRoiSeq = gdcmIOStructureSetRoi->GetMetaDataDictionary();<br>
<br> // Dictionary for encapsulating the items within sequences<br> STRUCTOutType::Pointer gdcmIOItem = STRUCTOutType::New();<br> DictionaryType &itemDict = gdcmIOItem->GetMetaDataDictionary();<br><br> itk::EncapsulateMetaData<string>(itemDict, "3006|0022", roiNumber);<br>
itk::EncapsulateMetaData<string>(itemDict, "3006|0024", frameOfReferenceUID);<br> itk::EncapsulateMetaData<string>(itemDict, "3006|0026", roiName);<br> itk::EncapsulateMetaData<string>(itemDict, "3006|0036", roiGenAlgorithm);<br>
<br> itk::EncapsulateMetaData<DictionaryType>(structureSetRoiSeq, tempString, itemDict);<br><br><br> itk::EncapsulateMetaData<DictionaryType>(dictWriter, "3006|0020", 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 &sub_dict,<br>
const unsigned int itemDepthLevel,<br> gdcm::SeqEntry *seqEntry)<br><br>{<br> gdcm::SQItem *sqItem = NULL;<br><br> itk::MetaDataDictionary::ConstIterator itr = sub_dict.Begin();<br>
itk::MetaDataDictionary::ConstIterator end = sub_dict.End();<br><br> while(itr != end)<br> {<br> // Get the key<br> const std::string &inside_key = itr->first;<br><br> // To separate the items from each other, each item is<br>
// encapsulated inside a dictionary and to distinguish them against sub-sequences,<br> // special-predefined-strings are associated with those dictionaries.<br> // <br> // In such cases, inside sub-dictionary associated with those<br>
// special-predefined-strings is passed to this self-calling function.<br> <br> if (ITEM_ENCAPSULATE_STRING == inside_key.substr(0, ITEM_ENCAPSULATE_STRING.length()))<br> {<br> // Get the dictionary associted with that string...<br>
itk::MetaDataDictionary actual_sub_dict;<br> ExposeMetaData<itk::MetaDataDictionary>(sub_dict, inside_key, actual_sub_dict);<br><br> // Call this function on that sub-dictionary<br> InsertDICOMSequence(actual_sub_dict, itemDepthLevel, seqEntry);<br>
} else<br> {<br> if ( itr == sub_dict.Begin() )<br> {<br> sqItem = new gdcm::SQItem(itemDepthLevel);<br> }<br><br> assert( sqItem != NULL );<br><br> // if the value associated with this key is again a dictionary,<br>
// recursively call this function to insert a sub-sequence:<br> if( typeid(sub_dict).name() == (sub_dict[inside_key].GetPointer())->GetMetaDataObjectTypeName() )<br> {<br> itk::MetaDataDictionary inside_sub_dict;<br>
ExposeMetaData<itk::MetaDataDictionary>(sub_dict, inside_key, inside_sub_dict);<br><br> // if the attached sub-dictinary is a sequence, then.......<br> gdcm::SeqEntry *sub_seqEntry = new gdcm::SeqEntry(<br>
gdcm::Global::GetDicts()->GetDefaultPubDict()->GetEntry(inside_key));<br> InsertDICOMSequence(inside_sub_dict, itemDepthLevel+1, sub_seqEntry);<br><br> sqItem->AddEntry(sub_seqEntry);<br>
<br> } else // if the value associated with the key is a string, directly add it to the sequence<br> {<br> std::string inside_value;<br> ExposeMetaData<std::string>(sub_dict, inside_key, inside_value);<br>
<br> gdcm::ValEntry *inside_valEntry = new gdcm::ValEntry(<br> gdcm::Global::GetDicts()->GetDefaultPubDict()->GetEntry(inside_key) );<br> inside_valEntry->SetValue(inside_value);<br>
<br> sqItem->AddEntry(inside_valEntry);<br> }<br> }<br> ++itr; <br> }<br> if (sqItem != NULL)<br> {<br> // 2nd argument: ordinal number of the seq-item<br> // seqEntry->AddSQItem(sqItem, seqEntry->GetNumberOfSQItems()+1);<br>
seqEntry->AddSQItem(sqItem, seqEntry->GetNumberOfSQItems());<br> }<br> 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"><<a href="mailto:dan.muel@gmail.com">dan.muel@gmail.com</a>></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'll need check with the author...I don't recall seeing the<br>
IJ article yet.<br>
<br>
Cheers, Dan<br>
<br>
2008/11/22 Branislav Goga <<a href="mailto:brano.goga@centrum.sk">brano.goga@centrum.sk</a>>:<br>
><br>
> Thanks for that link, very interesting, but is there some link to<br>
> implementation, I didn`t found any in IJ, do I miss something? Are there<br>
> some plans to integrate it into future ITK builds? I think for a lot of<br>
> people this could be very interesting and will simplify usage of ITK for<br>
> several research tasks.<br>
><br>
> regards<br>
> Brano<br>
><br>
><br>
> Dan Mueller-2 wrote:<br>
>><br>
>> Hi Siqi,<br>
>><br>
>> AFAIK, ITK does not provide support for reading/writing "ROI Contour<br>
>> Sequences".<br>
>><br>
>> By the way, do you actually mean RTSTRUCT sets? If so, then you may be<br>
>> interested in the following discussion thread regarding the addition<br>
>> of a writer for RTSTRUCT sets to ITK. Though I don't think the reader<br>
>> has been implemented yet...<br>
>><br>
>> <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>
>><br>
>> Hope this helps.<br>
>><br>
>> Regards, Dan<br>
>><br>
>> 2008/11/21 chensiqi <<a href="mailto:pidanchen@hotmail.com">pidanchen@hotmail.com</a>>:<br>
>>><br>
>>> Hi, ITKers,<br>
>>><br>
>>> Does anybody know how to load sequence items using ITK? Such as "ROI<br>
>>> Contour<br>
>>> Sequence".<br>
>>> Or if you know how to do it in GDCM, and integrate into ITK, that will<br>
>>> also<br>
>>> be very helpful.<br>
>>><br>
>>> Thanks<br>
>>> Siqi<br>
>>><br>
>>><br>
>>> ________________________________<br>
>>> 更多热辣资讯尽在新版MSN首页! 立刻访问!<br>
>>> _______________________________________________<br>
>>> Insight-users mailing list<br>
>>> <a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br>
>>> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
>>><br>
>>><br>
>> _______________________________________________<br>
>> Insight-users mailing list<br>
>> <a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br>
>> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
>><br>
>><br>
><br>
> --<br>
> 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>
> Sent from the ITK - Users mailing list archive at Nabble.com.<br>
><br>
> _______________________________________________<br>
> Insight-users mailing list<br>
> <a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br>
> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><br>
</blockquote></div><br>