Ejemplo 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);
        }
Ejemplo n.º 2
0
 private DcmElement DoPut(DcmElement newElem)
 {
     int size = m_list.Count;
     if (size == 0 || newElem.CompareTo(m_list[size-1]) > 0)
     {
         m_list.Add(newElem);
     }
     else
     {
         int index = m_list.BinarySearch(newElem);
         if (index >= 0)
         {
             m_list[index] = newElem;
         }
         else
         {
             m_list.Insert(-(index + 1), newElem);
         }
     }
     return newElem;
 }
Ejemplo n.º 3
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);
        }
Ejemplo 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);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
 private void InitBlock(FilterDataset enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
     next = findNext();
 }
Ejemplo n.º 7
0
 public virtual System.Object next()
 {
     if (next == null)
     {
         throw new System.Exception();
     }
     DcmElement retval = next;
     next = findNext();
     return retval;
 }
Ejemplo n.º 8
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);
 }