Example #1
0
File: Map.cs Project: ewcasas/DVTK
        // -------------------------------
        // - Begin public methods region -
        // -------------------------------
        /// <summary>
        /// Convert a HLI Attribute Set to a AttributeLayer Attribute Set.
        /// </summary>
        /// <param name="attributeSetIn">The HLI Attribute Set.</param>
        /// <param name="attributeSetOut">The AttributeLayer Attribute Set.</param>
        public static void ToAttributeSet(DvtkHighLevelInterface.Dicom.Other.AttributeSet attributeSetIn, Dvtk.Dicom.AttributeLayer.AttributeSet attributeSetOut)
        {
            for (int index = 0; index < attributeSetIn.Count; index++)
            {
                DvtkHighLevelInterface.Dicom.Other.Attribute hliAttribute = attributeSetIn[index];

                Tag tag = new Tag(hliAttribute.GroupNumber, hliAttribute.ElementNumber);

                if (hliAttribute.VR != DvtkData.Dimse.VR.SQ)
                {
                    SingleAttribute singleAttribute = new SingleAttribute(tag, (VR)Enum.Parse(typeof(VR), hliAttribute.VR.ToString(), true), attributeSetOut);
                }
                else
                {
                    SequenceAttribute sequenceAttribute = new SequenceAttribute(tag, attributeSetOut);

                    for (int sequenceItemIndex = 1; sequenceItemIndex <= hliAttribute.ItemCount; sequenceItemIndex++)
                    {
                        DvtkHighLevelInterface.Dicom.Other.SequenceItem hliSequenceItem = hliAttribute.GetItem(sequenceItemIndex);

                        SequenceItem sequenceItem = new SequenceItem(sequenceAttribute);

                        ToAttributeSet(hliSequenceItem, sequenceItem);
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// Generate an N-CREATE/N-SET MPPS IN-PROGRESS trigger from the default value manager.
        /// Use the given mppsInstanceUid.
        /// </summary>
        /// <param name="defaultValueManager">Default Value Manager.</param>
        /// <param name="mppsInProgressMessage">Mpps In-Progress message.</param>
        /// <param name="mppsInstanceUid">Mpps Instance UID.</param>
        public static void MakeMppsInProgress(Dvtk.Dicom.InformationEntity.DefaultValues.DefaultValueManager defaultValueManager,
			DvtkHighLevelInterface.Dicom.Messages.DicomMessage mppsInProgressMessage,
			System.String mppsInstanceUid)
        {
            if (mppsInProgressMessage.CommandSet.DimseCommand == DvtkData.Dimse.DimseCommand.NCREATERQ)
            {
                // Set Affected UIDs
                mppsInProgressMessage.Set("0x00000002", VR.UI, "1.2.840.10008.3.1.2.3.3");
                mppsInProgressMessage.Set("0x00001000", VR.UI, mppsInstanceUid);
            }
            else
            {
                // Set Requested UIDs
                mppsInProgressMessage.Set("0x00000003", VR.UI, "1.2.840.10008.3.1.2.3.3");
                mppsInProgressMessage.Set("0x00001001", VR.UI, mppsInstanceUid);
            }

            // Add the default values to the MppsInProgress message
            AddDefaultMppsInProgressValues(defaultValueManager, mppsInProgressMessage.DataSet.DvtkDataDataSet);
        }
Example #3
0
        /// <summary>
        /// Make a C-STORE instance.
        /// </summary>
        /// <param name="defaultValueManager">The default value manager.</param>
        /// <param name="storeInstanceMessage">The C-STORE message instance.</param>
        /// <param name="dataset">The dataset.</param>
        public static void MakeCStoreInstance(Dvtk.Dicom.InformationEntity.DefaultValues.DefaultValueManager defaultValueManager,
			DvtkHighLevelInterface.Dicom.Messages.DicomMessage storeInstanceMessage,
			DvtkData.Dimse.DataSet dataset)
        {
            // Add the dataset to the storage message
            storeInstanceMessage.DataSet.DvtkDataDataSet = dataset;

            // Update these dates (if present in the dataset)
            System.String dateNow = System.DateTime.Now.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
            UpdateValue(dateNow, DvtkData.Dimse.Tag.STUDY_DATE, VR.DA, dataset);
            UpdateValue(dateNow, DvtkData.Dimse.Tag.SERIES_DATE, VR.DA, dataset);
            UpdateValue(dateNow, DvtkData.Dimse.Tag.ACQUISITION_DATE, VR.DA, dataset);
            UpdateValue(dateNow, DvtkData.Dimse.Tag.IMAGE_DATE, VR.DA, dataset);
            UpdateValue(dateNow, DvtkData.Dimse.Tag.OVERLAY_DATE, VR.DA, dataset);
            UpdateValue(dateNow, DvtkData.Dimse.Tag.CURVE_DATE, VR.DA, dataset);
            UpdateValue(dateNow, DvtkData.Dimse.Tag.PERFORMED_PROCEDURE_STEP_START_DATE, VR.DA, dataset);

            // Update these times (if present in the dataset)
            System.String timeNow = System.DateTime.Now.ToString("HHmmss", System.Globalization.CultureInfo.InvariantCulture);
            UpdateValue(timeNow, DvtkData.Dimse.Tag.STUDY_TIME, VR.TM, dataset);
            UpdateValue(timeNow, DvtkData.Dimse.Tag.SERIES_TIME, VR.TM, dataset);
            UpdateValue(timeNow, DvtkData.Dimse.Tag.ACQUISITION_TIME, VR.TM, dataset);
            UpdateValue(timeNow, DvtkData.Dimse.Tag.IMAGE_TIME, VR.TM, dataset);
            UpdateValue(timeNow, DvtkData.Dimse.Tag.OVERLAY_TIME, VR.TM, dataset);
            UpdateValue(timeNow, DvtkData.Dimse.Tag.CURVE_TIME, VR.TM, dataset);
            UpdateValue(timeNow, DvtkData.Dimse.Tag.PERFORMED_PROCEDURE_STEP_START_TIME, VR.TM, dataset);

            // Add the required default values to the dataset
            AddStoreInstanceValues(defaultValueManager, dataset, false);
        }
Example #4
0
        private Image CreateNewImageInfo(DvtkHighLevelInterface.Dicom.Other.DataSet dataSet)
        {
            string sopInstUid = "";
            if (dataSet.Exists("0x00080018"))
            {
                HLI.Attribute sopInstUidAtt = dataSet["0x00080018"];
                sopInstUid = sopInstUidAtt.Values[0];
            }
            Image image = new Image();
            image.SOPInstanceUID = sopInstUid;

            return image;
        }
Example #5
0
 internal DicomAttributeCollection(DvtkHighLevelInterface.Dicom.Other.AttributeSet attributeSetOnly, FlagsBase flags)
 {
     this.attributeSetOnly = attributeSetOnly;
     Flags = flags;
 }
Example #6
0
 /// <summary>
 /// Handles a thread state change event of a Thread contained in a ThreadManager.
 /// Takes care that when all threads are stopped, the HandleExecutionCompleted method is called.
 /// </summary>
 /// <param name="thread">The thread which state changes.</param>
 /// <param name="oldThreadState">Old state of the thread.</param>
 /// <param name="newThreadState">New state of the thread.</param>
 /// <param name="numberOfUnStarted">Number of unstarted threads of the ThreadManager.</param>
 /// <param name="numberOfRunning">Number of running threads of the ThreadManager.</param>
 /// <param name="numberOfStopping">Number of stopping threads of the ThreadManager.</param>
 /// <param name="numberOfStopped">Number of stopped threads of the ThreadManager.</param>
 private void HandleThreadsStateChangeEvent(Thread thread, DvtkHighLevelInterface.Common.Threads.ThreadState oldThreadState, DvtkHighLevelInterface.Common.Threads.ThreadState newThreadState, int numberOfUnStarted, int numberOfRunning, int numberOfStopping, int numberOfStopped)
 {
     if ((numberOfRunning == 0) && (numberOfStopping == 0) && (numberOfStopped > 0))
     {
         if ((this.InvokeRequired) && (this.IsHandleCreated))
             Invoke(new ExecutionCompletedHandler(this.HandleExecutionCompleted));
     }
 }
Example #7
0
        /// <summary>
        /// Cretae a storage commitment event.
        /// </summary>
        /// <param name="informationModels">The information models.</param>
        /// <param name="actionMessage">The action message.</param>
        /// <returns>The created event.</returns>
        public static DvtkHighLevelInterface.Dicom.Messages.DicomMessage MakeStorageCommitEvent(QueryRetrieveInformationModels informationModels, DvtkHighLevelInterface.Dicom.Messages.DicomMessage actionMessage)
        {
            // refresh the information models
            informationModels.Refresh();

            DvtkHighLevelInterface.Dicom.Messages.DicomMessage eventMessage = new DvtkHighLevelInterface.Dicom.Messages.DicomMessage(DvtkData.Dimse.DimseCommand.NEVENTREPORTRQ);
            eventMessage.Set("0x00000002", VR.UI, "1.2.840.10008.1.20.1");
            eventMessage.Set("0x00001000", VR.UI, "1.2.840.10008.1.20.1.1");

            DvtkData.Dimse.DataSet actionDataset = actionMessage.DataSet.DvtkDataDataSet;

            DvtkData.Dimse.DataSet eventDataset = new DvtkData.Dimse.DataSet();

            DvtkData.Dimse.Attribute eventReferenceSopSequence = new DvtkData.Dimse.Attribute(0x00081199, DvtkData.Dimse.VR.SQ);
            SequenceOfItems eventReferenceSopSequenceOfItems = new SequenceOfItems();
            eventReferenceSopSequence.DicomValue = eventReferenceSopSequenceOfItems;

            DvtkData.Dimse.Attribute eventFailedSopSequence = new DvtkData.Dimse.Attribute(0x00081198, DvtkData.Dimse.VR.SQ);
            SequenceOfItems eventFailedSopSequenceOfItems = new SequenceOfItems();
            eventFailedSopSequence.DicomValue = eventFailedSopSequenceOfItems;

            if (actionDataset != null)
            {
                DvtkData.Dimse.Attribute transactionUid = actionDataset.GetAttribute(DvtkData.Dimse.Tag.TRANSACTION_UID);
                if (transactionUid != null)
                {
                    eventDataset.Add(transactionUid);
                }

                DvtkData.Dimse.Attribute referencedSopSequence = actionDataset.GetAttribute(DvtkData.Dimse.Tag.REFERENCED_SOP_SEQUENCE);
                if (referencedSopSequence != null)
                {
                    SequenceOfItems sequenceOfItems = (SequenceOfItems)referencedSopSequence.DicomValue;
                    foreach(DvtkData.Dimse.SequenceItem item in sequenceOfItems.Sequence)
                    {
                        System.String sopClassUid = "";
                        System.String sopInstanceUid = "";

                        DvtkData.Dimse.Attribute attribute = item.GetAttribute(DvtkData.Dimse.Tag.REFERENCED_SOP_CLASS_UID);
                        if (attribute != null)
                        {
                            UniqueIdentifier uniqueIdentifier = (UniqueIdentifier)attribute.DicomValue;
                            if (uniqueIdentifier.Values.Count > 0)
                            {
                                sopClassUid = uniqueIdentifier.Values[0];
                            }
                        }

                        attribute = item.GetAttribute(DvtkData.Dimse.Tag.REFERENCED_SOP_INSTANCE_UID);
                        if (attribute != null)
                        {
                            UniqueIdentifier uniqueIdentifier = (UniqueIdentifier)attribute.DicomValue;
                            if (uniqueIdentifier.Values.Count > 0)
                            {
                                sopInstanceUid = uniqueIdentifier.Values[0];
                            }
                        }

                        if (informationModels.PatientRoot.IsInstanceInInformationModel(sopClassUid, sopInstanceUid))
                        {
                            DvtkData.Dimse.SequenceItem itemOk = new DvtkData.Dimse.SequenceItem();
                            itemOk.AddAttribute(0x00081150, DvtkData.Dimse.VR.UI, sopClassUid);
                            itemOk.AddAttribute(0x00081155, DvtkData.Dimse.VR.UI, sopInstanceUid);

                            // add instance to committed list
                            eventReferenceSopSequenceOfItems.Sequence.Add(itemOk);
                        }
                        else
                        {
                            DvtkData.Dimse.SequenceItem itemNotOk = new DvtkData.Dimse.SequenceItem();
                            itemNotOk.AddAttribute(0x00081150, DvtkData.Dimse.VR.UI, sopClassUid);
                            itemNotOk.AddAttribute(0x00081155, DvtkData.Dimse.VR.UI, sopInstanceUid);
                            itemNotOk.AddAttribute(0x00081197, DvtkData.Dimse.VR.US, 0x0110);

                            // add instance to failed list
                            eventFailedSopSequenceOfItems.Sequence.Add(itemNotOk);
                        }
                    }
                }

                if (eventReferenceSopSequenceOfItems.Sequence.Count > 0)
                {
                    eventMessage.Set("0x00001002", VR.US, 1);
                    eventDataset.Add(eventReferenceSopSequence);
                }

                if (eventFailedSopSequenceOfItems.Sequence.Count > 0)
                {
                    eventMessage.Set("0x00001002", VR.US, 2);
                    eventDataset.Add(eventFailedSopSequence);
                }
            }

            eventMessage.DataSet.DvtkDataDataSet = eventDataset;

            return eventMessage;
        }
Example #8
0
        /// <summary>
        /// Generate an NSet MPPS Completed/Discontinued by taking the default values from the Default
        /// Value Manager.
        /// </summary>
        /// <param name="defaultValueManager">Used to get the default values.</param>
        /// <param name="storageCommitItems">Corresponding Storage Commitment items.</param>
        /// <param name="mppsCompletedDiscontinuedMessage">MPPS Completed/Discontinued message being populated.</param>
        /// <param name="mppsInstanceUid">MPPS Instance UID.</param>
        /// <param name="mppsStatus"></param>
        public static void MakeNSetMppsCompletedDiscontinued(Dvtk.Dicom.InformationEntity.DefaultValues.DefaultValueManager defaultValueManager,
			ReferencedSopItemCollection storageCommitItems,
			DvtkHighLevelInterface.Dicom.Messages.DicomMessage mppsCompletedDiscontinuedMessage,
			System.String mppsInstanceUid,
			System.String mppsStatus)
        {
            mppsCompletedDiscontinuedMessage.Set("0x00000003", VR.UI, "1.2.840.10008.3.1.2.3.3");
            mppsCompletedDiscontinuedMessage.Set("0x00001001", VR.UI, mppsInstanceUid);

            // Add the default values to the MppsCompletedDiscontinued message
            AddDefaultMppsCompletedDiscontinuedValues(defaultValueManager, storageCommitItems, mppsCompletedDiscontinuedMessage.DataSet.DvtkDataDataSet, mppsStatus);
        }
Example #9
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="attributeOnly">The attribute without the validation rule.</param>
 /// <param name="validationRuleDicomAttribute">The validation rule that needs to be applied to the attribute.</param>
 public DicomAttribute(DvtkHighLevelInterface.Dicom.Other.Attribute attributeOnly, ValidationRuleDicomAttribute validationRuleDicomAttribute)
     : base(validationRuleDicomAttribute)
 {
     this.attributeOnly = attributeOnly;
 }
Example #10
0
        private bool TriggerModalityProcedureStepCompletedDiscontinued(DvtkHighLevelInterface.Dicom.Messages.DicomMessage nSetMppsCompletedDiscontinued)
        {
            // Trigger the N-SET-RQ MPPS Completed/Discontinued
            DicomTrigger trigger = new DicomTrigger(TransactionNameEnum.RAD_7);
            trigger.AddItem(nSetMppsCompletedDiscontinued,
                            "1.2.840.10008.3.1.2.3.3",
                            "1.2.840.10008.1.2");

            // RAD-7 - trigger the PerformedProcedureStepManager
            return TriggerActorInstances(ActorTypeEnum.PerformedProcedureStepManager, trigger, true);
        }
Example #11
0
        /// <summary>
        /// This object has zero or more attached User Interfaces.
        /// Attach the supplied thread to all the User Interfaces that also implement the IThreadUserInterface.
        /// </summary>
        /// <param name="thread">HLI Thread</param>
        private void AttachThreadToThreadUserInterfaces(DvtkHighLevelInterface.Common.Threads.Thread thread)
        {
            foreach (Dvtk.IheActors.UserInterfaces.IActorUserInterface actorUserInterface in this._attachedUserInterfaces)
            {
                if (actorUserInterface is DvtkHighLevelInterface.Common.UserInterfaces.IThreadUserInterface)
                {
                    DvtkHighLevelInterface.Common.UserInterfaces.IThreadUserInterface threadUserInterface = actorUserInterface as DvtkHighLevelInterface.Common.UserInterfaces.IThreadUserInterface;

                    threadUserInterface.Attach(thread);
                }
            }
        }
Example #12
0
        private Study CreateNewStudyInfo(DvtkHighLevelInterface.Dicom.Other.DataSet dataSet)
        {
            string studyId = "";
            if (dataSet.Exists("0x00200010"))
            {
                HLI.Attribute studyIdAtt = dataSet["0x00200010"];
                studyId = studyIdAtt.Values[0];
            }

            string accNr = "";
            if (dataSet.Exists("0x00080050"))
            {
                HLI.Attribute accNrAtt = dataSet["0x00080050"];
                accNr = accNrAtt.Values[0];
            }

            string studyInstUid = "";
            if (dataSet.Exists("0x0020000D"))
            {
                HLI.Attribute studyInstUidAtt = dataSet["0x0020000D"];
                studyInstUid = studyInstUidAtt.Values[0];
            }

            Study study = new Study();
            study.StudyID = studyId;
            study.AccessionNumber = accNr;
            study.StudyInstanceUID = studyInstUid;

            return study;
        }
Example #13
0
        private Series CreateNewSeriesInfo(DvtkHighLevelInterface.Dicom.Other.DataSet dataSet)
        {
            string seriesInstUid = "";
            if (dataSet.Exists("0x0020000E"))
            {
                HLI.Attribute seriesInstUidAtt = dataSet["0x0020000E"];
                seriesInstUid = seriesInstUidAtt.Values[0];
            }

            Series series = new Series();
            series.SeriesUID = seriesInstUid;

            return series;
        }
Example #14
0
        private Patient CreateNewPatientInfo(DvtkHighLevelInterface.Dicom.Other.DataSet dataSet)
        {
            string patientName = "";
            if (dataSet.Exists("0x00100010"))
            {
                HLI.Attribute patientNameAtt = dataSet["0x00100010"];
                patientName = patientNameAtt.Values[0];
            }

            string patientId = "";
            if (dataSet.Exists("0x00100020"))
            {
                HLI.Attribute patientIdAtt = dataSet["0x00100020"];
                patientId = patientIdAtt.Values[0];
            }

            string patientBd = "";
            if (dataSet.Exists("0x00100030"))
            {
                HLI.Attribute patientBdAtt = dataSet["0x00100030"];
                patientBd = patientBdAtt.Values[0];
            }

            Patient patient = new Patient();
            patient.PatientName = patientName;
            patient.PatientId = patientId;
            patient.PatientBirthDate = patientBd;

            return patient;
        }
Example #15
0
        /// <summary>
        /// Generate an N-CREATE/N-SET MPPS IN-PROGRESS trigger from the given mppsInProgressDcmFilename.
        /// Use the given mppsInstanceUid.
        /// </summary>
        /// <param name="mppsInProgressDcmFilename"></param>
        /// <param name="defaultValueManager">Default Value Manager.</param>
        /// <param name="mppsInProgressMessage">Mpps In-Progress message.</param>
        /// <param name="mppsInstanceUid">Mpps Instance UID.</param>
        public static void MakeMppsInProgress(System.String mppsInProgressDcmFilename,
			Dvtk.Dicom.InformationEntity.DefaultValues.DefaultValueManager defaultValueManager,
			DvtkHighLevelInterface.Dicom.Messages.DicomMessage mppsInProgressMessage,
			System.String mppsInstanceUid)
        {
            if (mppsInProgressMessage.CommandSet.DimseCommand == DvtkData.Dimse.DimseCommand.NCREATERQ)
            {
                // Set Affected UIDs
                mppsInProgressMessage.Set("0x00000002", VR.UI, "1.2.840.10008.3.1.2.3.3");
                mppsInProgressMessage.Set("0x00001000", VR.UI, mppsInstanceUid);
            }
            else
            {
                // Set Requested UIDs
                mppsInProgressMessage.Set("0x00000003", VR.UI, "1.2.840.10008.3.1.2.3.3");
                mppsInProgressMessage.Set("0x00001001", VR.UI, mppsInstanceUid);
            }

            // Read the DCM file
            mppsInProgressMessage.DataSet.DvtkDataDataSet = Dvtk.DvtkDataHelper.ReadDataSetFromFile(mppsInProgressDcmFilename);

            // Update the procedure step start date & time values
            UpdateStartDateTimeValues(defaultValueManager, mppsInProgressMessage.DataSet.DvtkDataDataSet);
        }
Example #16
0
        /// <summary>
        /// Get the value from the message.
        /// </summary>
        /// <param name="dicomMessage">The DICOM message.</param>
        /// <param name="sequenceTag">The sequence tag.</param>
        /// <param name="tag">The tag.</param>
        /// <returns>The value.</returns>
        public static String GetValueFromMessageUsingTag(DvtkHighLevelInterface.Dicom.Messages.DicomMessage dicomMessage,
			DvtkData.Dimse.Tag sequenceTag, DvtkData.Dimse.Tag tag)
        {
            String lValue = String.Empty;

            DvtkData.Dimse.DataSet dataset = dicomMessage.DataSet.DvtkDataDataSet;
            if (dataset != null)
            {
                DvtkData.Dimse.Attribute sequence = dataset.GetAttribute(sequenceTag);
                if (sequence != null)
                {
                    SequenceOfItems sequenceOfItems = (SequenceOfItems)sequence.DicomValue;
                    if (sequenceOfItems.Sequence.Count == 1)
                    {
                        DvtkData.Dimse.SequenceItem item = sequenceOfItems.Sequence[0];
                        DvtkData.Dimse.Attribute attribute = item.GetAttribute(tag);
                        lValue = GetValueFromAttribute(attribute);
                    }
                }
            }

            return lValue;
        }
Example #17
0
        /// <summary>
        /// Make a N-ACTION storage commitment.
        /// </summary>
        /// <param name="storageCommitItems">The storage commitment items.</param>
        /// <param name="storageCommitmentMessage">The storage commitment message.</param>
        /// <param name="storageCommitTransactionUid">The storage commitment transaction UID.</param>
        /// <param name="mppsInstanceUid">The MPPS instance UID.</param>
        public static void MakeNActionStorageCommitment(ReferencedSopItemCollection storageCommitItems,
			DvtkHighLevelInterface.Dicom.Messages.DicomMessage storageCommitmentMessage,
			System.String storageCommitTransactionUid,
			System.String mppsInstanceUid)
        {
            storageCommitmentMessage.Set("0x00000003", VR.UI, "1.2.840.10008.1.20.1");
            storageCommitmentMessage.Set("0x00001001", VR.UI, "1.2.840.10008.1.20.1.1"); // Well known Instance UID
            storageCommitmentMessage.Set("0x00001008", VR.US, 1);

            // Add the required values to the StorageCommitment message
            AddStorageCommitmentValues(storageCommitItems,
                storageCommitmentMessage.DataSet.DvtkDataDataSet,
                storageCommitTransactionUid,
                mppsInstanceUid);
        }
Example #18
0
        /// <summary>
        /// Get value from a DICOM message.
        /// </summary>
        /// <param name="dicomMessage">The DICOM message.</param>
        /// <param name="tag">The tag.</param>
        /// <returns>The value.</returns>
        public static String GetValueFromMessageUsingTag(DvtkHighLevelInterface.Dicom.Messages.DicomMessage dicomMessage,
			DvtkData.Dimse.Tag tag)
        {
            String lValue = String.Empty;

            // first try to find the Tag in the dataset
            DvtkData.Dimse.DataSet dataset = dicomMessage.DataSet.DvtkDataDataSet;
            if (dataset != null)
            {
                DvtkData.Dimse.Attribute attribute = dataset.GetAttribute(tag);
                lValue = GetValueFromAttribute(attribute);
            }

            // - otherwise try to find the Tag in the command
            if (lValue == String.Empty)
            {
                DvtkData.Dimse.CommandSet command = dicomMessage.CommandSet.DvtkDataCommandSet;
                if (command != null)
                {
                    DvtkData.Dimse.Attribute attribute = command.GetAttribute(tag);
                    lValue = GetValueFromAttribute(attribute);
                }
            }

            return lValue;
        }
Example #19
0
        /// <summary>
        /// Generate an NSet MPPS Completed/Discontinued by taking the default values from the given
        /// DCM file. The default manager is required to get the appropriate Series Instance UID.
        /// </summary>
        /// <param name="mppsCompletedDiscontinuedDcmFilename">Used to get the dataset default values.</param>
        /// <param name="defaultValueManager">For the Series Instance UID.</param>
        /// <param name="storageCommitItems">Corresponding Storage Commitment items.</param>
        /// <param name="mppsCompletedDiscontinuedMessage">MPPS Completed/Discontinued message being populated.</param>
        /// <param name="mppsInstanceUid">MPPS Instance UID.</param>
        public static void MakeNSetMppsCompletedDiscontinued(System.String mppsCompletedDiscontinuedDcmFilename,
			Dvtk.Dicom.InformationEntity.DefaultValues.DefaultValueManager defaultValueManager,
			ReferencedSopItemCollection storageCommitItems,
			DvtkHighLevelInterface.Dicom.Messages.DicomMessage mppsCompletedDiscontinuedMessage,
			System.String mppsInstanceUid)
        {
            mppsCompletedDiscontinuedMessage.Set("0x00000003", VR.UI, "1.2.840.10008.3.1.2.3.3");
            mppsCompletedDiscontinuedMessage.Set("0x00001001", VR.UI, mppsInstanceUid);

            // Read the DCM file
            mppsCompletedDiscontinuedMessage.DataSet.DvtkDataDataSet = Dvtk.DvtkDataHelper.ReadDataSetFromFile(mppsCompletedDiscontinuedDcmFilename);

            // Update the procedure step end date & time values
            UpdateEndDateTimeValues(defaultValueManager, mppsCompletedDiscontinuedMessage.DataSet.DvtkDataDataSet);

            // Add the storage commitment items
            AddStorageCommitItems(defaultValueManager, storageCommitItems, mppsCompletedDiscontinuedMessage.DataSet.DvtkDataDataSet);
        }
Example #20
0
 /// <summary>
 /// Handle C-STORE responses.
 /// </summary>
 /// <param name="storageCommitItems">The storage commitment items.</param>
 /// <param name="cStoreResponses">The C-STORE responses.</param>
 public static void HandleCStoreResponses(ReferencedSopItemCollection storageCommitItems, DvtkHighLevelInterface.Dicom.Messages.DicomMessageCollection cStoreResponses)
 {
     foreach(DvtkHighLevelInterface.Dicom.Messages.DicomMessage cStoreRsp in cStoreResponses)
     {
         AddSopData(storageCommitItems, cStoreRsp);
     }
 }
Example #21
0
 private static void AddSopData(ReferencedSopItemCollection storageCommitItems, DvtkHighLevelInterface.Dicom.Messages.DicomMessage dicomMessage)
 {
     Values values = dicomMessage.CommandSet["0x00000002"].Values;
     System.String sopClassUid = values[0];
     values = dicomMessage.CommandSet["0x00001000"].Values;
     System.String sopInstanceUid = values[0];
     ReferencedSopItem storageCommitItem = storageCommitItems.Find(sopClassUid, sopInstanceUid);
     if (storageCommitItem == null)
     {
         storageCommitItem = new ReferencedSopItem(sopClassUid, sopInstanceUid);
         storageCommitItem.InstanceState = InstanceStateEnum.InstanceStored;
         storageCommitItems.Add(storageCommitItem);
     }
 }
Example #22
0
        /// <summary>
        /// Handle N-EVENT-REPORT for storage commitment.
        /// </summary>
        /// <param name="storageCommitItems">The storage commitment items.</param>
        /// <param name="storageCommitmentMessage">The storage commitment message.</param>
        public static void HandleNEventReportStorageCommitment(ReferencedSopItemCollection storageCommitItems,
			DvtkHighLevelInterface.Dicom.Messages.DicomMessage storageCommitmentMessage)
        {
            DvtkData.Dimse.DataSet dataset = storageCommitmentMessage.DataSet.DvtkDataDataSet;
            if (dataset != null)
            {
                // Try to get the successfully stored instances
                DvtkData.Dimse.Attribute eventReferenceSopSequence = dataset.GetAttribute(DvtkData.Dimse.Tag.REFERENCED_SOP_SEQUENCE);
                if (eventReferenceSopSequence != null)
                {
                    SequenceOfItems sequenceOfItems = (SequenceOfItems)eventReferenceSopSequence.DicomValue;
                    foreach (DvtkData.Dimse.SequenceItem item in sequenceOfItems.Sequence)
                    {
                        UpdateReferencedSopItem(storageCommitItems, item, InstanceStateEnum.InstanceStorageCommitReportedSuccess);
                    }
                }

                // try to get the unsuccessfully stored instances
                DvtkData.Dimse.Attribute eventFailedSopSequence = dataset.GetAttribute(DvtkData.Dimse.Tag.FAILED_SOP_SEQUENCE);
                if (eventFailedSopSequence != null)
                {
                    SequenceOfItems sequenceOfItems = (SequenceOfItems)eventFailedSopSequence.DicomValue;
                    foreach (DvtkData.Dimse.SequenceItem item in sequenceOfItems.Sequence)
                    {
                        UpdateReferencedSopItem(storageCommitItems, item, InstanceStateEnum.InstanceStorageCommitReportedFailure);
                    }
                }
            }
        }
Example #23
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="attributeSetOnly">The actual collection of Dicom Attributes.</param>
 /// <param name="flagsDicomAttribute">The flags used for this collection.</param>
 internal DicomAttributeCollection(DvtkHighLevelInterface.Dicom.Other.AttributeSet attributeSetOnly, FlagsDicomAttribute flagsDicomAttribute)
 {
     this.attributeSetOnly = attributeSetOnly;
     Flags = FlagsConvertor.ConvertToFlagsBase(flagsDicomAttribute);
 }
Example #24
0
        /// <summary>
        /// Make a C-STORE instance.
        /// </summary>
        /// <param name="defaultValueManager">The default value manager.</param>
        /// <param name="storeInstanceMessage">The C-STORE message instance.</param>
        public static void MakeCStoreInstance(Dvtk.Dicom.InformationEntity.DefaultValues.DefaultValueManager defaultValueManager,
			DvtkHighLevelInterface.Dicom.Messages.DicomMessage storeInstanceMessage)
        {
            // Add the required values to the StoreInstance message
            AddStoreInstanceValues(defaultValueManager,
                storeInstanceMessage.DataSet.DvtkDataDataSet, true);
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="dicomThread">The DicomThread to add the mapping information to in it's results.</param>
 public AttributeSetResultsLoggingVisitor(DvtkHighLevelInterface.Dicom.Threads.DicomThread dicomThread)
 {
     this.dicomThread = dicomThread;
 }
Example #26
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="dataSet">The Structured Report encoded as a Data Set.</param>
        public StructuredReport(DvtkHighLevelInterface.Dicom.Other.DataSet dataSet)
        {
            this.dataSet = dataSet;

            this.rootContentItem = ContentItem.CreateContentItems(dataSet);
        }