Example #1
0
        /// <summary>
        /// Adds a single attribute with the tag, VR and values specified.
        /// </summary>
        /// <remarks>
        /// If an attribute already exists with this tag, it is removed first before it is again
        /// added.
        /// </remarks>
        /// <param name="dvtkDataTag">The tag of the attribute.</param>
        /// <param name="vR">The VR of the attribute.</param>
        /// <param name="values">The values, which will be copied from another attribute, for this attribute.</param>
        /// <exception cref="System.ArgumentException">
        /// <paramref name="dvtkDataTag"/> is not valid for setting a FileMetaInformation attribute.<br></br>
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="values"/> is a null reference.
        /// </exception>
        public override void Set(DvtkData.Dimse.Tag dvtkDataTag, VR vR, Values values)
        {
            TagSequence internalTagSequence = new TagSequence();

            internalTagSequence.Add(new Tag(dvtkDataTag.GroupNumber, dvtkDataTag.ElementNumber));


            //
            // Sanity checks.
            //

            // Check if the tag supplied is valid for a FileMetaInformation.
            if (!internalTagSequence.IsValidForFileMetaInformation)
            {
                throw new ArgumentException(internalTagSequence.ToString() + " is not valid for setting a FileMetaInformation attribute.", "dvtkDataTag");
            }

            if (values == null)
            {
                throw new ArgumentNullException("values");
            }


            //
            // Perform the actual operation.
            //

            Set(internalTagSequence, vR, values);

            if ((internalTagSequence.ToString() == "0x00020010") && (values.Count == 1))
            {
                this.dvtkDataFileHead.TransferSyntax = new DvtkData.Dul.TransferSyntax(values[0]);
            }
        }
Example #2
0
        /// <summary>
        /// Check if the supplied parameters correspond with the supplied VR.
        /// This functionality is used in e.g. the Append method.
        /// If the check fails, an exception is thrown.
        ///
        /// For now, the only check performed is looking if the supplied parameters
        /// are SequenceItems or not.
        /// </summary>
        /// <param name="vR">The VR.</param>
        /// <param name="parameters">The parameters.</param>
        internal void CheckParameters(VR vR, ICollection parameters)
        {
            int numberOfSequenceItems    = 0;
            int numberOfNonSequenceItems = 0;

            foreach (Object parameter in parameters)
            {
                if (parameter is SequenceItem)
                {
                    numberOfSequenceItems++;
                }
                else
                {
                    numberOfNonSequenceItems++;
                }
            }

            if (vR == VR.SQ)
            {
                if (numberOfNonSequenceItems > 0)
                {
                    throw new System.Exception(numberOfNonSequenceItems.ToString() + " non SequenceItems supplied for VR " + vR.ToString() + ".");
                }
            }
            else
            {
                if (numberOfSequenceItems > 0)
                {
                    throw new System.Exception(numberOfSequenceItems.ToString() + " SequenceItems supplied for VR " + vR.ToString() + ".");
                }
            }
        }
Example #3
0
        /// <summary>
        /// Adds a single attribute with the tag, VR and values specified.
        /// </summary>
        /// <remarks>
        /// If an attribute already exists with this tag, it is removed first before it is again
        /// added.
        /// </remarks>
        /// <param name="dvtkDataTag">The tag of the attribute.</param>
        /// <param name="vR">The VR of the attribute.</param>
        /// <param name="values">The values, which will be copied from another attribute, for this attribute.</param>
        /// <exception cref="System.ArgumentException">
        /// <paramref name="dvtkDataTag"/> is not valid for setting a CommandSet attribute.<br></br>
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="values"/> is a null reference.
        /// </exception>
        public override void Set(DvtkData.Dimse.Tag dvtkDataTag, VR vR, Values values)
        {
            TagSequence internalTagSequence = new TagSequence();

            internalTagSequence.Add(new Tag(dvtkDataTag.GroupNumber, dvtkDataTag.ElementNumber));


            //
            // Sanity checks.
            //

            // Check if the tag supplied is valid for a CommandSet.
            if (!internalTagSequence.IsValidForCommandSet)
            {
                throw new ArgumentException(internalTagSequence.ToString() + " is not valid for setting a CommandSet attribute.", "dvtkDataTag");
            }

            if (values == null)
            {
                throw new ArgumentNullException("values");
            }


            //
            // Perform the actual operation in the base class.
            //

            Set(internalTagSequence, vR, values);
        }
Example #4
0
        /// <summary>
        /// Adds a single attribute with the tag sequence, VR and values specified.
        /// </summary>
        /// <remarks>
        /// If an attribute already exists with this tag, it is removed first before it is again
        /// added.
        /// <br></br><br></br>
        /// If sequence items (each with a sequence item index) are specified in the tag sequence,
        /// empty sequence items will be added automatically to avoid gaps in the sequence items of sequence
        /// attributes.
        /// </remarks>
        /// <param name="tagSequence">The tag sequence of the attribute.</param>
        /// <param name="vR">The VR of the attribute.</param>
        /// <param name="values">The values, which will be copied from another attribute, for this attribute.</param>
        /// <exception cref="System.ArgumentException">
        /// <paramref name="dvtkDataTag"/> is not valid for setting an attribute.<br></br>
        /// -or-<br></br>
        /// <paramref name="dvtkDataTag"/> is not valid for setting a CommandSet attribute.<br></br>
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="values"/> is a null reference.
        /// </exception>
        public override void Set(String tagSequence, VR vR, Values values)
        {
            TagSequence internalTagSequence = new TagSequence(tagSequence);


            //
            // Sanity checks.
            //

            if (!internalTagSequence.IsSingleAttributeMatching)
            {
                throw new ArgumentException(internalTagSequence.ToString() + " not valid for setting an attribute.");
            }

            // Check if the tag supplied is valid for a CommandSet.
            if (!internalTagSequence.IsValidForCommandSet)
            {
                throw new ArgumentException(internalTagSequence.ToString() + " not valid for setting a CommandSet attribute.", "dvtkDataTag");
            }

            if (values == null)
            {
                throw new ArgumentNullException("values");
            }


            //
            // Perform the actual operation in the base class.
            //

            Set(internalTagSequence, vR, values);
        }
Example #5
0
        /// <summary>
        /// Adds a single attribute with the tag, VR and values specified.
        /// </summary>
        /// <remarks>
        /// Depending on the group number of the tag, the attribute
        /// is set in the CommandSet or DataSet of this instance.
        /// <br></br><br></br>
        /// If an attribute already exists with this tag, it is removed first before it is
        /// again set.
        /// </remarks>
        /// <param name="dvtkDataTag">The tag that uniquely identifies the attribute.</param>
        /// <param name="vR">The VR of the attribute.</param>
        /// <param name="parameters">
        /// The values of the attribute. Do not use the DICOM delimeter '\' directly. Instead use
        /// multiple parameter arguments for this method when adding a single attribute with multiple values.
        /// </param>
        public void Set(DvtkData.Dimse.Tag dvtkDataTag, VR vR, params Object[] parameters)
        {
            TagSequence tagSequence = new TagSequence();

            tagSequence.Add(new Tag(dvtkDataTag.GroupNumber, dvtkDataTag.ElementNumber));

            Set(tagSequence, vR, parameters);
        }
Example #6
0
        internal virtual void Set <T>(TagSequence tagSequence, VR vR, T genericsParameter)
        {
            AttributeSet currentAttributeSetInLoop = this;

            for (int index = 0; index < tagSequence.Tags.Count; index++)
            {
                Tag tag = tagSequence[index];

                if (index < tagSequence.Tags.Count - 1)
                // If this is not the last tag from the TagSequence...
                {
                    Attribute attribute = currentAttributeSetInLoop.SetSequenceAttribute(tag);

                    currentAttributeSetInLoop = attribute.GetItem(tag.IndexNumber);
                }
                else
                // If this is the last tag from the TagSequence...
                {
                    Attribute attribute = currentAttributeSetInLoop.GetAttribute(tag.AsUInt32);

                    if (attribute is ValidAttribute)
                    {
                        attribute.Delete();
                    }

                    attribute = currentAttributeSetInLoop.Create(tag.AsUInt32, vR);


                    // The type of genericsParameter (generics type) is determined run-time.
                    // Maybe this is the reason for a direct call to attribute.Values.Add
                    // (has a overloaded method with params parameter) with the argument
                    // genericsParameter not to work. Needed to explicitly cast to a specfic type
                    // before calling the Add method.
                    if (genericsParameter is Values)
                    {
                        Values values = genericsParameter as Values;

                        attribute.Values.Add(values);
                    }
                    else if (genericsParameter is Byte[])
                    {
                        Byte[] value = genericsParameter as Byte[];

                        attribute.Values.Set(value);
                    }
                    else if (genericsParameter is Object[])
                    {
                        Object[] values = genericsParameter as Object[];

                        attribute.Values.Add(values);
                    }
                    else
                    {
                        throw new HliException("Not supposed to get here.");
                    }
                }
            }
        }
Example #7
0
        internal void Append(TagSequence tagSequence, VR vR, params Object[] parameters)
        {
            // Check if the supplied parameters correspond with the supplied VR.
            // If the check fails, an exception is thrown.
            CheckParameters(vR, parameters);

            if (tagSequence.IsSingleAttributeMatching)
            // Supplied TagSequence is single attribute matching.
            {
                if (Exists(tagSequence))
                // Attribute already exists.
                {
                    Attribute alreadyExistingAttribute = this[tagSequence];

                    if (alreadyExistingAttribute.VR == vR)
                    // Attribute already exists and has the same VR.
                    {
                        if (vR == VR.SQ)
                        // Attribute already exists and also has VR SQ.
                        {
                            foreach (SequenceItem itemToAdd in parameters)
                            {
                                alreadyExistingAttribute.AddItem(itemToAdd);
                            }
                        }
                        else
                        // Attribute already exists and has the same VR (unequal to SQ).
                        {
                            alreadyExistingAttribute.Values.Add(parameters);
                        }
                    }
                    else
                    // Attribute already exists but has a different VR.
                    {
                        Thread.WriteErrorCurrentThread("While appending, attribute with tag sequence " + tagSequence.ToString() + " already existed with a different VR. Nothing will be appended.");
                    }
                }
                else
                // Attribute does not already exists.
                {
                    // In this case, behaviour should be the same as the Set method.
                    Set(tagSequence, vR, parameters);
                }
            }
            else
            // Supplied TagSequence contains wildcards.
            {
                AttributeCollection existingAttributes = GetAttributes(tagSequence);

                foreach (ValidAttribute existingAttribute in existingAttributes)
                {
                    Append(existingAttribute.TagSequence, vR, parameters);
                }
            }
        }
Example #8
0
        /// <summary>
        /// When the tag sequence is single attribute specifying, this method does the following:
        /// - When the attribute already exists and also has VR SQ, the values or sequence items
        ///   are appended to the already existing values or sequence items.
        /// - When the attribute already exists but has a different VR, an error is displayed and
        ///   nothing is appended.
        /// - When the attribute does not already exists, it is created and the values or sequence
        ///   items are added.
        ///
        /// When the tag sequence contains wildcards, the rules above are applied to each existing attribute
        /// specified by the tag sequence.
        ///
        /// Whenever the VR specified is SQ and the parameters supplied contain non sequence
        /// item(s), and exception is thrown.
        /// Whenever the VR specified is unequal SQ and the parameters contain sequence item(s),
        /// and exception is thrown.
        /// </summary>
        /// <param name="tagSequence">The tag sequence.</param>
        /// <param name="vR">The VR.</param>
        /// <param name="parameters">The parameters to append.</param>
        public void Append(String tagSequence, VR vR, params Object[] parameters)
        {
            TagSequence internalTagSequence = new TagSequence(tagSequence);

            if (!internalTagSequence.IsSingleAttributeMatching)
            {
                throw new Exception("Invalid tag sequence supplied.");
            }

            Append(internalTagSequence, vR, parameters);
        }
Example #9
0
        /// <summary>
        /// Create a new Attribute in this AttributeSet containing no values.
        ///
        /// Precondition: this Attribute may not exist in the AttributeSet.
        /// </summary>
        /// <param name="tagAsUInt32"></param>
        /// <param name="vR"></param>
        internal ValidAttribute Create(UInt32 tagAsUInt32, VR vR)
        {
            TagSequence newTagSequence = this.tagSequence.Clone();

            newTagSequence.Add(new Tag(tagAsUInt32));

            DvtkData.Dimse.Attribute dvtkDataAttribute = new DvtkData.Dimse.Attribute(tagAsUInt32, (DvtkData.Dimse.VR)vR);
            this.dvtkDataAttributeSet.Add(dvtkDataAttribute);
            MakeAscending(false);

            ValidAttribute validAttribute = new ValidAttribute(newTagSequence, dvtkDataAttribute, this);

            return(validAttribute);
        }
Example #10
0
        /// <summary>
        /// Removed all non-significant characters, as defined by the specified VR.
        /// </summary>
        /// <param name="stringToTrim">
        /// The string from which to remove the non-significant characters.
        /// </param>
        /// <param name="vr">The VR to take into account.</param>
        /// <returns>The trimmed String.</returns>
        public static string ToTrimmedString(string stringToTrim, VR vr)
        {
            string trimmedString = null;

            switch (vr)
            {
            case VR.SH:
            case VR.LO:
                trimmedString = stringToTrim.Trim();
                break;

            default:

                // TODO: still to implement for other VR's.
                trimmedString = stringToTrim;
                break;
            }

            return(trimmedString);
        }
Example #11
0
        public void Set_tagSequenceString_vR_parameters()
        {
            bool exceptionThrown = false;

            String tagSequenceString = "";
            VR     vR = VR.UN;

            Object[] parameters = null;

            try
            {
                dicomFile.Set(tagSequenceString, vR, parameters);
            }
            catch
            {
                exceptionThrown = true;
            }

            Assert.That(exceptionThrown, Is.EqualTo(true));
        }
Example #12
0
        /// <summary>
        /// Adds a single attribute with the tag sequence, VR and values specified.
        /// </summary>
        /// <remarks>
        /// Depending on the group number of the last tag in the tag sequence, the attribute
        /// is set in the CommandSet or DataSet of this instance.
        /// <br></br><br></br>
        /// If an attribute already exists with this tag sequence, it is removed first before it is
        /// again set.
        /// <br></br><br></br>
        /// If sequence items (each with a sequence item index) are specified in the tag sequence,
        /// empty sequence items will be added automatically to avoid gaps in the sequence items of sequence
        /// attributes.
        /// </remarks>
        /// <param name="tagSequence">The tag sequence that uniquely identifies the attribute.</param>
        /// <param name="vR">The VR of the attribute.</param>
        /// <param name="parameters">
        /// The values of the attribute. Do not use the DICOM delimeter '\' directly. Instead use
        /// multiple parameter arguments for this method when adding a single attribute with multiple values.
        /// </param>
        internal void Set(TagSequence tagSequence, VR vR, params Object[] parameters)
        {
            // Check if the TagSequence supplied uniquely identifies one attribute.
            if (!tagSequence.IsSingleAttributeMatching)
            {
                throw new HliException(tagSequence.ToString() + " not valid for setting an attribute.");
            }

            if (tagSequence.IsValidForCommandSet)
            {
                CommandSet.Set(tagSequence, vR, parameters);
            }
            else if (tagSequence.IsValidForDataSet)
            {
                DataSet.Set(tagSequence, vR, parameters);
            }
            else
            {
                throw new HliException(tagSequence.ToString() + " not valid for setting a DicomMessage attribute.");
            }
        }
Example #13
0
        /// <summary>
        /// Determines if a VR is a "simple" one, i.e. is not SQ, OB, OW, OF or UN.
        /// </summary>
        /// <param name="vR">The VR.</param>
        /// <returns>Boolean indicating if it is a simple VR or not.</returns>
        internal static bool IsSimpleVR(VR vR)
        {
            bool isSimpleVR = true;

            switch (vR)
            {
            case VR.AE:     // Application Entity
            case VR.AS:     // Age String
            case VR.AT:     // Attribute Tag
            case VR.CS:     // Code String
            case VR.DA:     // Date
            case VR.DS:     // Decimal String
            case VR.DT:     // Date Time
            case VR.FL:     // Floating Point Single
            case VR.FD:     // Floating Point Double
            case VR.IS:     // Integer String
            case VR.LO:     // Long String
            case VR.LT:     // Long Text
            case VR.PN:     // Person Name
            case VR.SH:     // Short String
            case VR.SL:     // Signed Long
            case VR.SS:     // Signed Short
            case VR.ST:     // Short Text
            case VR.TM:     // Time
            case VR.UI:     // Unique Identifier (UID)
            case VR.UL:     // Unsigned Long
            case VR.US:     // Unsigned Short
            case VR.UT:     // Unlimited Text
            case VR.UC:     // Unlimited Characters
            case VR.UR:     // Universal Resource Locator
                isSimpleVR = true;
                break;

            default:
                isSimpleVR = false;
                break;
            }

            return(isSimpleVR);
        }
Example #14
0
        /// <summary>
        /// Adds a single attribute with the tag sequence, VR and value specified.
        /// </summary>
        /// <remarks>
        /// Only use this method for setting an attribute with VR OB, OF or OW.
        /// <br></br><br></br>
        /// If an attribute already exists with this tag, it is removed first before it is again
        /// added.
        /// <br></br><br></br>
        /// If sequence items (each with a sequence item index) are specified in the tag sequence,
        /// empty sequence items will be added automatically to avoid gaps in the sequence items of sequence
        /// attributes.
        /// </remarks>
        /// <param name="tagSequence">The tag sequence of the attribute.</param>
        /// <param name="vR">The VR (may only be OB, OF or OW) of the attribute.</param>
        /// <param name="value">The value of the attribute.</param>
        /// <exception cref="System.ArgumentException">
        /// <paramref name="dvtkDataTag"/> is not valid for setting an attribute.<br></br>
        /// -or-<br></br>
        /// <paramref name="dvtkDataTag"/> is not valid for setting a CommandSet attribute.<br></br>
        /// -or-<br></br>
        /// <paramref name="vR"/> is unequal to OB, OF or OW.
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="value"/> is a null reference.
        /// </exception>
        public override void Set(String tagSequence, VR vR, Byte[] value)
        {
            TagSequence internalTagSequence = new TagSequence(tagSequence);


            //
            // Sanity checks.
            //

            if (!internalTagSequence.IsSingleAttributeMatching)
            {
                throw new ArgumentException(internalTagSequence.ToString() + " not valid for setting an attribute.");
            }

            // Check if the tag supplied is valid for a CommandSet.
            if (!internalTagSequence.IsValidForCommandSet)
            {
                throw new ArgumentException(internalTagSequence.ToString() + " not valid for setting a CommandSet attribute.", "dvtkDataTag");
            }

            // Check the supplied VR.

            if ((vR != VR.OB) && (vR != VR.OF) && (vR != VR.OW))
            {
                throw new ArgumentException("Supplied VR is " + vR.ToString() + ". VR may only be OB, OF or OW.", "vR");
            }

            if (value == null)
            {
                throw new ArgumentNullException("value");
            }


            //
            // Perform the actual operation in the base class.
            //

            Set(internalTagSequence, vR, value);
        }
Example #15
0
        /// <summary>
        /// Adds a single attribute with the tag sequence, VR and values specified.
        /// </summary>
        /// <remarks>
        /// If an attribute already exists with this tag, it is removed first before it is again
        /// added.
        /// <br></br><br></br>
        /// If sequence items (each with a sequence item index) are specified in the tag sequence,
        /// empty sequence items will be added automatically to avoid gaps in the sequence items of sequence
        /// attributes.
        /// </remarks>
        /// <param name="tagSequence">The tag sequence of the attribute.</param>
        /// <param name="vR">The VR of the attribute.</param>
        /// <param name="values">
        /// The values of the attribute. Do not use the DICOM delimeter '\' directly. Instead supply
        /// multiple values arguments for this method when adding a single attribute with multiple values.
        /// </param>
        /// <exception cref="System.ArgumentException">
        /// <paramref name="dvtkDataTag"/> is not valid for setting an attribute.<br></br>
        /// -or-<br></br>
        /// <paramref name="dvtkDataTag"/> is not valid for setting a FileMetaInformation attribute.<br></br>
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="values"/> is a null reference.
        /// </exception>
        public override void Set(String tagSequence, VR vR, params Object[] values)
        {
            TagSequence internalTagSequence = new TagSequence(tagSequence);


            //
            // Sanity checks.
            //

            if (!internalTagSequence.IsSingleAttributeMatching)
            {
                throw new ArgumentException(internalTagSequence.ToString() + " not valid for setting an attribute.");
            }

            // Check if the tag supplied is valid for a FileMetaInformation.
            if (!internalTagSequence.IsValidForFileMetaInformation)
            {
                throw new ArgumentException(internalTagSequence.ToString() + " not valid for setting a FileMetaInformation attribute.", "dvtkDataTag");
            }

            if (values == null)
            {
                throw new ArgumentNullException("parameters");
            }


            //
            // Perform the actual operation.
            //

            Set(internalTagSequence, vR, values);

            if ((internalTagSequence.ToString() == "0x00020010") && (values.Length == 1))
            {
                this.dvtkDataFileHead.TransferSyntax = new DvtkData.Dul.TransferSyntax(values[0].ToString());
            }
        }
Example #16
0
        /// <summary>
        /// Adds a single attribute with the tag, VR and value specified.
        /// </summary>
        /// <remarks>
        /// Only use this method for setting an attribute with VR OB, OF or OW.
        /// <br></br><br></br>
        /// If an attribute already exists with this tag, it is removed first before it is again
        /// added.
        /// </remarks>
        /// <param name="dvtkDataTag">The tag of the attribute.</param>
        /// <param name="vR">The VR (may only be OB, OF or OW) of the attribute.</param>
        /// <param name="value">The value of the attribute.</param>
        /// <exception cref="System.ArgumentException">
        /// <paramref name="dvtkDataTag"/> is not valid for setting a CommandSet attribute.<br></br>
        /// -or-<br></br>
        /// <paramref name="vR"/> is unequal to OB, OF or OW.
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="value"/> is a null reference.
        /// </exception>
        public override void Set(DvtkData.Dimse.Tag dvtkDataTag, VR vR, Byte[] value)
        {
            TagSequence internalTagSequence = new TagSequence();

            internalTagSequence.Add(new Tag(dvtkDataTag.GroupNumber, dvtkDataTag.ElementNumber));


            //
            // Sanity checks.
            //

            // Check if the tag supplied is valid for a CommandSet.
            if (!internalTagSequence.IsValidForCommandSet)
            {
                throw new ArgumentException(internalTagSequence.ToString() + " is not valid for setting a CommandSet attribute.", "dvtkDataTag");
            }

            // Check the supplied VR.

            if ((vR != VR.OB) && (vR != VR.OF) && (vR != VR.OW))
            {
                throw new ArgumentException("Supplied VR is " + vR.ToString() + ". VR may only be OB, OF or OW.", "vR");
            }

            if (value == null)
            {
                throw new ArgumentNullException("value");
            }


            //
            // Perform the actual operation in the base class.
            //

            Set(internalTagSequence, vR, value);
        }
Example #17
0
 /// <summary>
 /// See comments for this overridden method in the classes CommandSet, DataSet, SequenceItem and FileMetaInformation.
 /// </summary>
 /// <param name="dvtkDataTag">-</param>
 /// <param name="vR">-</param>
 /// <param name="values">-</param>
 public abstract void Set(DvtkData.Dimse.Tag dvtkDataTag, VR vR, Values values);
Example #18
0
        /// <summary>
        /// Adds a single attribute with the tag, VR and values specified.
        /// </summary>
        /// <remarks>
        /// If an attribute already exists with this tag, it is removed first before it is again
        /// added.
        /// </remarks>
        /// <param name="dvtkDataTag">The tag of the attribute.</param>
        /// <param name="vR">The VR of the attribute.</param>
        /// <param name="values">The values, which will be copied from another attribute, for this attribute.</param>
        /// <exception cref="System.ArgumentException">
        /// <paramref name="dvtkDataTag"/> is not valid for setting a CommandSet attribute.<br></br>
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="values"/> is a null reference.
        /// </exception>
        public override void Set(DvtkData.Dimse.Tag dvtkDataTag, VR vR, Values values)
        {
            TagSequence internalTagSequence = new TagSequence();

            internalTagSequence.Add(new Tag(dvtkDataTag.GroupNumber, dvtkDataTag.ElementNumber));

            //
            // Sanity checks.
            //

            // Check if the tag supplied is valid for a CommandSet.
            if (!internalTagSequence.IsValidForCommandSet)
            {
                throw new ArgumentException(internalTagSequence.ToString() + " is not valid for setting a CommandSet attribute.", "dvtkDataTag");
            }

            if (values == null)
            {
                throw new ArgumentNullException("values");
            }

            //
            // Perform the actual operation in the base class.
            //

            Set(internalTagSequence, vR, values);
        }
Example #19
0
        /// <summary>
        /// Adds a single attribute with the tag sequence, VR and values specified.
        /// </summary>
        /// <remarks>
        /// Depending on the group number of the last tag in the tag sequence, the attribute
        /// is set in the CommandSet or DataSet of this instance.
        /// <br></br><br></br>
        /// If an attribute already exists with this tag sequence, it is removed first before it is 
        /// again set.
        /// <br></br><br></br>
        /// If sequence items (each with a sequence item index) are specified in the tag sequence,
        /// empty sequence items will be added automatically to avoid gaps in the sequence items of sequence
        /// attributes.
        /// </remarks>
        /// <param name="tagSequence">The tag sequence that uniquely identifies the attribute.</param>
        /// <param name="vR">The VR of the attribute.</param>
        /// <param name="parameters">
        /// The values of the attribute. Do not use the DICOM delimeter '\' directly. Instead use
        /// multiple parameter arguments for this method when adding a single attribute with multiple values.
        /// </param>
        internal void Set(TagSequence tagSequence, VR vR, params Object[] parameters)
        {
            // Check if the TagSequence supplied uniquely identifies one attribute.
            if (!tagSequence.IsSingleAttributeMatching)
            {
                throw new HliException(tagSequence.ToString() + " not valid for setting an attribute.");
            }

            if (tagSequence.IsValidForCommandSet)
            {
                CommandSet.Set(tagSequence, vR, parameters);
            }
            else if (tagSequence.IsValidForDataSet)
            {
                DataSet.Set(tagSequence, vR, parameters);
            }
            else
            {
                throw new HliException(tagSequence.ToString() + " not valid for setting a DicomMessage attribute.");
            }
        }
 //
 // - Constructors -
 //
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="tag">The tag of the attribute to set.</param>
 /// <param name="vr">The VR of the attribute to set.</param>
 /// <param name="values">The values of the attribute to set.</param>
 public OutboundDicomMessageFilterSetAttribute(String tag, VR vr, params Object[] values)
 {
     this.tagSequence = tag;
     this.vR = vr;
     this.values = new ArrayList(values);
 }
Example #21
0
        /// <summary>
        /// Adds a single attribute with the tag, VR and values specified.
        /// </summary>
        /// <remarks>
        /// If an attribute already exists with this tag, it is removed first before it is again
        /// added.
        /// </remarks>
        /// <param name="dvtkDataTag">The tag of the attribute.</param>
        /// <param name="vR">The VR of the attribute.</param>
        /// <param name="values">
        /// The values of the attribute. Do not use the DICOM delimeter '\' directly. Instead supply
        /// multiple values arguments for this method when adding a single attribute with multiple values.
        /// </param>
        /// <exception cref="System.ArgumentException">
        /// <paramref name="dvtkDataTag"/> is not valid for setting a FileMetaInformation attribute.<br></br>
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="values"/> is a null reference.
        /// </exception>
        public override void Set(DvtkData.Dimse.Tag dvtkDataTag, VR vR, params Object[] values)
        {
            TagSequence internalTagSequence = new TagSequence();

            internalTagSequence.Add(new Tag(dvtkDataTag.GroupNumber, dvtkDataTag.ElementNumber));

            //
            // Sanity checks.
            //

            // Check if the tag supplied is valid for a FileMetaInformation.
            if (!internalTagSequence.IsValidForFileMetaInformation)
            {
                throw new ArgumentException(internalTagSequence.ToString() + " is not valid for setting a FileMetaInformation attribute.", "dvtkDataTag");
            }

            if (values == null)
            {
                throw new ArgumentNullException("values");
            }

            //
            // Perform the actual operation.
            //

            Set(internalTagSequence, vR, values);

            if ((internalTagSequence.ToString() == "0x00020010") && (values.Length == 1))
            {
                this.dvtkDataFileHead.TransferSyntax = new DvtkData.Dul.TransferSyntax(values[0].ToString());
            }
        }
Example #22
0
 /// <summary>
 /// See comments for this overridden method in the classes CommandSet, DataSet, SequenceItem and FileMetaInformation.
 /// </summary>
 /// <param name="tagSequence">-</param>
 /// <param name="vR">-</param>
 /// <param name="values">-</param>
 public abstract void Set(String tagSequence, VR vR, Values values);
Example #23
0
        /// <summary>
        /// Adds a single attribute with the tag sequence string, VR and values specified.
        /// </summary>
        /// <remarks>
        /// Depending on the group number of the last tag in the tag sequence string, the attribute
        /// is set in the CommandSet or DataSet of this instance.
        /// <br></br><br></br>
        /// If an attribute already exists with this tag sequence string, it is removed first before it is 
        /// again set.
        /// <br></br><br></br>
        /// If sequence items (each with a sequence item index) are specified in the tag sequence string,
        /// empty sequence items will be added automatically to avoid gaps in the sequence items of sequence
        /// attributes.
        /// </remarks>
        /// <param name="tagSequenceString">The tag sequence string that uniquely identifies the attribute.</param>
        /// <param name="vR">The VR of the attribute.</param>
        /// <param name="parameters">
        /// The values of the attribute. Do not use the DICOM delimeter '\' directly. Instead use
        /// multiple parameter arguments for this method when adding a single attribute with multiple values.
        /// </param>
        public void Set(String tagSequenceString, VR vR, params Object[] parameters)
        {
            TagSequence tagSequence = new TagSequence(tagSequenceString);

            Set(tagSequence, vR, parameters);
        }
 public OutboundMessageFilterSetAttribute(String tag, VR vR, params Object[] values)
 {
     this.parameters = new ArrayList(values);
     this.parameters.Insert(0, vR);
     this.parameters.Insert(0, tag);
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="tagSequence">The tag sequence.</param>
 /// <param name="vR">The VR.</param>
 /// <param name="values">The values.</param>
 public InboundDicomMessageFilterSetAttribute(String tagSequence, VR vR, params Object[] values)
 {
     this.tagSequence = tagSequence;
     this.vR = vR;
     this.values = new ArrayList(values);
 }
Example #26
0
 /// <summary>
 /// <see cref="IDefinitionManagement.GetAttributeVrFromDefinition"/>
 /// </summary>
 public DvtkData.Dimse.VR GetAttributeVrFromDefinition(DvtkData.Dimse.Tag tag)
 {
     DvtkData.Dimse.VR vr = this.m_adaptee.get_AttributeVrFromDefinition(tag);
     return(vr);
 }
Example #27
0
        /// <summary>
        /// Determines if a VR is a "simple" one, i.e. is not SQ, OB, OW, OF or UN.
        /// </summary>
        /// <param name="vR">The VR.</param>
        /// <returns>Boolean indicating if it is a simple VR or not.</returns>
        internal static bool IsSimpleVR(VR vR)
        {
            bool isSimpleVR = true;

            switch(vR)
            {
                case VR.AE: // Application Entity
                case VR.AS: // Age String
                case VR.AT: // Attribute Tag
                case VR.CS: // Code String
                case VR.DA: // Date
                case VR.DS: // Decimal String
                case VR.DT: // Date Time
                case VR.FL: // Floating Point Single
                case VR.FD: // Floating Point Double
                case VR.IS: // Integer String
                case VR.LO: // Long String
                case VR.LT: // Long Text
                case VR.PN: // Person Name
                case VR.SH: // Short String
                case VR.SL: // Signed Long
                case VR.SS: // Signed Short
                case VR.ST: // Short Text
                case VR.TM: // Time
                case VR.UI: // Unique Identifier (UID)
                case VR.UL: // Unsigned Long
                case VR.US: // Unsigned Short
                case VR.UT: // Unlimited Text
                    isSimpleVR = true;
                    break;

                default:
                    isSimpleVR = false;
                    break;
            }

            return(isSimpleVR);
        }
Example #28
0
        /// <summary>
        /// Adds a single attribute with the tag sequence, VR and values specified.
        /// </summary>
        /// <remarks>
        /// If an attribute already exists with this tag, it is removed first before it is again
        /// added.
        /// <br></br><br></br>
        /// If sequence items (each with a sequence item index) are specified in the tag sequence,
        /// empty sequence items will be added automatically to avoid gaps in the sequence items of sequence
        /// attributes.
        /// </remarks>
        /// <param name="tagSequence">The tag sequence of the attribute.</param>
        /// <param name="vR">The VR of the attribute.</param>
        /// <param name="values">The values, which will be copied from another attribute, for this attribute.</param>
        /// <exception cref="System.ArgumentException">
        /// <paramref name="dvtkDataTag"/> is not valid for setting an attribute.<br></br>
        /// -or-<br></br>
        /// <paramref name="dvtkDataTag"/> is not valid for setting a CommandSet attribute.<br></br>
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="values"/> is a null reference.
        /// </exception>
        public override void Set(String tagSequence, VR vR, Values values)
        {
            TagSequence internalTagSequence = new TagSequence(tagSequence);

            //
            // Sanity checks.
            //

            if (!internalTagSequence.IsSingleAttributeMatching)
            {
                throw new ArgumentException(internalTagSequence.ToString() + " not valid for setting an attribute.");
            }

            // Check if the tag supplied is valid for a CommandSet.
            if (!internalTagSequence.IsValidForCommandSet)
            {
                throw new ArgumentException(internalTagSequence.ToString() + " not valid for setting a CommandSet attribute.", "dvtkDataTag");
            }

            if (values == null)
            {
                throw new ArgumentNullException("values");
            }

            //
            // Perform the actual operation in the base class.
            //

            Set(internalTagSequence, vR, values);
        }
Example #29
0
        /// <summary>
        /// Adds a single attribute with the tag sequence, VR and value specified.
        /// </summary>
        /// <remarks>
        /// Only use this method for setting an attribute with VR OB, OF or OW.
        /// <br></br><br></br>
        /// If an attribute already exists with this tag, it is removed first before it is again
        /// added.
        /// <br></br><br></br>
        /// If sequence items (each with a sequence item index) are specified in the tag sequence,
        /// empty sequence items will be added automatically to avoid gaps in the sequence items of sequence
        /// attributes.
        /// </remarks>
        /// <param name="tagSequence">The tag sequence of the attribute.</param>
        /// <param name="vR">The VR (may only be OB, OF or OW) of the attribute.</param>
        /// <param name="value">The value of the attribute.</param>
        /// <exception cref="System.ArgumentException">
        /// <paramref name="dvtkDataTag"/> is not valid for setting an attribute.<br></br>
        /// -or-<br></br>
        /// <paramref name="dvtkDataTag"/> is not valid for setting a CommandSet attribute.<br></br>
        /// -or-<br></br>
        /// <paramref name="vR"/> is unequal to OB, OF or OW.
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="value"/> is a null reference.
        /// </exception>
        public override void Set(String tagSequence, VR vR, Byte[] value)
        {
            TagSequence internalTagSequence = new TagSequence(tagSequence);

            //
            // Sanity checks.
            //

            if (!internalTagSequence.IsSingleAttributeMatching)
            {
                throw new ArgumentException(internalTagSequence.ToString() + " not valid for setting an attribute.");
            }

            // Check if the tag supplied is valid for a CommandSet.
            if (!internalTagSequence.IsValidForCommandSet)
            {
                throw new ArgumentException(internalTagSequence.ToString() + " not valid for setting a CommandSet attribute.", "dvtkDataTag");
            }

            // Check the supplied VR.

            if ((vR != VR.OB) && (vR != VR.OF) && (vR != VR.OW))
            {
                throw new ArgumentException("Supplied VR is " + vR.ToString() + ". VR may only be OB, OF or OW.", "vR");
            }

            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            //
            // Perform the actual operation in the base class.
            //

            Set(internalTagSequence, vR, value);
        }
Example #30
0
 /// <summary>
 /// See comments for this overridden method in the classes CommandSet, DataSet, SequenceItem and FileMetaInformation.
 /// </summary>
 /// <param name="tagSequence">-</param>
 /// <param name="vR">-</param>
 /// <param name="value">-</param>
 public abstract void Set(String tagSequence, VR vR, Byte[] value);
Example #31
0
 /// <summary>
 /// See comments for this overridden method in the classes CommandSet, DataSet, SequenceItem and FileMetaInformation.
 /// </summary>
 /// <param name="tagSequence">-</param>
 /// <param name="vR">-</param>
 /// <param name="values">-</param>
 public abstract void Set(String tagSequence, VR vR, params Object[] values);
Example #32
0
        /// <summary>
        /// Adds a single attribute with the tag sequence string, VR and values specified.
        /// </summary>
        /// <remarks>
        /// Depending on the group number of the last tag in the tag sequence string, the attribute
        /// is set in the CommandSet or DataSet of this instance.
        /// <br></br><br></br>
        /// If an attribute already exists with this tag sequence string, it is removed first before it is
        /// again set.
        /// <br></br><br></br>
        /// If sequence items (each with a sequence item index) are specified in the tag sequence string,
        /// empty sequence items will be added automatically to avoid gaps in the sequence items of sequence
        /// attributes.
        /// </remarks>
        /// <param name="tagSequenceString">The tag sequence string that uniquely identifies the attribute.</param>
        /// <param name="vR">The VR of the attribute.</param>
        /// <param name="parameters">
        /// The values of the attribute. Do not use the DICOM delimeter '\' directly. Instead use
        /// multiple parameter arguments for this method when adding a single attribute with multiple values.
        /// </param>
        public void Set(String tagSequenceString, VR vR, params Object[] parameters)
        {
            TagSequence tagSequence = new TagSequence(tagSequenceString);

            Set(tagSequence, vR, parameters);
        }
Example #33
0
        /// <summary>
        /// Adds a single attribute with the tag sequence, VR and values specified.
        /// </summary>
        /// <remarks>
        /// If an attribute already exists with this tag, it is removed first before it is again
        /// added.
        /// <br></br>
        /// If sequence items (each with a sequence item index) are specified in the tag sequence,
        /// empty sequence items will be added automatically to avoid gaps in the sequence items of sequence
        /// attributes.
        /// </remarks>
        /// <param name="tagSequence">The tag sequence of the attribute.</param>
        /// <param name="vR">The VR of the attribute.</param>
        /// <param name="values">The values, which will be copied from another attribute, for this attribute.</param>
        /// <exception cref="System.ArgumentException">
        /// <paramref name="dvtkDataTag"/> is not valid for setting an attribute.<br></br>
        /// -or-<br></br>
        /// <paramref name="dvtkDataTag"/> is not valid for setting a FileMetaInformation attribute.<br></br>
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="values"/> is a null reference.
        /// </exception>
        public override void Set(String tagSequence, VR vR, Values values)
        {
            TagSequence internalTagSequence = new TagSequence(tagSequence);

            //
            // Sanity checks.
            //

            if (!internalTagSequence.IsSingleAttributeMatching)
            {
                throw new ArgumentException(internalTagSequence.ToString() + " not valid for setting an attribute.");
            }

            // Check if the tag supplied is valid for a FileMetaInformation.
            if (!internalTagSequence.IsValidForFileMetaInformation)
            {
                throw new ArgumentException(internalTagSequence.ToString() + " not valid for setting a FileMetaInformation attribute.", "dvtkDataTag");
            }

            if (values == null)
            {
                throw new ArgumentNullException("values");
            }

            //
            // Perform the actual operation.
            //

            Set(internalTagSequence, vR, values);

            if ((internalTagSequence.ToString() == "0x00020010") && (values.Count == 1))
            {
                this.dvtkDataFileHead.TransferSyntax = new DvtkData.Dul.TransferSyntax(values[0]);
            }
        }
Example #34
0
        /// <summary>
        /// Add the attributes in this additional dataset to all Information Entities in the Information
        /// Models.
        /// </summary>
        /// <param name="overWriteExistingValue">Boolean to indicate whether any already existing value should be overwritten or not.</param>
        /// <param name="tagSequence">The tag sequence.</param>
        /// <param name="vR">The VR.</param>
        /// <param name="parameters">The value(s).</param>
        public void AddAdditionalAttributeToInformationModel(bool overWriteExistingValue, String tagSequence, VR vR, params Object[] parameters)
        {
            // need DicomMessage to be able to set the attribute in the dataset
            DicomMessage dicomMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.UNDEFINED);

            dicomMessage.Set(tagSequence, vR, parameters);
            _root.AddAdditionalAttributesToInformationModel(overWriteExistingValue, dicomMessage.DataSet.DvtkDataDataSet);
        }
Example #35
0
        /// <summary>
        /// Removed all non-significant characters, as defined by the specified VR.
        /// </summary>
        /// <param name="stringToTrim">
        /// The string from which to remove the non-significant characters.
        /// </param>
        /// <param name="vr">The VR to take into account.</param>
        /// <returns>The trimmed String.</returns>
        public static string ToTrimmedString(string stringToTrim, VR vr)
        {
            string trimmedString = null;

            switch (vr)
            {
                case VR.SH:
                case VR.LO:
                    trimmedString = stringToTrim.Trim();
                    break;

                default:

                    // TODO: still to implement for other VR's.
                    trimmedString = stringToTrim;
                    break;
            }

            return (trimmedString);
        }
 public OutboundMessageFilterSetAttribute(String tag, VR vR, params Object[] values)
 {
     this.parameters = new ArrayList(values);
     this.parameters.Insert(0, vR);
     this.parameters.Insert(0, tag);
 }
        //
        // - Constructors -
        //

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="tag">The tag of the attribute to set.</param>
        /// <param name="vr">The VR of the attribute to set.</param>
        /// <param name="values">The values of the attribute to set.</param>
        public OutboundDicomMessageFilterSetAttribute(String tag, VR vr, params Object[] values)
        {
            this.tagSequence = tag;
            this.vR          = vr;
            this.values      = new ArrayList(values);
        }
Example #38
0
        /// <summary>
        /// Removes non significant spaces according to the Dicom standard.
        /// </summary>
        /// <remarks>
        /// In part 5 of the Dicom standard, for specific VR's leading and/or traling spaces are non significant.
        /// This methods returns a String in which the non significant spaces have been removed.
        /// Also for VR DA and DT, traling spaces are removed because they may be present in C-Find queries.
        /// </remarks>
        /// <param name="theString">The String to (possibly) remove the spaces from.</param>
        /// <param name="vR">The VR of the associated Attribute.</param>
        /// <returns>The String with the non significant spaces removed.</returns>
        private static String RemoveNonSignificantSpaces(String theString, VR vR)
        {
            bool removeLeadingSpaces = false;
            bool removeTrailingSpaces = false;

            switch (vR)
            {
                case VR.AE:
                case VR.CS:
                case VR.DS:
                case VR.IS:
                case VR.LO:
                case VR.SH:
                    removeLeadingSpaces = true;
                    removeTrailingSpaces = true;
                    break;

                case VR.LT:
                case VR.PN:
                case VR.ST:
                case VR.TM:
                case VR.UT:
                    removeTrailingSpaces = true;
                    break;

                // For the VR's below, nothing is mentioned about non significant spaces in part 5.
                // In queries however, when using range matching, spaces may be appended at the end to make
                // it an even amount of characters. For this reason, the traling spaces are also removed for
                // these VR's.
                case VR.DA:
                case VR.DT:
                    removeTrailingSpaces = true;
                    break;
            }

            // If removeLeadingSpaces is true, remove all leading spaces.
            if (removeLeadingSpaces)
            {
                bool continueRemoving = true;

                while (continueRemoving)
                {
                    if (theString.Length > 0)
                    {
                        if (theString[0] == ' ')
                        {
                            // Remove the first space of this string.
                            theString = theString.Substring(1);
                        }
                        else
                        {
                            continueRemoving = false;
                        }
                    }
                    else
                    {
                        continueRemoving = false;
                    }
                }
            }

            // If removeTrailingSpaces is true, remove all trailing spaces.
            if (removeTrailingSpaces)
            {
                bool continueRemoving = true;

                while (continueRemoving)
                {
                    if (theString.Length > 0)
                    {
                        if (theString[theString.Length - 1] == ' ')
                        {
                            // Remove the last space of this string.
                            theString = theString.Substring(0, theString.Length - 1);
                        }
                        else
                        {
                            continueRemoving = false;
                        }
                    }
                    else
                    {
                        continueRemoving = false;
                    }
                }
            }

            return (theString);
        }
Example #39
0
 /// <summary>
 /// See comments for this overridden method in the classes CommandSet, DataSet, SequenceItem and FileMetaInformation.
 /// </summary>
 /// <param name="dvtkDataTag">-</param>
 /// <param name="vR">-</param>
 /// <param name="value">-</param>
 public abstract void Set(DvtkData.Dimse.Tag dvtkDataTag, VR vR, Byte[] value);
Example #40
0
 /// <summary>
 /// See comments for this overridden method in the classes CommandSet, DataSet, SequenceItem and FileMetaInformation.
 /// </summary>
 /// <param name="dvtkDataTag">-</param>
 /// <param name="vR">-</param>
 /// <param name="values">-</param>
 public abstract void Set(DvtkData.Dimse.Tag dvtkDataTag, VR vR, params Object[] values);
Example #41
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="tagSequence">The tag sequence.</param>
 /// <param name="vR">The VR.</param>
 /// <param name="values">The values.</param>
 public InboundDicomMessageFilterSetAttribute(String tagSequence, VR vR, params Object[] values)
 {
     this.tagSequence = tagSequence;
     this.vR          = vR;
     this.values      = new ArrayList(values);
 }
Example #42
0
        /// <summary>
        /// Adds a single attribute with the tag, VR and value specified.
        /// </summary>
        /// <remarks>
        /// Only use this method for setting an attribute with VR OB, OF or OW.
        /// <br></br><br></br>
        /// If an attribute already exists with this tag, it is removed first before it is again
        /// added.
        /// </remarks>
        /// <param name="dvtkDataTag">The tag of the attribute.</param>
        /// <param name="vR">The VR (may only be OB, OF or OW) of the attribute.</param>
        /// <param name="value">The value of the attribute.</param>
        /// <exception cref="System.ArgumentException">
        /// <paramref name="dvtkDataTag"/> is not valid for setting a CommandSet attribute.<br></br>
        /// -or-<br></br>
        /// <paramref name="vR"/> is unequal to OB, OF or OW.
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="value"/> is a null reference.
        /// </exception>
        public override void Set(DvtkData.Dimse.Tag dvtkDataTag, VR vR, Byte[] value)
        {
            TagSequence internalTagSequence = new TagSequence();

            internalTagSequence.Add(new Tag(dvtkDataTag.GroupNumber, dvtkDataTag.ElementNumber));

            //
            // Sanity checks.
            //

            // Check if the tag supplied is valid for a CommandSet.
            if (!internalTagSequence.IsValidForCommandSet)
            {
                throw new ArgumentException(internalTagSequence.ToString() + " is not valid for setting a CommandSet attribute.", "dvtkDataTag");
            }

            // Check the supplied VR.

            if ((vR != VR.OB) && (vR != VR.OF) && (vR != VR.OW))
            {
                throw new ArgumentException("Supplied VR is " + vR.ToString() + ". VR may only be OB, OF or OW.", "vR");
            }

            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            //
            // Perform the actual operation in the base class.
            //

            Set(internalTagSequence, vR, value);
        }
        /// <summary>
        /// Add the attributes in this additional dataset to all Information Entities in the Information
        /// Models.
        /// </summary>
        /// <param name="overWriteExistingValue">Boolean to indicate whether any already existing value should be overwritten or not.</param>
        /// <param name="tagSequence">The tag sequence.</param>
        /// <param name="vR">The VR.</param>
        /// <param name="parameters">The values.</param>
        public void AddAdditionalAttribute(bool overWriteExistingValue, String tagSequence, VR vR, params Object[] parameters)
        {
            // add additional attributes to the information models

            _patientRootInformationModel.AddAdditionalAttributeToInformationModel(overWriteExistingValue, tagSequence, vR, parameters);
            _studyRootInformationModel.AddAdditionalAttributeToInformationModel(overWriteExistingValue, tagSequence, vR, parameters);
            _patientStudyOnlyInformationModel.AddAdditionalAttributeToInformationModel(overWriteExistingValue, tagSequence, vR, parameters);
        }
Example #44
0
        /// <summary>
        /// Adds a single attribute with the tag, VR and values specified.
        /// </summary>
        /// <remarks>
        /// Depending on the group number of the tag, the attribute
        /// is set in the CommandSet or DataSet of this instance.
        /// <br></br><br></br>
        /// If an attribute already exists with this tag, it is removed first before it is 
        /// again set.
        /// </remarks>
        /// <param name="dvtkDataTag">The tag that uniquely identifies the attribute.</param>
        /// <param name="vR">The VR of the attribute.</param>
        /// <param name="parameters">
        /// The values of the attribute. Do not use the DICOM delimeter '\' directly. Instead use
        /// multiple parameter arguments for this method when adding a single attribute with multiple values.
        /// </param>
        public void Set(DvtkData.Dimse.Tag dvtkDataTag, VR vR, params Object[] parameters)
        {
            TagSequence tagSequence = new TagSequence();

            tagSequence.Add(new Tag(dvtkDataTag.GroupNumber, dvtkDataTag.ElementNumber));

            Set(tagSequence, vR, parameters);
        }