Exemplo n.º 1
0
        public override DcmElement Put(DcmElement newElem)
        {
            if ((newElem.tag())>>16 < 4)
            {
                throw new System.ArgumentException(newElem.ToString());
            }

            if (newElem.tag() == Tags.SpecificCharacterSet)
            {
                try
                {
                    //TODO: decide the encoding
                    //this.encoding = Encodings.lookup(newElem.GetStrings(null));
                }
                catch (System.Exception ex)
                {
                    log.Warn("Failed to consider specified Encoding!", ex);
                    this.encoding = null;
                }
            }

            return base.Put(newElem);
        }
Exemplo n.º 2
0
        public virtual DcmElement Put(DcmElement newElem)
        {
            if (log.IsDebugEnabled)
            {
                log.Debug("Put " + newElem);
            }
            if ((newElem.tag() & 0xffff) == 0)
                return newElem;

            if (Tags.IsPrivate(newElem.tag()))
            {
                try
                {
                    ((DcmElement) newElem).SetTag( AdjustPrivateTag(newElem.tag(), true) );
                }
                catch (DcmValueException e)
                {
                    log.Warn("Could not access creator ID - ignore " + newElem, e);
                    return newElem;
                }
            }
            return DoPut(newElem);
        }
Exemplo n.º 3
0
        public override DcmElement Put(DcmElement newElem)
        {
            uint tag = newElem.tag();
            if ((tag & 0xFFFF0000) != 0x00000000)
            {
                throw new System.ArgumentException(newElem.ToString());
            }

            if (newElem.GetByteBuffer().GetOrder() != ByteOrder.LITTLE_ENDIAN)
                throw new ArgumentException( "The byte order must be LITTLE_ENDIAN: " + newElem.GetByteBuffer().ToString());

            try
            {
                switch (tag)
                {
                    case Tags.AffectedSOPClassUID:
                    case Tags.RequestedSOPClassUID:
                        sopClassUID = newElem.GetString(null);
                        break;

                    case Tags.CommandField:
                        cmdField = newElem.Int;
                        break;

                    case Tags.MessageID: case
                    Tags.MessageIDToBeingRespondedTo:
                        msgID = newElem.Int;
                        break;

                    case Tags.DataSetType:
                        dataSetType = newElem.Int;
                        break;

                    case Tags.Status:
                        status = newElem.Int;
                        break;

                    case Tags.AffectedSOPInstanceUID:
                    case Tags.RequestedSOPInstanceUID:
                        sopInstUID = newElem.GetString(null);
                        break;

                }
            }
            catch (DcmValueException ex)
            {
                throw new System.ArgumentException(newElem.ToString(), ex);
            }
            return base.Put(newElem);
        }
Exemplo n.º 4
0
        public override DcmElement Put(DcmElement newElem)
        {
            uint tag = newElem.tag();
            if ((tag & 0xFFFF0000) != 0x00020000)
            {
                throw new System.ArgumentException(newElem.ToString());
            }

            try
            {
                switch (tag)
                {
                    case Tags.MediaStorageSOPClassUID:
                        sopClassUID = newElem.GetString(null);
                        break;

                    case Tags.MediaStorageSOPInstanceUID:
                        sopInstanceUID = newElem.GetString(null);
                        break;

                    case Tags.TransferSyntaxUID:
                        tsUID = newElem.GetString(null);
                        break;

                    case Tags.ImplementationClassUID:
                        implClassUID = newElem.GetString(null);
                        break;

                    case Tags.ImplementationVersionName:
                        implVersionName = newElem.GetString(null);
                        break;

                }
            }
            catch (DcmValueException ex)
            {
                throw new System.ArgumentException(newElem.ToString());
            }
            return base.Put(newElem);
        }
Exemplo n.º 5
0
 protected internal virtual DcmElement put(DcmElement el)
 {
     if (!filter(el.tag()))
     {
         throw new System.ArgumentException("" + el + " does not fit in this sub DataSet");
     }
     return backend.put(el);
 }