public AttributeProperty( string displayTag, string name, string vr, string vm, string val, HLI.Attribute refAttributeObj) { this.properties[attributeTag] = displayTag; this.properties[attributeName] = name; this.properties[attributeVR] = vr; this.properties[attributeVM] = vm; this.properties[attributeValue] = val; this.hliAttributeObj = refAttributeObj; }
/// <summary> /// Recursive function for handling Seq attributes /// </summary> /// <param name="attribute"></param> void GetSeqAttributesValues(HLI.Attribute attribute) { int itemCount = attribute.ItemCount; int sqVm = 1; string displayTagString = ""; for(int i=0; i < levelOfSeq; i++) displayTagString += ">"; displayTagString += TagString(attribute.GroupNumber,attribute.ElementNumber); // Attribute name string attributeName = attribute.Name; if(attributeName == "") attributeName = "Undefined"; // Add the sequence attribute to the DataGrid AttributeProperty theSeqAttributeInfo = new AttributeProperty(displayTagString, attributeName, "SQ", sqVm.ToString(), "", attribute); _AttributesInfoForDataGrid.Add(theSeqAttributeInfo); for( int i=0; i < itemCount; i++ ) { string itemString = ""; for(int j=0; j < levelOfSeq; j++) itemString += ">"; itemString += string.Format(">BEGIN ITEM {0}", i+1); AttributeProperty theDataGridItemInfo = new AttributeProperty(itemString, "", "", "", "", attribute); _AttributesInfoForDataGrid.Add(theDataGridItemInfo); HLI.SequenceItem item = attribute.GetItem(i+1); for( int k=0; k < item.Count; k++ ) { HLI.Attribute seqAttribute = item[k]; string attributesValues = ""; string seqTagString = ""; string seqAttributeName = seqAttribute.Name; if(seqAttributeName == "") seqAttributeName = "Undefined"; if (seqAttribute.VR != VR.SQ) { for(int m=0; m <= levelOfSeq; m++) seqTagString += ">"; seqTagString += TagString(seqAttribute.GroupNumber,seqAttribute.ElementNumber); if (seqAttribute.Values.Count != 0) { for( int l=0; l < seqAttribute.Values.Count; l++ ) { attributesValues += seqAttribute.Values[l] + "\\"; } if (attributesValues.Trim().EndsWith("\\")) { // now search for the last "\"... int lastLocation = attributesValues.LastIndexOf( "\\" ); // remove the identified section, if it is a valid region if ( lastLocation >= 0 ) attributesValues = attributesValues.Substring( 0, lastLocation ); } } else { attributesValues = ""; } } else { sequenceInSq = true; levelOfSeq++; GetSeqAttributesValues(seqAttribute); sequenceInSq = false; --levelOfSeq; continue; } AttributeProperty theDataGridSeqAttributeInfo = new AttributeProperty(seqTagString, seqAttributeName, seqAttribute.VR.ToString(), seqAttribute.VM.ToString(), attributesValues, seqAttribute); _AttributesInfoForDataGrid.Add(theDataGridSeqAttributeInfo); } itemString = ""; for(int m=0; m < levelOfSeq; m++) itemString += ">"; itemString += string.Format(">END ITEM {0}", i+1); AttributeProperty theDataGridEndItemInfo = new AttributeProperty(itemString, "", "", "", "", null); _AttributesInfoForDataGrid.Add(theDataGridEndItemInfo); } }