Exemplo n.º 1
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;
        }
Exemplo n.º 2
0
 void HandleStudyRelatedSeries(TagType tagType, AttributeSet sourceDataset)
 {
     DvtkData.Dimse.Attribute sourceAttribute = sourceDataset.GetAttribute(tagType.Tag);
     if (sourceAttribute == null)
     {
         sourceAttribute = new DvtkData.Dimse.Attribute();
         sourceAttribute.Tag = Tag.NUMBER_OF_STUDY_RELATED_SERIES;
         sourceAttribute.Name = "Number of Study related Series";
     }
     DvtkData.Dimse.Attribute destinationAttribute = _dataset.GetAttribute(tagType.Tag);
     if (destinationAttribute != null)
     {
         _dataset.Remove(destinationAttribute);
     }
     IntegerString str = new IntegerString();
     StringCollection colle = new StringCollection();
     colle.Add(Children.Count.ToString());
     str.Values = colle;
     System.UInt32 length = 0;
     foreach (String data in str.Values)
     {
         length += (System.UInt32)data.Length;
     }
     sourceAttribute.DicomValue = str;
     sourceAttribute.Length = length + (System.UInt32)str.Values.Count - 1;
     _dataset.Add(sourceAttribute);
 }
Exemplo n.º 3
0
 void HandlePatientRelatedInstances(TagType tagType, AttributeSet sourceDataset)
 {
     DvtkData.Dimse.Attribute sourceAttribute = sourceDataset.GetAttribute(tagType.Tag);
     if (sourceAttribute == null)
     {
         sourceAttribute = new DvtkData.Dimse.Attribute();
         sourceAttribute.Tag = Tag.NUMBER_OF_PATIENT_RELATED_INSTANCES;
         sourceAttribute.Name = "Number of Patient related instances";
     }
     DvtkData.Dimse.Attribute destinationAttribute = _dataset.GetAttribute(tagType.Tag);
     if (destinationAttribute != null)
     {
         _dataset.Remove(destinationAttribute);
     }
     IntegerString str = new IntegerString();
     StringCollection colle = new StringCollection();
     int noOfInstances = 0;
     for (int i = 0; i < Children.Count; i++)
     {
         for (int j = 0; j < Children[i].Children.Count; j++)
         {
             noOfInstances = noOfInstances + Children[i].Children[j].Children.Count;
         }
     }
     colle.Add(noOfInstances.ToString());
     str.Values = colle;
     System.UInt32 length = 0;
     foreach (String data in str.Values)
     {
         length += (System.UInt32)data.Length;
     }
     sourceAttribute.DicomValue = str;
     sourceAttribute.Length = length + (System.UInt32)str.Values.Count - 1;
     _dataset.Add(sourceAttribute);
 }
Exemplo n.º 4
0
        void HandlePatientRelatedSeries(TagType tagType, AttributeSet sourceDataset)
        {
            DvtkData.Dimse.Attribute sourceAttribute = sourceDataset.GetAttribute(tagType.Tag);
            if (sourceAttribute == null)
            {
                sourceAttribute = new DvtkData.Dimse.Attribute();
                sourceAttribute.Tag = Tag.NUMBER_OF_PATIENT_RELATED_SERIES;
                sourceAttribute.Name = "Number of Patient related series";
            }
            DvtkData.Dimse.Attribute destinationAttribute = _dataset.GetAttribute(tagType.Tag);
            if (destinationAttribute != null)
            {
                _dataset.Remove(destinationAttribute);
            }
            IntegerString str = new IntegerString();
            StringCollection colle = new StringCollection();
            int noOfSeries = 0;
            for (int i = 0; i < Children.Count; i++)
            {
                noOfSeries = noOfSeries + Children[i].Children.Count;
            }
            colle.Add(noOfSeries.ToString());
            str.Values = colle;
            System.UInt32 length = 0;
            foreach (String data in str.Values)
            {
                length += (System.UInt32)data.Length;
            }
            sourceAttribute.DicomValue = str;
            sourceAttribute.Length = length + (System.UInt32)str.Values.Count - 1;
            _dataset.Add(sourceAttribute);

            //DvtkData.Dimse.Attribute sourceAttribute = sourceDataset.GetAttribute(tagType.Tag);
            //if (sourceAttribute != null)
            //{
            //    // if an entry already exists - remove it
            //    DvtkData.Dimse.Attribute destinationAttribute = _dataset.GetAttribute(tagType.Tag);
            //    if (destinationAttribute != null)
            //    {
            //        _dataset.Remove(destinationAttribute);
            //    }
            //    if (destinationAttribute != null && destinationAttribute.Tag == Tag.NUMBER_OF_PATIENT_RELATED_STUDIES)
            //    {
            //        IntegerString str = new IntegerString();
            //        StringCollection colle = new StringCollection();
            //        int noOfSeries = 0;
            //        for (int i = 0; i < Children.Count; i++)
            //        {
            //            noOfSeries = noOfSeries + Children[i].Children.Count;
            //        }

            //        colle.Add(noOfSeries.ToString());
            //        str.Values = colle;
            //        System.UInt32 length = 0;
            //        foreach (String data in str.Values)
            //        {
            //            length += (System.UInt32)data.Length;
            //        }
            //        sourceAttribute.Length = length + (System.UInt32)str.Values.Count - 1;
            //    }
            //    _dataset.Add(sourceAttribute);
            //}
            //else
            //{
            //    sourceAttribute = new DvtkData.Dimse.Attribute();
            //    sourceAttribute.Tag = Tag.NUMBER_OF_PATIENT_RELATED_STUDIES;
            //    sourceAttribute.Name = "Number of Patient related series";
            //    DvtkData.Dimse.Attribute destinationAttribute = _dataset.GetAttribute(tagType.Tag);
            //    StringCollection values = null;
            //    if (destinationAttribute != null)
            //    {
            //        _dataset.Remove(destinationAttribute);
            //    }
            //    values = new StringCollection();
            //    int noOfSeries = 0;
            //    for (int i = 0; i < Children.Count; i++)
            //    {
            //        noOfSeries = noOfSeries + Children[i].Children.Count;
            //    }
            //    values.Add(noOfSeries.ToString());

            //    IntegerString IS = new IntegerString();
            //    IS.Values = values;
            //    sourceAttribute.DicomValue = IS;
            //    System.UInt32 length = 0;
            //    foreach (String data in IS.Values)
            //    {
            //        length += (System.UInt32)data.Length;
            //    }
            //    sourceAttribute.Length = length + (System.UInt32)IS.Values.Count - 1;
            //    _dataset.Add(sourceAttribute);
            //}
        }
Exemplo n.º 5
0
        //
        // - Methods -
        //

        /// <summary>
        /// Get the values from this attribute.
        /// </summary>
        /// <returns>The values.</returns>
        public ValidValues GetValues()
        {
            ValidValues validValues = null;

            switch (dvtkDataAttribute.ValueRepresentation)
            {
            case VR.AE:                     // Application Entity
                DvtkData.Dimse.ApplicationEntity theApplicationEntity = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.ApplicationEntity;
                validValues = new ValidValues(this.tagSequence, theApplicationEntity.Values);
                break;

            case VR.AS:                     // Age String
                DvtkData.Dimse.AgeString theAgeString = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.AgeString;
                validValues = new ValidValues(this.tagSequence, theAgeString.Values);
                break;

            case VR.AT:                     // Attribute Tag
                DvtkData.Dimse.AttributeTag theAttributeTag = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.AttributeTag;
                validValues = new ValidValues(this.tagSequence, theAttributeTag.Values);
                break;

            case VR.CS:                     // Code String
                DvtkData.Dimse.CodeString theCodeString = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.CodeString;
                validValues = new ValidValues(this.tagSequence, theCodeString.Values);
                break;

            case VR.DA:                     // Date
                DvtkData.Dimse.Date theDate = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.Date;
                validValues = new ValidValues(this.tagSequence, theDate.Values);
                break;

            case VR.DS:                     // Decimal String
                DvtkData.Dimse.DecimalString theDecimalString = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.DecimalString;
                validValues = new ValidValues(this.tagSequence, theDecimalString.Values);
                break;

            case VR.DT:                     // Date Time
                DvtkData.Dimse.DateTime theDateTime = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.DateTime;
                validValues = new ValidValues(this.tagSequence, theDateTime.Values);
                break;

            case VR.FD:                     // Floating Point Double
                DvtkData.Dimse.FloatingPointDouble theFloatingPointDouble = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.FloatingPointDouble;
                validValues = new ValidValues(this.tagSequence, theFloatingPointDouble.Values);
                break;

            case VR.FL:                     // Floating Point Single
                DvtkData.Dimse.FloatingPointSingle theFloatingPointSingle = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.FloatingPointSingle;
                validValues = new ValidValues(this.tagSequence, theFloatingPointSingle.Values);
                break;

            case VR.IS:                     // Integer String
                DvtkData.Dimse.IntegerString theIntegerString = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.IntegerString;
                validValues = new ValidValues(this.tagSequence, theIntegerString.Values);
                break;

            case VR.LO:                     // Long String
                DvtkData.Dimse.LongString theLongString = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.LongString;
                validValues = new ValidValues(this.tagSequence, theLongString.Values);
                break;

            case VR.LT:                     // Long Text
                DvtkData.Dimse.LongText theLongText = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.LongText;
                validValues = new ValidValues(this.tagSequence, theLongText.Value);
                break;

            case VR.PN:                     // Person Name
                DvtkData.Dimse.PersonName thePersonName = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.PersonName;
                validValues = new ValidValues(this.tagSequence, thePersonName.Values);
                break;

            case VR.SH:                     // Short String
                DvtkData.Dimse.ShortString theShortString = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.ShortString;
                validValues = new ValidValues(this.tagSequence, theShortString.Values);
                break;

            case VR.SL:                     // Signed Long
                DvtkData.Dimse.SignedLong theSignedLong = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.SignedLong;
                validValues = new ValidValues(this.tagSequence, theSignedLong.Values);
                break;

            case VR.SS:                     // Signed Short
                DvtkData.Dimse.SignedShort theSignedShort = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.SignedShort;
                validValues = new ValidValues(this.tagSequence, theSignedShort.Values);
                break;

            case VR.ST:                     // Short Text
                DvtkData.Dimse.ShortText theShortText = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.ShortText;
                validValues = new ValidValues(this.tagSequence, theShortText.Value);
                break;

            case VR.TM:                     // Time
                DvtkData.Dimse.Time theTime = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.Time;
                validValues = new ValidValues(this.tagSequence, theTime.Values);
                break;

            case VR.UI:                     // Unique Identifier (UID)
                DvtkData.Dimse.UniqueIdentifier theUniqueIdentifier = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.UniqueIdentifier;
                validValues = new ValidValues(this.tagSequence, theUniqueIdentifier.Values);
                break;

            case VR.UL:                     // Unsigned Long
                DvtkData.Dimse.UnsignedLong theUnsignedLong = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.UnsignedLong;
                validValues = new ValidValues(this.tagSequence, theUnsignedLong.Values);
                break;

            case VR.US:                     // Unsigned Short
                DvtkData.Dimse.UnsignedShort theUnsignedShort = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.UnsignedShort;
                validValues = new ValidValues(this.tagSequence, theUnsignedShort.Values);
                break;

            case VR.UT:                     // Unlimited Text
                DvtkData.Dimse.UnlimitedText theUnlimitedText = this.dvtkDataAttribute.DicomValue as DvtkData.Dimse.UnlimitedText;
                validValues = new ValidValues(this.tagSequence, theUnlimitedText.Value);
                break;

            default:
                DvtkHighLevelInterfaceException.Throw("VR " + dvtkDataAttribute.ValueRepresentation.ToString() + " is not handled by class SimpleAttribute.");
                break;
            }

            return(validValues);
        }