示例#1
0
        private static void AddReferencedSopSequence(ReferencedSopItemCollection storageCommitItems,
			uint tag,
			DvtkData.Dimse.AttributeSet attributeSet,
			InstanceStateEnum newInstanceState)
        {
            ushort group = (ushort)(tag >> 16);
            ushort element = (ushort)(tag & 0x0000FFFF);
            DvtkData.Dimse.Tag tagValue = new DvtkData.Dimse.Tag(group, element);

            DvtkData.Dimse.Attribute referencedSopSequence = attributeSet.GetAttribute(tagValue);
            if (referencedSopSequence != null)
            {
                attributeSet.Remove(referencedSopSequence);
            }

            referencedSopSequence = new DvtkData.Dimse.Attribute(tag, DvtkData.Dimse.VR.SQ);
            SequenceOfItems referencedSopSequenceOfItems = new SequenceOfItems();
            referencedSopSequence.DicomValue = referencedSopSequenceOfItems;

            foreach(ReferencedSopItem  referencedSopItem in storageCommitItems)
            {
                if (((referencedSopItem.InstanceState == InstanceStateEnum.InstanceStored) &&
                    (newInstanceState == InstanceStateEnum.InstanceMppsCompleted)) ||
                    ((referencedSopItem.InstanceState == InstanceStateEnum.InstanceMppsCompleted) &&
                    (newInstanceState == InstanceStateEnum.InstanceStorageCommitRequested)))
                {

                    DvtkData.Dimse.SequenceItem referencedSopSequenceItem = new DvtkData.Dimse.SequenceItem();
                    referencedSopSequenceItem.AddAttribute(DvtkData.Dimse.Tag.REFERENCED_SOP_CLASS_UID.GroupNumber,
                        DvtkData.Dimse.Tag.REFERENCED_SOP_CLASS_UID.ElementNumber,
                        DvtkData.Dimse.VR.UI, referencedSopItem.SopClassUid);
                    referencedSopSequenceItem.AddAttribute(DvtkData.Dimse.Tag.REFERENCED_SOP_INSTANCE_UID.GroupNumber,
                        DvtkData.Dimse.Tag.REFERENCED_SOP_INSTANCE_UID.ElementNumber,
                        DvtkData.Dimse.VR.UI, referencedSopItem.SopInstanceUid);
                    referencedSopItem.InstanceState = newInstanceState;
                    referencedSopSequenceOfItems.Sequence.Add(referencedSopSequenceItem);
                }
            }
            attributeSet.Add(referencedSopSequence);
        }
示例#2
0
        private void _InitializeAttribute(
            GROUP_NUMBER groupNumber,
            ELEMENT_NUMBER elementNumber,
            VR vr,
            params object[] list)
        {
            this.Tag.GroupNumber = groupNumber;
            this.Tag.ElementNumber = elementNumber;
            DicomValueType dicomValue = null;
            if(list!= null)
            {
                switch (vr)
                {
                    case VR.AE:
                    {
                        System.String[] stringArray = _CastToStringArray(list);
                        ApplicationEntity applicationEntity = new ApplicationEntity();
                        applicationEntity.Values =
                            new DvtkData.Collections.StringCollection(stringArray);
                        dicomValue = applicationEntity;

                        // compute attribute value length
                        Length = 0;
                        if (applicationEntity.Values.Count > 0)
                        {
                            System.UInt32 length = 0;
                            foreach(String data in applicationEntity.Values)
                            {
                                length += (System.UInt32)data.Length;
                            }
                            Length = length + (System.UInt32)applicationEntity.Values.Count - 1;
                        }
                        break;
                    }
                    case VR.AS:
                    {
                        System.String[] stringArray = _CastToStringArray(list);
                        AgeString ageString = new AgeString();
                        ageString.Values =
                            new DvtkData.Collections.StringCollection(stringArray);
                        dicomValue = ageString;

                        // compute attribute value length
                        Length = (System.UInt32)ageString.Values.Count * 4;
                        break;
                    }
                    case VR.AT:
                    {
                        Tag[] tagArray = _CastToTagArray(list);
                        AttributeTag attributeTag = new AttributeTag();
                        attributeTag.Values =
                            new DvtkData.Collections.TagCollection(tagArray);
                        dicomValue = attributeTag;

                        // compute attribute value length
                        Length = (System.UInt32)attributeTag.Values.Count * 4;
                        break;
                    }
                    case VR.CS:
                    {
                        System.String[] stringArray = _CastToStringArray(list);
                        CodeString codeString = new CodeString();
                        codeString.Values =
                            new DvtkData.Collections.StringCollection(stringArray);
                        dicomValue = codeString;

                        // compute attribute value length
                        Length = 0;
                        if (codeString.Values.Count > 0)
                        {
                            System.UInt32 length = 0;
                            foreach(String data in codeString.Values)
                            {
                                length += (System.UInt32)data.Length;
                            }
                            Length = length + (System.UInt32)codeString.Values.Count - 1;
                        }
                        break;
                    }
                    case VR.DA:
                    {
                        System.String[] stringArray = _CastToDateStringArray(list);
                        Date date = new Date();
                        date.Values =
                            new DvtkData.Collections.StringCollection(stringArray);
                        dicomValue = date;

                        // compute attribute value length
                        Length = 0;
                        if (date.Values.Count > 0)
                        {
                            System.UInt32 length = 0;
                            foreach(String data in date.Values)
                            {
                                length += (System.UInt32)data.Length;
                            }
                            Length = length;
                        }
                        break;
                    }
                    case VR.DS:
                    {
                        System.String[] stringArray = _CastToStringArray(list);
                        DecimalString decimalString = new DecimalString();
                        decimalString.Values =
                            new DvtkData.Collections.StringCollection(stringArray);
                        dicomValue = decimalString;

                        // compute attribute value length
                        Length = 0;
                        if (decimalString.Values.Count > 0)
                        {
                            System.UInt32 length = 0;
                            foreach(String data in decimalString.Values)
                            {
                                length += (System.UInt32)data.Length;
                            }
                            Length = length + (System.UInt32)decimalString.Values.Count - 1;
                        }
                        break;
                    }
                    case VR.DT:
                    {
                        System.String[] stringArray = _CastToDateTimeStringArray(list);
                        DateTime dateTime = new DateTime();
                        dateTime.Values =
                            new DvtkData.Collections.StringCollection(stringArray);
                        dicomValue = dateTime;

                        // compute attribute value length
                        Length = 0;
                        if (dateTime.Values.Count > 0)
                        {
                            System.UInt32 length = 0;
                            foreach(String data in dateTime.Values)
                            {
                                length += (System.UInt32)data.Length;
                            }
                            Length = length + (System.UInt32)dateTime.Values.Count - 1;
                        }
                        break;
                    }
                    case VR.FD:
                    {
                        System.Double[] floatingPointDoubleArray = _CastToFloatingPointDoubleArray(list);
                        FloatingPointDouble floatingPointDouble = new FloatingPointDouble();
                        floatingPointDouble.Values =
                            new DvtkData.Collections.DoubleCollection(floatingPointDoubleArray);
                        dicomValue = floatingPointDouble;

                        // compute attribute value length
                        Length = (System.UInt32)floatingPointDouble.Values.Count * 8;
                        break;
                    }
                    case VR.FL:
                    {
                        System.Single[] floatingPointSingleArray = _CastToFloatingPointSingleArray(list);
                        FloatingPointSingle floatingPointSingle = new FloatingPointSingle();
                        floatingPointSingle.Values =
                            new DvtkData.Collections.SingleCollection(floatingPointSingleArray);
                        dicomValue = floatingPointSingle;

                        // compute attribute value length
                        Length = (System.UInt32)floatingPointSingle.Values.Count * 4;
                        break;
                    }
                    case VR.IS:
                    {
                        System.String[] stringArray = _CastToStringArray(list);
                        IntegerString integerString = new IntegerString();
                        integerString.Values =
                            new DvtkData.Collections.StringCollection(stringArray);
                        dicomValue = integerString;

                        // compute attribute value length
                        Length = 0;
                        if (integerString.Values.Count > 0)
                        {
                            System.UInt32 length = 0;
                            foreach(String data in integerString.Values)
                            {
                                length += (System.UInt32)data.Length;
                            }
                            Length = length + (System.UInt32)integerString.Values.Count - 1;
                        }
                        break;
                    }
                    case VR.LO:
                    {
                        System.String[] stringArray = _CastToStringArray(list);
                        LongString longString = new LongString();
                        longString.Values =
                            new DvtkData.Collections.StringCollection(stringArray);
                        dicomValue = longString;

                        // compute attribute value length
                        Length = 0;
                        if (longString.Values.Count > 0)
                        {
                            System.UInt32 length = 0;
                            foreach(String data in longString.Values)
                            {
                                length += (System.UInt32)data.Length;
                            }
                            Length = length + (System.UInt32)longString.Values.Count - 1;
                        }
                        break;
                    }
                    case VR.LT:
                    {
                        if (list.Length > 1) throw new System.ArgumentException();
                        LongText longText = new LongText();
                        Length = 0;
                        if (list.Length == 1)
                        {
                            System.String stringValue = System.Convert.ToString(list[0]);
                            longText.Value = stringValue;
                            Length = (System.UInt32)stringValue.Length;
                        }
                        dicomValue = longText;
                        break;
                    }
                    case VR.OB:
                    {
                        OtherByteString otherByteString = new OtherByteString();
                        if (list.Length > 0)
                        {
                            if (list.Length == 1 && list[0] is System.String)
                            {
                                otherByteString.FileName = (System.String)list[0];
                                Length = (System.UInt32)otherByteString.FileName.Length;
                            }
                            else if (list.Length == 1 && list[0] is BitmapPatternParameters)
                            {
                                otherByteString.BitmapPattern = (BitmapPatternParameters)list[0];
                            }
                            else if (list.Length > 0 && list.Length <= 7)
                            {
                                BitmapPatternParameters pattern = new BitmapPatternParameters();
                                try
                                {
                                    int listLength = list.Length;
                                    if (listLength > 0)
                                    {
                                        pattern.NumberOfRows = System.Convert.ToUInt16(list[0]);
                                        if (listLength == 1) pattern.NumberOfColumns = pattern.NumberOfRows;
                                    }
                                    if (listLength > 1) pattern.NumberOfColumns = System.Convert.ToUInt16(list[1]);
                                    if (listLength > 2) pattern.StartValue = System.Convert.ToInt16(list[2]);
                                    if (listLength > 3) pattern.ValueIncrementPerRowBlock = System.Convert.ToInt16(list[3]);
                                    if (listLength > 4) pattern.ValueIncrementPerColumnBlock = System.Convert.ToInt16(list[4]);
                                    if (listLength > 5) pattern.NumberOfIdenticalValueRows = System.Convert.ToUInt16(list[5]);
                                    if (listLength > 6) pattern.NumberOfIdenticalValueColumns = System.Convert.ToUInt16(list[6]);
                                }
                                catch
                                {
                                    throw new System.ArgumentException();
                                }
                                otherByteString.BitmapPattern = pattern;
                            }
                            else throw new System.ArgumentException();
                        }
                        dicomValue = otherByteString;
                        break;
                    }
                    case VR.OF:
                    {
                        OtherFloatString otherFloatString = new OtherFloatString();
                        if (list.Length > 0)
                        {
                            if (list.Length == 1 && list[0] is System.String)
                            {
                                otherFloatString.FileName = (System.String)list[0];
                                Length = (System.UInt32)otherFloatString.FileName.Length;
                            }
                            else if (list.Length == 1 && list[0] is BitmapPatternParameters)
                            {
                                otherFloatString.BitmapPattern = (BitmapPatternParameters)list[0];
                            }
                            else if (list.Length > 0 && list.Length <= 7)
                            {
                                BitmapPatternParameters pattern = new BitmapPatternParameters();
                                try
                                {
                                    int listLength = list.Length;
                                    if (listLength > 0)
                                    {
                                        pattern.NumberOfRows = System.Convert.ToUInt16(list[0]);
                                        if (listLength == 1) pattern.NumberOfColumns = pattern.NumberOfRows;
                                    }
                                    if (listLength > 1) pattern.NumberOfColumns = System.Convert.ToUInt16(list[1]);
                                    if (listLength > 2) pattern.StartValue = System.Convert.ToInt16(list[2]);
                                    if (listLength > 3) pattern.ValueIncrementPerRowBlock = System.Convert.ToInt16(list[3]);
                                    if (listLength > 4) pattern.ValueIncrementPerColumnBlock = System.Convert.ToInt16(list[4]);
                                    if (listLength > 5) pattern.NumberOfIdenticalValueRows = System.Convert.ToUInt16(list[5]);
                                    if (listLength > 6) pattern.NumberOfIdenticalValueColumns = System.Convert.ToUInt16(list[6]);
                                }
                                catch
                                {
                                    throw new System.ArgumentException();
                                }
                                otherFloatString.BitmapPattern = pattern;
                            }
                            else throw new System.ArgumentException();
                        }
                        dicomValue = otherFloatString;
                        break;
                    }
                    case VR.OW:
                    {
                        OtherWordString otherWordString = new OtherWordString();
                        if (list.Length > 0)
                        {
                            if (list.Length == 1 && list[0] is System.String)
                            {
                                otherWordString.FileName = (System.String)list[0];
                                Length = (System.UInt32)otherWordString.FileName.Length;
                            }
                            else if (list.Length == 1 && list[0] is BitmapPatternParameters)
                            {
                                otherWordString.BitmapPattern = (BitmapPatternParameters)list[0];
                            }
                            else if (list.Length > 0 && list.Length <= 7)
                            {
                                BitmapPatternParameters pattern = new BitmapPatternParameters();
                                try
                                {
                                    int listLength = list.Length;
                                    if (listLength > 0)
                                    {
                                        pattern.NumberOfRows = System.Convert.ToUInt16(list[0]);
                                        if (listLength == 1) pattern.NumberOfColumns = pattern.NumberOfRows;
                                    }
                                    if (listLength > 1) pattern.NumberOfColumns = System.Convert.ToUInt16(list[1]);
                                    if (listLength > 2) pattern.StartValue = System.Convert.ToInt16(list[2]);
                                    if (listLength > 3) pattern.ValueIncrementPerRowBlock = System.Convert.ToInt16(list[3]);
                                    if (listLength > 4) pattern.ValueIncrementPerColumnBlock = System.Convert.ToInt16(list[4]);
                                    if (listLength > 5) pattern.NumberOfIdenticalValueRows = System.Convert.ToUInt16(list[5]);
                                    if (listLength > 6) pattern.NumberOfIdenticalValueColumns = System.Convert.ToUInt16(list[6]);
                                }
                                catch
                                {
                                    throw new System.ArgumentException();
                                }
                                otherWordString.BitmapPattern = pattern;
                            }
                            else throw new System.ArgumentException();
                        }
                        dicomValue = otherWordString;
                        break;
                    }
                    case VR.PN:
                    {
                        System.String[] stringArray = _CastToStringArray(list);
                        PersonName personName = new PersonName();
                        personName.Values =
                            new DvtkData.Collections.StringCollection(stringArray);
                        dicomValue = personName;

                        // compute attribute value length
                        Length = 0;
                        if (personName.Values.Count > 0)
                        {
                            System.UInt32 length = 0;
                            foreach(String data in personName.Values)
                            {
                                length += (System.UInt32)data.Length;
                            }
                            Length = length + (System.UInt32)personName.Values.Count - 1;
                        }
                        break;
                    }
                    case VR.SH:
                    {
                        System.String[] stringArray = _CastToStringArray(list);
                        ShortString shortString = new ShortString();
                        shortString.Values =
                            new DvtkData.Collections.StringCollection(stringArray);
                        dicomValue = shortString;

                        // compute attribute value length
                        Length = 0;
                        if (shortString.Values.Count > 0)
                        {
                            System.UInt32 length = 0;
                            foreach(String data in shortString.Values)
                            {
                                length += (System.UInt32)data.Length;
                            }
                            Length = length + (System.UInt32)shortString.Values.Count - 1;
                        }
                        break;
                    }
                    case VR.SL:
                    {
                        System.Int32[] signedLongArray = _CastToSignedLongArray(list);
                        SignedLong signedLong = new SignedLong();
                        signedLong.Values =
                            new DvtkData.Collections.Int32Collection(signedLongArray);
                        dicomValue = signedLong;

                        // compute attribute value length
                        Length = (System.UInt32)signedLong.Values.Count * 4;
                        break;
                    }
                    case VR.SQ:
                    {
                        SequenceItem[] sequenceItemArray = _CastToSequenceItemArray(list);
                        SequenceOfItems sequenceOfItems = new SequenceOfItems();
                        sequenceOfItems.Sequence = new Sequence();
                        foreach (SequenceItem item in sequenceItemArray)
                        {
                            sequenceOfItems.Sequence.Add(item);
                        }
                        dicomValue = sequenceOfItems;

                        // set length to Undefined
                        Length = 0xFFFFFFFF;
                        break;
                    }
                    case VR.SS:
                    {
                        System.Int16[] signedShortArray = _CastToSignedShortArray(list);
                        SignedShort signedShort = new SignedShort();
                        signedShort.Values =
                            new DvtkData.Collections.Int16Collection(signedShortArray);
                        dicomValue = signedShort;

                        // compute attribute value length
                        Length = (System.UInt32)signedShort.Values.Count * 2;
                        break;
                    }
                    case VR.ST:
                    {
                        if (list.Length > 1) throw new System.ArgumentException();
                        ShortText shortText = new ShortText();
                        Length = 0;
                        if (list.Length == 1)
                        {
                            System.String stringValue = System.Convert.ToString(list[0]);
                            shortText.Value = stringValue;
                            Length = (System.UInt32)shortText.Value.Length;
                        }
                        dicomValue = shortText;
                        break;
                    }
                    case VR.TM:
                    {
                        System.String[] stringArray = _CastToTimeStringArray(list);
                        Time time = new Time();
                        time.Values =
                            new DvtkData.Collections.StringCollection(stringArray);
                        dicomValue = time;

                        // compute attribute value length
                        Length = 0;
                        if (time.Values.Count > 0)
                        {
                            System.UInt32 length = 0;
                            foreach(String data in time.Values)
                            {
                                length += (System.UInt32)data.Length;
                            }
                            Length = length + (System.UInt32)time.Values.Count - 1;
                        }
                        break;
                    }
                    case VR.UI:
                    {
                        System.String[] stringArray = _CastUniqueIdentifierStringArray(list);
                        UniqueIdentifier uniqueIdentifier = new UniqueIdentifier();
                        uniqueIdentifier.Values =
                            new DvtkData.Collections.StringCollection(stringArray);
                        dicomValue = uniqueIdentifier;

                        // compute attribute value length
                        Length = 0;
                        if (uniqueIdentifier.Values.Count > 0)
                        {
                            System.UInt32 length = 0;
                            foreach(String data in uniqueIdentifier.Values)
                            {
                                length += (System.UInt32)data.Length;
                            }
                            Length = length + (System.UInt32)uniqueIdentifier.Values.Count - 1;
                        }
                        break;
                    }
                    case VR.UL:
                    {
                        System.UInt32[] unsignedLongArray = _CastToUnsignedLongArray(list);
                        UnsignedLong unsignedLong = new UnsignedLong();
                        unsignedLong.Values =
                            new DvtkData.Collections.UInt32Collection(unsignedLongArray);
                        dicomValue = unsignedLong;

                        // compute attribute value length
                        Length = (System.UInt32)unsignedLong.Values.Count * 4;
                        break;
                    }
                    case VR.UN:
                    {
                        Unknown unknown = new Unknown();
                        Length = 0;
                        if (list.Length == 0 ||
                            list[0] is System.Byte)
                        {
                            System.Byte[] byteArray = _CastToByteArray(list);
                            unknown.ByteArray = byteArray;
                            Length = (System.UInt32)unknown.ByteArray.Length;
                        }
                        else throw new System.ArgumentException();
                        dicomValue = unknown;
                        break;
                    }
                    case VR.US:
                    {
                        System.UInt16[] unsignedShortArray = _CastToUnsignedShortArray(list);
                        UnsignedShort unsignedShort = new UnsignedShort();
                        unsignedShort.Values =
                            new DvtkData.Collections.UInt16Collection(unsignedShortArray);
                        dicomValue = unsignedShort;

                        // compute attribute value length
                        Length = (System.UInt32)unsignedShort.Values.Count * 2;
                        break;
                    }
                    case VR.UT:
                    {
                        if (list.Length > 1) throw new System.ArgumentException();
                        UnlimitedText unlimitedText = new UnlimitedText();
                        Length = 0;
                        if (list.Length == 1)
                        {
                            System.String stringValue = System.Convert.ToString(list[0]);
                            unlimitedText.Value = stringValue;
                            Length = (System.UInt32)unlimitedText.Value.Length;
                        }
                        dicomValue = unlimitedText;
                        break;
                    }
                    default:
                        dicomValue = null;
                        break;
                }
            }
            else
            {
                dicomValue = null;
            }
            this._ValueField = dicomValue;
        }
示例#3
0
        /// <summary>
        /// Cretae a storage commitment event.
        /// </summary>
        /// <param name="informationModels">The information models.</param>
        /// <param name="actionMessage">The action message.</param>
        /// <returns>The created event.</returns>
        public static DvtkHighLevelInterface.Dicom.Messages.DicomMessage MakeStorageCommitEvent(QueryRetrieveInformationModels informationModels, DvtkHighLevelInterface.Dicom.Messages.DicomMessage actionMessage)
        {
            // refresh the information models
            informationModels.Refresh();

            DvtkHighLevelInterface.Dicom.Messages.DicomMessage eventMessage = new DvtkHighLevelInterface.Dicom.Messages.DicomMessage(DvtkData.Dimse.DimseCommand.NEVENTREPORTRQ);
            eventMessage.Set("0x00000002", VR.UI, "1.2.840.10008.1.20.1");
            eventMessage.Set("0x00001000", VR.UI, "1.2.840.10008.1.20.1.1");

            DvtkData.Dimse.DataSet actionDataset = actionMessage.DataSet.DvtkDataDataSet;

            DvtkData.Dimse.DataSet eventDataset = new DvtkData.Dimse.DataSet();

            DvtkData.Dimse.Attribute eventReferenceSopSequence = new DvtkData.Dimse.Attribute(0x00081199, DvtkData.Dimse.VR.SQ);
            SequenceOfItems eventReferenceSopSequenceOfItems = new SequenceOfItems();
            eventReferenceSopSequence.DicomValue = eventReferenceSopSequenceOfItems;

            DvtkData.Dimse.Attribute eventFailedSopSequence = new DvtkData.Dimse.Attribute(0x00081198, DvtkData.Dimse.VR.SQ);
            SequenceOfItems eventFailedSopSequenceOfItems = new SequenceOfItems();
            eventFailedSopSequence.DicomValue = eventFailedSopSequenceOfItems;

            if (actionDataset != null)
            {
                DvtkData.Dimse.Attribute transactionUid = actionDataset.GetAttribute(DvtkData.Dimse.Tag.TRANSACTION_UID);
                if (transactionUid != null)
                {
                    eventDataset.Add(transactionUid);
                }

                DvtkData.Dimse.Attribute referencedSopSequence = actionDataset.GetAttribute(DvtkData.Dimse.Tag.REFERENCED_SOP_SEQUENCE);
                if (referencedSopSequence != null)
                {
                    SequenceOfItems sequenceOfItems = (SequenceOfItems)referencedSopSequence.DicomValue;
                    foreach(DvtkData.Dimse.SequenceItem item in sequenceOfItems.Sequence)
                    {
                        System.String sopClassUid = "";
                        System.String sopInstanceUid = "";

                        DvtkData.Dimse.Attribute attribute = item.GetAttribute(DvtkData.Dimse.Tag.REFERENCED_SOP_CLASS_UID);
                        if (attribute != null)
                        {
                            UniqueIdentifier uniqueIdentifier = (UniqueIdentifier)attribute.DicomValue;
                            if (uniqueIdentifier.Values.Count > 0)
                            {
                                sopClassUid = uniqueIdentifier.Values[0];
                            }
                        }

                        attribute = item.GetAttribute(DvtkData.Dimse.Tag.REFERENCED_SOP_INSTANCE_UID);
                        if (attribute != null)
                        {
                            UniqueIdentifier uniqueIdentifier = (UniqueIdentifier)attribute.DicomValue;
                            if (uniqueIdentifier.Values.Count > 0)
                            {
                                sopInstanceUid = uniqueIdentifier.Values[0];
                            }
                        }

                        if (informationModels.PatientRoot.IsInstanceInInformationModel(sopClassUid, sopInstanceUid))
                        {
                            DvtkData.Dimse.SequenceItem itemOk = new DvtkData.Dimse.SequenceItem();
                            itemOk.AddAttribute(0x00081150, DvtkData.Dimse.VR.UI, sopClassUid);
                            itemOk.AddAttribute(0x00081155, DvtkData.Dimse.VR.UI, sopInstanceUid);

                            // add instance to committed list
                            eventReferenceSopSequenceOfItems.Sequence.Add(itemOk);
                        }
                        else
                        {
                            DvtkData.Dimse.SequenceItem itemNotOk = new DvtkData.Dimse.SequenceItem();
                            itemNotOk.AddAttribute(0x00081150, DvtkData.Dimse.VR.UI, sopClassUid);
                            itemNotOk.AddAttribute(0x00081155, DvtkData.Dimse.VR.UI, sopInstanceUid);
                            itemNotOk.AddAttribute(0x00081197, DvtkData.Dimse.VR.US, 0x0110);

                            // add instance to failed list
                            eventFailedSopSequenceOfItems.Sequence.Add(itemNotOk);
                        }
                    }
                }

                if (eventReferenceSopSequenceOfItems.Sequence.Count > 0)
                {
                    eventMessage.Set("0x00001002", VR.US, 1);
                    eventDataset.Add(eventReferenceSopSequence);
                }

                if (eventFailedSopSequenceOfItems.Sequence.Count > 0)
                {
                    eventMessage.Set("0x00001002", VR.US, 2);
                    eventDataset.Add(eventFailedSopSequence);
                }
            }

            eventMessage.DataSet.DvtkDataDataSet = eventDataset;

            return eventMessage;
        }