示例#1
0
 internal CommandSet(DvtkData.Dimse.CommandSet dvtkDataCommandSet)
     : base(dvtkDataCommandSet)
 {
     if (dvtkDataCommandSet == null)
     {
         DvtkHighLevelInterfaceException.Throw("Parameter may not be null/Nothing.");
     }
 }
 /// <summary>
 /// Constructor that initialized this instance with a DvtkData AcceptedPresentationContextList.
 /// </summary>
 /// <param name="dvtkDataAcceptedPresentationContextList">The DvtkData AcceptedPresentationContextList.</param>
 internal PresentationContextCollection(DvtkData.Dul.AcceptedPresentationContextList dvtkDataAcceptedPresentationContextList)
 {
     foreach (DvtkData.Dul.AcceptedPresentationContext dvtkDataAcceptedPresentationContext in dvtkDataAcceptedPresentationContextList)
     {
         PresentationContext presentationContext = new PresentationContext(dvtkDataAcceptedPresentationContext);
         Add(presentationContext);
     }
 }
示例#3
0
 /// <summary>
 /// Constructor. Encapsulates a DvtkData.Dimse.CommandSet instance.
 /// </summary>
 /// <param name="dvtkDataCommandSet">The DvtkData.Dimse.CommandSet instance to encapsulate.</param>
 internal CommandSet(DvtkData.Dimse.CommandSet dvtkDataCommandSet)
     : base(dvtkDataCommandSet)
 {
     if (dvtkDataCommandSet == null)
     {
         throw new HliException("Parameter may not be null/Nothing.");
     }
 }
示例#4
0
 internal FileMetaInformation(DvtkData.Dimse.AttributeSet dvtkDataAttributeSet)
     : base(dvtkDataAttributeSet)
 {
     if (dvtkDataAttributeSet == null)
     {
         DvtkHighLevelInterfaceException.Throw("Parameter may not be null/Nothing.");
     }
 }
示例#5
0
        /// <summary>
        /// Class constructor.
        /// </summary>
        /// <param name="parentSequenceTag">Parent Sequence Tag</param>
        /// <param name="tag">Comparison Tag</param>
        /// <param name="commonDataFormat">Data Format for Tag</param>
        public DicomComparisonTag(DvtkData.Dimse.Tag parentSequenceTag, 
									DvtkData.Dimse.Tag tag, 
									BaseCommonDataFormat commonDataFormat)
        {
            _parentSequenceTag = parentSequenceTag;
            _tag = tag;
            _commonDataFormat = commonDataFormat;
        }
示例#6
0
        /// <summary>
        /// Compare two pixel attributes (i.e. attributes that have VR OB, OF or OW).
        /// </summary>
        /// <param name="attribute1">The first attribute.</param>
        /// <param name="attribute2">The second attribute.</param>
        /// <returns>Indicates if the two are equal or not.</returns>
        public static bool ComparePixelAttributes(
			DvtkData.Dimse.Attribute attribute1, 
			DvtkData.Dimse.Attribute attribute2)
        {
            bool equal = true;

            equal = MAttributeUtilities.ComparePixelAttributes(attribute1, attribute2);

            return(equal);
        }
示例#7
0
        public System.String GetValue(DvtkData.Dimse.Tag sequenceTag, DvtkData.Dimse.Tag tag)
        {
            System.String lValue = System.String.Empty;

            if (_dicomMessage != null)
            {
                lValue = GenerateTriggers.GetValueFromMessageUsingTag(_dicomMessage, sequenceTag, tag);

            }

            return lValue;
        }
示例#8
0
文件: Attribute.cs 项目: ewcasas/DVTK
        //
        // - Constructors -
        //
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="tagSequence">The tag sequence (one or more tags seperated with an '/') of this attribue.</param>
        /// <param name="attribute">
        /// The encapsulated Attribute from the DvtkData librbary.
        /// May not be null.
        /// </param>
        public Attribute(String tagSequence, DvtkData.Dimse.Attribute dvtkDataAttribute)
        {
            this.tagSequence = tagSequence;

            if (dvtkDataAttribute == null)
            {
                // Sanity check.
                DvtkHighLevelInterfaceException.Throw("Parameter may not be null.");
            }
            else
            {
                this.dvtkDataAttribute = dvtkDataAttribute;
            }
        }
示例#9
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="tagSequence">The tag sequence of the attribute.</param>
        /// <param name="dvtkDataAttribute">The encapsulated DvtkData attribute.</param>
        /// <param name="parentAttributeSet">The AttributeSet this instance is part of.</param>
        public ValidAttribute(TagSequence tagSequence, DvtkData.Dimse.Attribute dvtkDataAttribute, AttributeSet parentAttributeSet)
        {
            // Sanity check.
            if (dvtkDataAttribute == null)
            {
                throw new ArgumentException("Internal error: dvtkDataAttribute may not be null.");
            }

            // Sanity check.
            if (parentAttributeSet == null)
            {
                throw new ArgumentException("Internal error: parentAttributeSet may not be null.");
            }

            TagSequence = tagSequence;
            this.dvtkDataAttribute = dvtkDataAttribute;
            this.parentAttributeSet = parentAttributeSet;
        }
示例#10
0
        /// <summary>
        /// Constructor.
        /// 
        /// Use this constructor to construct the command set and data set based on the 
        /// command set and data set contained in the encapsulated DvtkData DicomMessage.
        /// </summary>
        /// <param name="dvtkDataDicomMessage">The encapsulated DvtkData DicomMessage.</param>
        internal DicomMessage(DvtkData.Dimse.DicomMessage dvtkDataDicomMessage)
        {
            // Sanity check.
            if (dvtkDataDicomMessage == null)
            {
                DvtkHighLevelInterfaceException.Throw("Parameter may not be null.");
            }

            // Create the CommandSet object.
            this.commandSet = new CommandSet(dvtkDataDicomMessage.CommandSet);

            // Create the DataSet object.
            if (dvtkDataDicomMessage.DataSet == null)
            {
                this.dataSet = new DataSet();
            }
            else
            {
                this.dataSet = new DataSet(dvtkDataDicomMessage.DataSet);
            }
        }
示例#11
0
        /// <summary>
        /// Initialize the DicomComparator
        /// </summary>
        /// <param name="dicomMessage"></param>
        /// <returns></returns>
        /// <returns>bool - true = template initialized, false template not initialized</returns>
        public bool Initialize(DvtkData.Dimse.DicomMessage dicomMessage)
        {
            DvtkData.Dimse.DimseCommand command = dicomMessage.CommandField;
            System.String sopClassUid = System.String.Empty;

            DvtkData.Dimse.Attribute attribute = dicomMessage.CommandSet.GetAttribute(DvtkData.Dimse.Tag.AFFECTED_SOP_CLASS_UID);
            if (attribute == null)
            {
                attribute = dicomMessage.CommandSet.GetAttribute(DvtkData.Dimse.Tag.REQUESTED_SOP_CLASS_UID);
            }
            if ((attribute != null) &&
                (attribute.Length != 0))
            {
                UniqueIdentifier uniqueIdentifier = (UniqueIdentifier)attribute.DicomValue;
                sopClassUid = uniqueIdentifier.Values[0];
            }

            // Try to initialise a template
            _template = new DicomComparisonTemplate();
            bool initialized = _template.Initialize(command, sopClassUid);
            if (initialized == true)
            {
                // Load the template with the corresponding attribute values
                initialized = LoadTemplate(dicomMessage.DataSet);
            }

            return initialized;
        }
示例#12
0
文件: ReleaseRq.cs 项目: ewcasas/DVTK
 //
 // - Constructors -
 //
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="dvtkDataReleaseRq">The encapsulated DvtkData A_RELEASE_RQ</param>
 public ReleaseRq(DvtkData.Dul.A_RELEASE_RQ dvtkDataReleaseRq)
     : base(dvtkDataReleaseRq)
 {
 }
示例#13
0
 /// <summary>
 /// Class constructor.
 /// </summary>
 /// <param name="tag">Comparison Tag</param>
 /// <param name="vr">Tag VR.</param>
 /// <param name="commonDataFormat">Data Format for Tag</param>
 public DicomComparisonTag(DvtkData.Dimse.Tag tag, VR vr, BaseCommonDataFormat commonDataFormat)
 {
     _tag = tag;
     _vr = vr;
     _commonDataFormat = commonDataFormat;
 }
示例#14
0
 /// <summary>
 /// Constructor to encapsulate an existing DvtkData A_ASSOCIATE_AC.
 /// </summary>
 /// <param name="dvtkDataAssociateAc">The encapsulated DvtkData A_ASSOCIATE_AC</param>
 internal AssociateAc(DvtkData.Dul.A_ASSOCIATE_AC dvtkDataAssociateAc)
     : base(dvtkDataAssociateAc)
 {
     // Do nothing.
 }
示例#15
0
 //
 // - Constructors -
 //        
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="dvtkDataDulMessage">The encapsulated DvtkData DulMessage.</param>
 internal DulMessage(DvtkData.Dul.DulMessage dvtkDataDulMessage)
 {
     this.dvtkDataDulMessage = dvtkDataDulMessage;
 }
示例#16
0
 private static void AddEntry(DvtkData.Dimse.Tag parent1Tag, DvtkData.Dimse.Tag parent2Tag, DvtkData.Dimse.Tag tag, System.String segment, int fieldIndex, int componentIndex, System.String name, BaseValueConvertor valueConvertor)
 {
     _dicomHl7TagMapCollection.Add(new DicomHl7TagMap(new DicomTagPath(parent1Tag, parent2Tag, tag),
         new Hl7TagPath(new Hl7Tag(segment, fieldIndex), componentIndex, name), valueConvertor));
 }
示例#17
0
        /// <summary>
        /// Class constructor.
        /// </summary>
        /// <param name="command">DIMSE Command ID</param>
        /// <param name="sopClassUid">SOP Class UID</param>
        /// <returns>bool - true = template initialized, false template not initialized</returns>
        public bool Initialize(DvtkData.Dimse.DimseCommand command, System.String sopClassUid)
        {
            bool initialized = true;
            _command = command;
            _sopClassUid = sopClassUid;

            // Only certain templates available
            // Use command and sopClassUid to determine if we can set one up
            if ((command == DvtkData.Dimse.DimseCommand.CFINDRSP) &&
                (sopClassUid == DvtkData.Dul.AbstractSyntax.Modality_Worklist_Information_Model_FIND.UID))
            {
                // Add the comparison tags - these tags will be used to extract the values out of the
                // Dicom Dataset for comparison with other Datasets containing the same tags
                _comparisonTags.Add(new DicomComparisonTag(Tag.SPECIFIC_CHARACTER_SET, VR.CS, new CommonStringFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.ACCESSION_NUMBER, VR.SH, new CommonIdFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.SCHEDULED_PROCEDURE_STEP_SEQUENCE, Tag.MODALITY, VR.CS, new CommonStringFormat()));
            //				_comparisonTags.Add(new DicomComparisonTag(Tag.REFERENCED_STUDY_SEQUENCE, VR.SQ, new CommonUidFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.PATIENTS_NAME, VR.PN, new CommonNameFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.PATIENT_ID, VR.LO, new CommonIdFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.PATIENTS_BIRTH_DATE, VR.DA, new CommonDateFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.PATIENTS_SEX, VR.CS, new CommonStringFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.STUDY_INSTANCE_UID, VR.UI, new CommonUidFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.REQUESTED_PROCEDURE_ID, VR.SH, new CommonIdFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.SCHEDULED_PROCEDURE_STEP_SEQUENCE, Tag.SCHEDULED_PROCEDURE_STEP_ID, VR.SH, new CommonIdFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.REQUESTED_PROCEDURE_DESCRIPTION, VR.LO, new CommonStringFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.SCHEDULED_PROCEDURE_STEP_SEQUENCE, Tag.SCHEDULED_PROCEDURE_STEP_DESCRIPTION, VR.LO, new CommonStringFormat()));
            }
            else if (command == DvtkData.Dimse.DimseCommand.CSTORERQ)
            {
                // Add the comparison tags - these tags will be used to extract the values out of the
                // Dicom Dataset for comparison with other Datasets containing the same tags
                _comparisonTags.Add(new DicomComparisonTag(Tag.SPECIFIC_CHARACTER_SET, VR.CS, new CommonStringFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.ACCESSION_NUMBER, VR.SH, new CommonIdFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.MODALITY, VR.CS, new CommonStringFormat()));
            //				_comparisonTags.Add(new DicomComparisonTag(Tag.REFERENCED_STUDY_SEQUENCE, VR.SQ, new CommonUidFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.PATIENTS_NAME, VR.PN, new CommonNameFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.PATIENT_ID, VR.LO, new CommonIdFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.PATIENTS_BIRTH_DATE, VR.DA, new CommonDateFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.PATIENTS_SEX, VR.CS, new CommonStringFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.STUDY_INSTANCE_UID, VR.UI, new CommonUidFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.REQUEST_ATTRIBUTES_SEQUENCE, Tag.REQUESTED_PROCEDURE_ID, VR.SH, new CommonIdFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.REQUEST_ATTRIBUTES_SEQUENCE, Tag.SCHEDULED_PROCEDURE_STEP_ID, VR.SH, new CommonIdFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.REQUEST_ATTRIBUTES_SEQUENCE, Tag.SCHEDULED_PROCEDURE_STEP_DESCRIPTION, VR.LO, new CommonStringFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.PERFORMED_PROCEDURE_STEP_ID, VR.SH, new CommonIdFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.PERFORMED_PROCEDURE_STEP_DESCRIPTION, VR.LO, new CommonStringFormat()));
            }
            else if ((command == DvtkData.Dimse.DimseCommand.NCREATERQ) &&
                (sopClassUid == DvtkData.Dul.AbstractSyntax.Modality_Performed_Procedure_Step.UID))
            {
                // Add the comparison tags - these tags will be used to extract the values out of the
                // Dicom Dataset for comparison with other Datasets containing the same tags
                _comparisonTags.Add(new DicomComparisonTag(Tag.SPECIFIC_CHARACTER_SET, VR.CS, new CommonStringFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.SCHEDULED_STEP_ATTRIBUTES_SEQUENCE, Tag.ACCESSION_NUMBER, VR.SH, new CommonIdFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.MODALITY, VR.CS, new CommonStringFormat()));
            //				_comparisonTags.Add(new DicomComparisonTag(Tag.SCHEDULED_STEP_ATTRIBUTES_SEQUENCE, Tag.REFERENCED_STUDY_SEQUENCE, VR.SQ, new CommonUidFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.PATIENTS_NAME, VR.PN, new CommonNameFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.PATIENT_ID, VR.LO, new CommonIdFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.PATIENTS_BIRTH_DATE, VR.DA, new CommonDateFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.PATIENTS_SEX, VR.CS, new CommonStringFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.SCHEDULED_STEP_ATTRIBUTES_SEQUENCE, Tag.STUDY_INSTANCE_UID, VR.UI, new CommonUidFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.SCHEDULED_STEP_ATTRIBUTES_SEQUENCE, Tag.REQUESTED_PROCEDURE_ID, VR.SH, new CommonIdFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.SCHEDULED_STEP_ATTRIBUTES_SEQUENCE, Tag.SCHEDULED_PROCEDURE_STEP_ID, VR.SH, new CommonIdFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.SCHEDULED_STEP_ATTRIBUTES_SEQUENCE, Tag.REQUESTED_PROCEDURE_DESCRIPTION, VR.LO, new CommonStringFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.SCHEDULED_STEP_ATTRIBUTES_SEQUENCE, Tag.SCHEDULED_PROCEDURE_STEP_DESCRIPTION, VR.LO, new CommonStringFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.PERFORMED_PROCEDURE_STEP_ID, VR.SH, new CommonIdFormat()));
                _comparisonTags.Add(new DicomComparisonTag(Tag.PERFORMED_PROCEDURE_STEP_DESCRIPTION, VR.LO, new CommonStringFormat()));
            }
            else
            {
                initialized = false;
            }

            return initialized;
        }
示例#18
0
        private System.String GetAttributeValue(DvtkData.Dimse.Attribute attribute)
        {
            System.String attributeValue = System.String.Empty;
            if ((attribute == null) ||
                (attribute.Length == 0))
            {
                return attributeValue;
            }

            switch(attribute.ValueRepresentation)
            {
                case VR.AE:
                {
                    ApplicationEntity applicationEntity = (ApplicationEntity)attribute.DicomValue;
                    attributeValue = applicationEntity.Values[0];
                    break;
                }
                case VR.AS:
                {
                    AgeString ageString = (AgeString)attribute.DicomValue;
                    attributeValue = ageString.Values[0];
                    break;
                }
                case VR.CS:
                {
                    CodeString codeString = (CodeString)attribute.DicomValue;

                    // Temp solution for more than one value
                    for (int i = 0; i < codeString.Values.Count; i++)
                    {
                        attributeValue += (codeString.Values[i]);
                        if ((i+1) < codeString.Values.Count)
                        {
                            attributeValue += "\\";
                        }
                    }

                    break;
                }
                case VR.DA:
                {
                    Date date = (Date)attribute.DicomValue;
                    attributeValue = date.Values[0];
                    break;
                }
                case VR.DS:
                {
                    DecimalString decimalString = (DecimalString)attribute.DicomValue;
                    attributeValue = decimalString.Values[0];
                    break;
                }
                case VR.DT:
                {
                    DvtkData.Dimse.DateTime dateTime = (DvtkData.Dimse.DateTime)attribute.DicomValue;
                    attributeValue = dateTime.Values[0];
                    break;
                }
                case VR.IS:
                {
                    IntegerString integerString = (IntegerString)attribute.DicomValue;
                    attributeValue = integerString.Values[0];
                    break;
                }
                case VR.LO:
                {
                    LongString longString = (LongString)attribute.DicomValue;
                    attributeValue = longString.Values[0];
                    break;
                }
                case VR.LT:
                {
                    LongText longText = (LongText)attribute.DicomValue;
                    attributeValue = longText.Value;
                    break;
                }
                case VR.PN:
                {
                    PersonName personName = (PersonName)attribute.DicomValue;
                    attributeValue = personName.Values[0];
                    break;
                }
                case VR.SH:
                {
                    ShortString shortString = (ShortString)attribute.DicomValue;
                    attributeValue = shortString.Values[0];
                    break;
                }
                case VR.SQ:
                {
                    // Special case looking for the SOP Class UID
                    SequenceOfItems sequenceOfItems = (SequenceOfItems)attribute.DicomValue;
                    if ((sequenceOfItems != null) &&
                        (sequenceOfItems.Sequence.Count == 1))
                    {
                        // Special case looking for the SOP Class UID
                        SequenceItem item = sequenceOfItems.Sequence[0];
                        attribute = item.GetAttribute(new Tag(0x0008, 0x1150));
                        attributeValue = GetAttributeValue(attribute);
                    }
                    break;
                }
                case VR.ST:
                {
                    ShortText shortText = (ShortText)attribute.DicomValue;
                    attributeValue = shortText.Value;
                    break;
                }
                case VR.TM:
                {
                    Time time = (Time)attribute.DicomValue;
                    attributeValue = time.Values[0];
                    break;
                }
                case VR.UI:
                {
                    UniqueIdentifier uniqueIdentifier = (UniqueIdentifier)attribute.DicomValue;
                    attributeValue = uniqueIdentifier.Values[0];
                    break;
                }
                default:
                    break;
            }

            return attributeValue;
        }
示例#19
0
        /// <summary>
        /// Initialize the DicomComparator
        /// </summary>
        /// <param name="dicomMessage"></param>
        /// <returns>bool - true = template initialized, false template not initialized</returns>
        public bool Initialize(DvtkData.Dimse.DicomMessage dicomMessage)
        {
            // Set up the comparator using the templates
            bool setUpOk = SetUp(dicomMessage);
            if (setUpOk == true)
            {
                // Load the template with the corresponding attribute values
                setUpOk = LoadTemplate(dicomMessage.DataSet);
            }

            return setUpOk;
        }
示例#20
0
        public bool SetUp(DvtkData.Dimse.DicomMessage dicomMessage)
        {
            DvtkData.Dimse.DimseCommand command = dicomMessage.CommandField;
            System.String sopClassUid = System.String.Empty;

            // To be fixed - why is the SOP Class UID not always filled in?
            // RB: TODO
            if (command == DvtkData.Dimse.DimseCommand.CSTORERQ)
            {
                sopClassUid = "1.2.840.10008.5.1.4.1.1.7";
            }

            DvtkData.Dimse.Attribute attribute = dicomMessage.CommandSet.GetAttribute(DvtkData.Dimse.Tag.AFFECTED_SOP_CLASS_UID);
            if (attribute == null)
            {
                attribute = dicomMessage.CommandSet.GetAttribute(DvtkData.Dimse.Tag.REQUESTED_SOP_CLASS_UID);
            }
            if ((attribute != null) &&
                (attribute.Length != 0))
            {
                UniqueIdentifier uniqueIdentifier = (UniqueIdentifier)attribute.DicomValue;
                sopClassUid = uniqueIdentifier.Values[0];
            }

            // Try to initialise a template
            _template = new DicomComparisonTemplate();
            bool setUpDone = _template.Initialize(command, sopClassUid);

            return setUpDone;
        }
示例#21
0
        /// <summary>
        /// Return the DicomMessages from this collection that have the specified DimseCommand.
        /// </summary>
        /// <param name="dimseCommand">the DimseCommand.</param>
        /// <returns>The DicomMessages with the specified DimseCommand.</returns>
        private DicomMessageCollection DicomMessagesForDimseCommand(DvtkData.Dimse.DimseCommand dimseCommand)
        {
            DicomMessageCollection dicomMessages = new DicomMessageCollection();

            foreach(DicomMessage dicomMessage in this)
            {
                if (dicomMessage.CommandSet.DimseCommand == dimseCommand)
                {
                    dicomMessages.Add(dicomMessage);
                }
            }

            return(dicomMessages);
        }
示例#22
0
文件: Abort.cs 项目: ewcasas/DVTK
 //
 // - Constructors -
 //
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="dvtkDataAbort">The encapsulated DvtkData A_ABORT.</param>
 internal Abort(DvtkData.Dul.A_ABORT dvtkDataAbort)
     : base(dvtkDataAbort)
 {
 }
示例#23
0
 /// <summary>
 /// Constructor. Use this to encapsulate an existing DvtkData sequence attribute.
 /// </summary>
 /// <param name="tagSequence">The tag sequence (one or more tags seperated with an '/') of this attribue.</param>
 /// <param name="dvtkDataAttribute">The encapsulated DvtkData attribute</param>
 /// 
 public SequenceAttribute(String tagSequence, DvtkData.Dimse.Attribute dvtkDataAttribute)
     : base(tagSequence, dvtkDataAttribute)
 {
 }
示例#24
0
        private bool ProcessRetrieveList(System.String moveDestinationAE, DvtkData.Collections.StringCollection retrieveList)
        {
            UInt16 status = 0x0000;
            UInt16 remainingSubOperations = (UInt16)retrieveList.Count;
            UInt16 completeSubOperations = 0;
            UInt16 failedSubOperations = 0;
            UInt16 warningSubOperations = 0;
            int subOperationIndex = 0;
            bool isCancelRecd = false;

            foreach (System.String dcmFilename in retrieveList)
            {
                status = 0xFF00;
                SendCMoveRsp(status,
                    remainingSubOperations,
                    completeSubOperations,
                    failedSubOperations,
                    warningSubOperations);

                if (HandleSubOperation(moveDestinationAE, dcmFilename, subOperationIndex) == true && cStoreStatusVal == 0x0000)
                {
                    completeSubOperations++;
                }

                else if (cStoreStatusVal == 0xB007 || cStoreStatusVal == 0xB000 || cStoreStatusVal == 0xB006)
                {
                    warningSubOperations += 1;
                }

                else
                {
                    failedSubOperations++;
                }

                remainingSubOperations--;
                subOperationIndex++;

                int waitedTime = 0;

                // Check for cancel message from SCU
                if (WaitForPendingDataInNetworkInputBuffer(100, ref waitedTime))
                {
                    DicomMessage cancelRq = ReceiveDicomMessage();

                    if (cancelRq.CommandSet.DimseCommand == DvtkData.Dimse.DimseCommand.CCANCELRQ)
                    {
                        // set up the C-FIND-RSP with cancel status
                        DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CMOVERSP);
                        responseMessage.Set("0x00000900", DvtkData.Dimse.VR.US, 0xFE00);

                        // send the response
                        this.Send(responseMessage);

                        isCancelRecd = true;
                        break;
                    }
                }
            }

            if (!isCancelRecd)
            {
                if ((failedSubOperations > 0) || (warningSubOperations > 0))
                {
                    status = 0xB000;
                }
                //else if ((failedSubOperations == 0) && (completeSubOperations==0) && (remainingSubOperations==0) &&(warningSubOperations==0))
                //{
                //    status = 0xA702;
                //}
                else
                {
                    status = 0x0000;
                }
                SendCMoveRsp(status,
                    remainingSubOperations,
                    completeSubOperations,
                    failedSubOperations,
                    warningSubOperations);
            }

            // message handled
            return true;
        }
示例#25
0
        public bool PopulateMessage(DvtkData.Dimse.DicomMessage dicomMessage, DicomComparator sourceComparator)
        {
            // Check for comparator equality
            if (this == sourceComparator)
            {
                return false;
            }

            // Set up the comparator using the templates
            bool setUpOk = SetUp(dicomMessage);
            if (setUpOk == true)
            {
                // Copy the source comparator values into the dicom message if the tags are in this comparator
                setUpOk = CopyToDicomMessage(dicomMessage, sourceComparator);
            }

            return setUpOk;
        }
示例#26
0
 /// <summary>
 /// Constructor. Use this to encapsulate an existing DvtkData sequence item.
 /// </summary>
 /// <param name="dvtkDataSequenceItem"></param>
 internal SequenceItem(DvtkData.Dimse.SequenceItem dvtkDataSequenceItem)
     : base(dvtkDataSequenceItem)
 {
 }
示例#27
0
        private bool CopyToDicomMessage(DvtkData.Dimse.DicomMessage dicomMessage, DicomComparator sourceComparator)
        {
            bool messagePopulated = true;

            // Check if both templates have been initialized correctly
            if ((this.Template == null) ||
                (sourceComparator.Template == null))
            {
                return false;
            }

            // Iterate over this comparator
            foreach (DicomComparisonTag thisComparisonTag in this.Template.ComparisonTags)
            {
                // try to get the equivalent tag in the sourceComparator
                DicomComparisonTag sourceComparisonTag = sourceComparator.Template.ComparisonTags.Find(thisComparisonTag.Tag);
                if (sourceComparisonTag != null)
                {
                    System.String stringValue = sourceComparisonTag.DataFormat.ToDicomFormat();
                    DvtkData.Dimse.DataSet dataset = dicomMessage.DataSet;
                    if (dataset != null)
                    {
                        // we need to see if the parent sequence has been set up in the dataset
                        if (thisComparisonTag.ParentSequenceTag != Tag.UNDEFINED)
                        {
                            // set up the parent sequence and add it to the dataset
                            SequenceOfItems sequenceOfItems = null;
                            DvtkData.Dimse.Attribute sequenceAttribute = dataset.GetAttribute(thisComparisonTag.ParentSequenceTag);
                            if (sequenceAttribute == null)
                            {
                                // add in an empty item
                                DvtkData.Dimse.SequenceItem item = new SequenceItem();
                                dataset.AddAttribute(thisComparisonTag.ParentSequenceTag.GroupNumber,
                                    thisComparisonTag.ParentSequenceTag.ElementNumber,
                                    VR.SQ,
                                    item);
                                sequenceAttribute = dataset.GetAttribute(thisComparisonTag.ParentSequenceTag);
                            }

                            // get the sequence item and add in the required attribute
                            sequenceOfItems = (SequenceOfItems)sequenceAttribute.DicomValue;
                            if (sequenceOfItems.Sequence.Count == 1)
                            {
                                DvtkData.Dimse.SequenceItem item = sequenceOfItems.Sequence[0];
                                if (item != null)
                                {
                                    // add the attribute to the item
                                    if (sourceComparisonTag.Vr == VR.SQ)
                                    {
                                        // add in an empty item
                                        // TODO - fix this properly
                                        DvtkData.Dimse.SequenceItem item1 = new SequenceItem();
                                        item.AddAttribute(sourceComparisonTag.Tag.GroupNumber,
                                            sourceComparisonTag.Tag.ElementNumber,
                                            VR.SQ,
                                            item1);
                                    }
                                    else
                                    {
                                        // if the attribute already exists - then we need to remove it
                                        // - it was probably set to the default value
                                        DvtkData.Dimse.Attribute attribute = item.GetAttribute(sourceComparisonTag.Tag);
                                        if (attribute != null)
                                        {
                                            item.Remove(attribute);
                                        }

                                        // add the attribute to the item
                                        item.AddAttribute(sourceComparisonTag.Tag.GroupNumber,
                                            sourceComparisonTag.Tag.ElementNumber,
                                            sourceComparisonTag.Vr,
                                            stringValue);
                                    }
                                }
                            }
                        }
                        else
                        {
                            // if the attribute already exists - then we need to remove it
                            // - it was probably set to the default value
                            DvtkData.Dimse.Attribute attribute = dataset.GetAttribute(sourceComparisonTag.Tag);
                            if (attribute != null)
                            {
                                dataset.Remove(attribute);
                            }

                            // add the attribute at the top level
                            dataset.AddAttribute(sourceComparisonTag.Tag.GroupNumber,
                            sourceComparisonTag.Tag.ElementNumber,
                            sourceComparisonTag.Vr,
                            stringValue);
                        }
                    }
                }
            }

            return messagePopulated;
        }
示例#28
0
文件: Series.cs 项目: ewcasas/DVTK
 /// <summary>
 /// Class constructor with DICOM dataset as parameter.
 /// </summary>
 /// <param name="_dataSet">DICOM dataset which contains series attributes</param>
 public Series(DvtkData.Dimse.DataSet _dataSet)
     : base()
 {
     LoadData(_dataSet);
 }
示例#29
0
        private bool LoadTemplate(DvtkData.Dimse.DataSet dataset)
        {
            if (dataset == null) return false;

            // try to find the template tag in the dataset
            foreach (DicomComparisonTag comparisonTag in this.Template.ComparisonTags)
            {
                DvtkData.Dimse.Tag tag = comparisonTag.Tag;
                DvtkData.Dimse.Tag parentSequenceTag = comparisonTag.ParentSequenceTag;
                System.String attributeValue = System.String.Empty;

                if (parentSequenceTag != Tag.UNDEFINED)
                {
                    DvtkData.Dimse.Attribute sequenceAttribute = dataset.GetAttribute(parentSequenceTag);
                    if ((sequenceAttribute != null) &&
                        (sequenceAttribute.ValueRepresentation == DvtkData.Dimse.VR.SQ))
                    {
                        SequenceOfItems sequenceOfItems = (SequenceOfItems)sequenceAttribute.DicomValue;
                        if (sequenceOfItems.Sequence.Count == 1)
                        {
                            SequenceItem item = sequenceOfItems.Sequence[0];

                            if (item != null)
                            {
                                DvtkData.Dimse.Attribute attribute = item.GetAttribute(tag);
                                attributeValue = GetAttributeValue(attribute);
                            }
                        }
                    }
                }
                else
                {
                    DvtkData.Dimse.Attribute attribute = dataset.GetAttribute(tag);
                    attributeValue = GetAttributeValue(attribute);
                }

                if (attributeValue != System.String.Empty)
                {
                    comparisonTag.DataFormat.FromDicomFormat(attributeValue);
                }
            }

            return true;
        }
示例#30
0
文件: Series.cs 项目: ewcasas/DVTK
 protected override void LoadData(DvtkData.Dimse.DataSet _dataSet)
 {
     base.LoadData(_dataSet);
     InstanceNumber =BaseCompositeInformationEntity.GetDicomValue(_dataSet.GetAttribute(DvtkData.Dimse.Tag.SERIES_NUMBER));
     SeriesInstanceUID =BaseCompositeInformationEntity.GetDicomValue(_dataSet.GetAttribute(DvtkData.Dimse.Tag.SERIES_INSTANCE_UID));
 }