コード例 #1
0
ファイル: IheFramework.cs プロジェクト: top501/DVTK-1
        private BaseActor CreateActor(ActorName actorName)
        {
            BaseActor actor = null;

            switch (actorName.Type)
            {
            case ActorTypeEnum.AdtPatientRegistration:
                actor = new AdtPatientRegistrationActor(actorName.Id, this);
                break;

            case ActorTypeEnum.OrderPlacer:
                actor = new OrderPlacerActor(actorName.Id, this);
                break;

            case ActorTypeEnum.DssOrderFiller:
                actor = new DssOrderFillerActor(actorName.Id, this);
                break;

            case ActorTypeEnum.AcquisitionModality:
                actor = new AcquisitionModalityActor(actorName.Id, this);
                break;

            case ActorTypeEnum.ImageManager:
                actor = new ImageManagerActor(actorName.Id, this);
                break;

            case ActorTypeEnum.ImageArchive:
                actor = new ImageArchiveActor(actorName.Id, this);
                break;

            case ActorTypeEnum.PerformedProcedureStepManager:
                actor = new PpsManagerActor(actorName.Id, this);
                break;

            case ActorTypeEnum.EvidenceCreator:
                actor = new EvidenceCreatorActor(actorName.Id, this);
                break;

            case ActorTypeEnum.ImageDisplay:
                actor = new ImageDisplayActor(actorName.Id, this);
                break;

//				case ActorTypeEnum.ReportManager:
//					actor = new ReportManagerActor(actorName.Id, this);
//					break;
            case ActorTypeEnum.PrintComposer:
                actor = new PrintComposerActor(actorName.Id, this);
                break;

            case ActorTypeEnum.PrintServer:
                actor = new PrintServerActor(actorName.Id, this);
                break;

            case ActorTypeEnum.Unknown:
            default:
                break;
            }

            return(actor);
        }
コード例 #2
0
        /// <summary>
        /// Trigger the Client to send a Verification (DICOM C-ECHO-RQ).
        /// </summary>
        /// <param name="actorName">Destination Actor Name.</param>
        /// <returns>Boolean indicating success or failure.</returns>
        public bool TriggerClientVerification(ActorName actorName)
        {
            // Set up a Verification SOP Class - C-ECHO-RQ trigger
            DicomTrigger dicomTrigger = new DicomTrigger(Dvtk.IheActors.Bases.TransactionNameEnum.RAD_UNKNOWN);

            dicomTrigger.AddItem(new DicomMessage(DvtkData.Dimse.DimseCommand.CECHORQ),
                                 HliScp.VERIFICATION_SOP_CLASS_UID,
                                 HliScp.IMPLICIT_VR_LITTLE_ENDIAN);
            DicomTriggerItem dicomTriggerItem = dicomTrigger.TriggerItems[0];

            // thread must wait for association completion
            _scu.SignalCompletion = true;

            // set up the presentation context from the trigger
            PresentationContext[] presentationContexts = new PresentationContext[1];
            presentationContexts[0] = new PresentationContext(dicomTriggerItem.SopClassUid,
                                                              dicomTriggerItem.TransferSyntaxes);
            _scu.TriggerSendAssociation(dicomTriggerItem.Message, presentationContexts);

            // wait for association completion
            // - timeout of 0 means "no timeout".
            _semaphore.Wait(0);

            // return a boolean indicating if the trigger was processed successfully or not
            return(_scu.ProcessTriggerResult);
        }
コード例 #3
0
        /// <summary>
        /// Handle a Dicom Transaction from the given Actor Name.
        /// </summary>
        /// <param name="actorName">Source Actor Name.</param>
        /// <param name="dicomTransaction">Dicom Transaction.</param>
        protected override void HandleTransactionFrom(ActorName actorName, DicomTransaction dicomTransaction)
        {
            switch (actorName.Type)
            {
            case ActorTypeEnum.DssOrderFiller:
                // received Image Availability Query [RAD-11] or
                // received Performed Work Status Update [RAD-42]
                break;

            case ActorTypeEnum.PerformedProcedureStepManager:
                // received Modality Procedure Step In Progress [RAD-6] or
                // received Modality Procedure Step Completed [RAD-7] or
                // received Creator Procedure Step In Progress [RAD-20] or
                // received Creator Procedure Step Completed [RAD-21]
                break;

            case ActorTypeEnum.AcquisitionModality:
                // received Storage Commitment [RAD-10]
                break;

            case ActorTypeEnum.EvidenceCreator:
                // received Storage Commitment [RAD-10]
                break;

            case ActorTypeEnum.ReportManager:
                // received Image Availability Query [RAD-11]
                break;

            default:
                break;
            }
        }
コード例 #4
0
        /// <summary>
        /// Assert that the given attribute value in the given DICOM message has the expected value between the two given actors.
        /// Check all occurences of the given dimseCommandName in the transaction log.
        /// </summary>
        /// <param name="actorName1">First actor name in transaction.</param>
        /// <param name="actorName2">Second actor name in transaction.</param>
        /// <param name="dimseCommandName">DICOM command name.</param>
        /// <param name="tag">tag - Attribute tag whose first value is the actual value.</param>
        /// <param name="expectedValue">The expected attribute value - this will be compared with the actual attribute value.</param>
        /// <returns>bool - indication if the assertion was true or false.</returns>
        public bool AssertDicomAttributeValueBetweenActors(ActorName actorName1, ActorName actorName2, String dimseCommandName, DvtkData.Dimse.Tag tag, int expectedValue)
        {
            bool assertion  = true;
            bool matchFound = false;

            // check all transactions
            // - this assertion will test the value of the attribute tag in all occurences of the give dimseCommandName.
            foreach (ActorsTransaction actorsTransaction in this)
            {
                // check if a transaction exists between the required actors
                if (((actorsTransaction.FromActorName.TypeId == actorName1.TypeId) ||
                     (actorsTransaction.ToActorName.TypeId == actorName1.TypeId)) &&
                    ((actorsTransaction.FromActorName.TypeId == actorName2.TypeId) ||
                     (actorsTransaction.ToActorName.TypeId == actorName2.TypeId)))
                {
                    // get the value of the given attribute in the DICOM message with the given DICOM command name
                    String attributeValue = String.Empty;
                    if ((actorsTransaction.GetFirstDicomAttributeValue(dimseCommandName, tag, out attributeValue) == true) &&
                        (attributeValue != String.Empty))
                    {
                        matchFound = true;

                        int actualValue = int.Parse(attributeValue);
                        if (actualValue != expectedValue)
                        {
                            // the expected value does not equal the actual value
                            String testAssertionResult = String.Format("Assertion Failure: AssertDicomAttributeValueBetweenActors {0} and {1} for DICOM Command {2} - Tag ({3},{4}) - expected: {5} - actual: {6}",
                                                                       actorName1.TypeId,
                                                                       actorName2.TypeId,
                                                                       dimseCommandName,
                                                                       tag.GroupNumber.ToString("X").PadLeft(4, '0'),
                                                                       tag.ElementNumber.ToString("X").PadLeft(4, '0'),
                                                                       expectedValue,
                                                                       actualValue);
                            _testAssertionResults.Add(testAssertionResult);
                            assertion = false;
                        }
                    }
                }
            }

            if (matchFound == false)
            {
                // the expected count does not equal the actual count
                String testAssertionResult = String.Format("Assertion Failure: AssertDicomAttributeValueBetweenActors {0} and {1} for DICOM Command {2} - Tag ({3},{4}) - expected: {5} - no corresponding messages found.",
                                                           actorName1.TypeId,
                                                           actorName2.TypeId,
                                                           dimseCommandName,
                                                           tag.GroupNumber.ToString("X").PadLeft(4, '0'),
                                                           tag.ElementNumber.ToString("X").PadLeft(4, '0'),
                                                           expectedValue);
                _testAssertionResults.Add(testAssertionResult);
                assertion = false;
            }

            return(assertion);
        }
コード例 #5
0
        /// <summary>
        /// Class constructor.
        /// </summary>
        /// <param name="parentActor">Parent Actor Name - containing actor.</param>
        /// <param name="actorName">Destination Actor Name.</param>
        public DicomStorageCommitClient(BaseActor parentActor, ActorName actorName)
            : base(parentActor, actorName, true)
        {
            _presentationContexts = new PresentationContext[1];

            PresentationContext presentationContext = new PresentationContext("1.2.840.10008.1.20.1", // Abstract Syntax Name
                                                                              "1.2.840.10008.1.2");   // Transfer Syntax Name(s)

            _presentationContexts[0] = presentationContext;
        }
コード例 #6
0
        /// <summary>
        /// Class constructor.
        /// </summary>
        /// <param name="parentActor">Parent Actor Name - containing actor.</param>
        /// <param name="actorName">Destination Actor Name.</param>
        public DicomPrintClient(BaseActor parentActor, ActorName actorName)
            : base(parentActor, actorName, false)
        {
            _presentationContexts = new PresentationContext[1];

            PresentationContext presentationContext = new PresentationContext("1.2.840.10008.3.1.2.3.3", // Abstract Syntax Name
                                                                              "1.2.840.10008.1.2");      // Transfer Syntax Name(s)

            _presentationContexts[0] = presentationContext;
        }
コード例 #7
0
        public override void PopulateStringTable(FxArchive Owner)
        {
            base.PopulateStringTable(Owner);

            ActorName.AddToStringTable(Owner);

            foreach (FxAnimGroup Group in AnimGroups)
            {
                Group.PopulateStringTable(Owner);
            }
        }
コード例 #8
0
        /// <summary>
        /// Handle a Dicom Transaction from the given Actor Name.
        /// </summary>
        /// <param name="actorName">Source Actor Name.</param>
        /// <param name="dicomTransaction">Dicom Transaction.</param>
        protected override void HandleTransactionFrom(ActorName actorName, DicomTransaction dicomTransaction)
        {
            switch (actorName.Type)
            {
            case ActorTypeEnum.PrintComposer:
                // received Print Request with Presentation LUT [RAD-23]
                break;

            default:
                break;
            }
        }
コード例 #9
0
ファイル: EvidenceCreatorActor.cs プロジェクト: top501/DVTK-1
        /// <summary>
        /// Handle a Dicom Transaction from the given Actor Name.
        /// </summary>
        /// <param name="actorName">Source Actor Name.</param>
        /// <param name="dicomTransaction">Dicom Transaction.</param>
        protected override void HandleTransactionFrom(ActorName actorName, DicomTransaction dicomTransaction)
        {
            switch (actorName.Type)
            {
            case ActorTypeEnum.ImageManager:
                // received Storage Commitment [RAD-10]
                break;

            default:
                break;
            }
        }
コード例 #10
0
        /// <summary>
        /// Handle a Dicom Transaction from the given Actor Name.
        /// </summary>
        /// <param name="actorName">Source Actor Name.</param>
        /// <param name="dicomTransaction">Dicom Transaction.</param>
        protected override void HandleTransactionFrom(ActorName actorName, DicomTransaction dicomTransaction)
        {
            switch (actorName.Type)
            {
            case ActorTypeEnum.ImageArchive:
                // received Retrieve Images [RAD-16]
                break;

            default:
                break;
            }
        }
コード例 #11
0
        /// <summary>
        /// Class constructor.
        /// </summary>
        /// <param name="parentActor">Parent Actor Name - containing actor.</param>
        /// <param name="actorName">Destination Actor Name.</param>
        public DicomStorageClient(BaseActor parentActor, ActorName actorName)
            : base(parentActor, actorName, false)
        {
            _presentationContexts = new PresentationContext[1];

            String[] transferSyntaxes = new String[1];
            transferSyntaxes[0] = "1.2.840.10008.1.2";                                                     // Transfer Syntax Name(s)
            PresentationContext presentationContext = new PresentationContext("1.2.840.10008.5.1.4.1.1.7", // Abstract Syntax Name
                                                                              transferSyntaxes);

            _presentationContexts[0] = presentationContext;
        }
コード例 #12
0
        /// <summary>
        /// Get the DICOM Store Data Directory for the given fromActorName.
        /// </summary>
        /// <param name="fromActorName">From Actor Name.</param>
        /// <returns>Full directory name for DICOM Store Data.</returns>
        public String GetDicomStoreDataDirectory(ActorName fromActorName)
        {
            String dicomStoreDataDirectory = String.Empty;

            // get the DICOM storage data directory for the given from actor name.
            DicomServer dicomServer = GetDicomServer(fromActorName);

            if (dicomServer != null)
            {
                dicomStoreDataDirectory = dicomServer.StoreDataDirectory;
            }

            return(dicomStoreDataDirectory);
        }
コード例 #13
0
        /// <summary>
        /// Set the Associate Abort Parameters for the given DICOM Server within the Acquisition Modality.
        /// </summary>
        /// <param name="fromActorName">Actor Name that makes a connection to this DICOM Server.</param>
        /// <param name="source">Abort Source.</param>
        /// <param name="reason">Abort Reason.</param>
        /// <remarks>The fromActorName type is always the ImageManager at the moment - no other actors connect to the Acquisition
        /// Modality at the moment. The caller does need to supply fromActorName as the Id component is not known by default.</remarks>
        public void SetAssociationAbortParametersForDicomServer(ActorName fromActorName, byte source, byte reason)
        {
            //
            // Get the DICOM server within the acquisition modality that handles the DICOM association from the actor name.
            //
            DicomServer dicomServer = _acquisitionModality.GetDicomServer(fromActorName);

            if (dicomServer != null)
            {
                //
                // Set the abort parameters
                //
                dicomServer.SetAbortParameters(source, reason);
            }
        }
コード例 #14
0
        /// <summary>
        /// Set the way in which the Acquisition Modality should respond to an Associate Request from the actor name.
        /// </summary>
        /// <param name="fromActorName">Actor Name that makes a connection to this DICOM Server.</param>
        /// <param name="respondEnum">Enum defining how to respond.</param>
        /// <remarks>The fromActorName type is always the ImageManager at the moment - no other actors connect to the Acquisition
        /// Modality at the moment. The caller does need to supply fromActorName as the Id component is not known by default.</remarks>
        public void SetRespondToAssociateRequestForDicomServer(ActorName fromActorName, HliScp.ScpRespondToAssociateRequestEnum respondEnum)
        {
            //
            // Get the DICOM server within the acquisition modality that handles the DICOM association from the actor name.
            //
            DicomServer dicomServer = _acquisitionModality.GetDicomServer(fromActorName);

            if (dicomServer != null)
            {
                //
                // Set how the DICOM Server should respond to the Associate Request from the actor name.
                //
                dicomServer.SetRespondToAssociateRequest(respondEnum);
            }
        }
コード例 #15
0
        /// <summary>
        /// Clear the Transfer Syntaxes supported by the DICOM server handling the connection from the actor name.
        /// </summary>
        /// <param name="fromActorName">Actor Name that makes a connection to this DICOM Server.</param>
        /// <remarks>The fromActorName type is always the ImageManager at the moment - no other actors connect to the Acquisition
        /// Modality at the moment. The caller does need to supply fromActorName as the Id component is not known by default.
        ///
        /// The caller is responsible for setting at least one new Transfer Syntax UID via the AddTransferSyntaxSupportForDicomServer()
        /// method after making this method call.</remarks>
        public void ClearTransferSyntaxSupportForDicomServer(ActorName fromActorName)
        {
            //
            // Get the DICOM server within the acquisition modality that handles the DICOM association from the actor name.
            //
            DicomServer dicomServer = _acquisitionModality.GetDicomServer(fromActorName);

            if (dicomServer != null)
            {
                //
                // Clear the transfer syntax support for the DICOM Server.
                //
                dicomServer.ClearTransferSyntaxes();
            }
        }
コード例 #16
0
        /// <summary>
        /// Add a Transfer Syntax Uid that should be supported by the DICOM server handling the connection from the actor name.
        /// </summary>
        /// <param name="fromActorName">Actor Name that makes a connection to this DICOM Server.</param>
        /// <param name="transferSyntaxUid">Transfer Syntax UID - as string.</param>
        /// <remarks>The fromActorName type is always the ImageManager at the moment - no other actors connect to the Acquisition
        /// Modality at the moment. The caller does need to supply fromActorName as the Id component is not known by default.</remarks>
        public void AddTransferSyntaxSupportForDicomServer(ActorName fromActorName, System.String transferSyntaxUid)
        {
            //
            // Get the DICOM server within the acquisition modality that handles the DICOM association from the actor name.
            //
            DicomServer dicomServer = _acquisitionModality.GetDicomServer(fromActorName);

            if (dicomServer != null)
            {
                //
                // Add a transfer syntax that the DICOM Server should support.
                //
                dicomServer.AddTransferSyntax(transferSyntaxUid);
            }
        }
コード例 #17
0
        /// <summary>
        /// Clear the Transfer Syntaxes proposed by the DICOM client making the connection to the actor name.
        /// </summary>
        /// <param name="toActorName">Actor Name that receives a connection to from DICOM Client.</param>
        /// <remarks>The caller is responsible for setting at least one new Transfer Syntax UID via the AddTransferSyntaxProposalForDicomClient()
        /// method after making this method call.</remarks>
        public void ClearTransferSyntaxProposalForDicomClient(ActorName toActorName)
        {
            //
            // Get the DICOM client within the acquisition modality that handles the DICOM association to the actor name.
            //
            DicomClient dicomClient = _acquisitionModality.GetDicomClient(toActorName);

            if (dicomClient != null)
            {
                //
                // Clear the transfer syntax proposed by the DICOM Client.
                //
                dicomClient.ClearTransferSyntaxes();
            }
        }
コード例 #18
0
        /// <summary>
        /// Add a Transfer Syntax Uid that should be proposed by the local DICOM client handling the connection to the actor name.
        /// </summary>
        /// <param name="toActorName">Actor Name that receives a connection from this DICOM Client.</param>
        /// <param name="transferSyntaxUid">Transfer Syntax UID - as string.</param>
        public void AddTransferSyntaxProposalForDicomClient(ActorName toActorName, System.String transferSyntaxUid)
        {
            //
            // Get the DICOM client within the acquisition modality that handles the DICOM association to the actor name.
            //
            DicomClient dicomClient = _acquisitionModality.GetDicomClient(toActorName);

            if (dicomClient != null)
            {
                //
                // Add a transfer syntax that the DICOM Client should propose.
                //
                dicomClient.AddTransferSyntax(transferSyntaxUid);
            }
        }
コード例 #19
0
        /// <summary>
        /// Class constructor.
        /// </summary>
        /// <param name="parentActor">Parent Actor Name - (containing actor).</param>
        /// <param name="actorName">Destination Actor Name.</param>
        /// <param name="storageCommitmentScu">Boolean indicating if this is a Storage Commitment SCU or not.</param>
        public DicomClient(BaseActor parentActor, ActorName actorName, bool storageCommitmentScu) : base(parentActor, actorName)
        {
            if (storageCommitmentScu == true)
            {
                _scu = new DicomStorageCommitmentScu(this);
            }
            else
            {
                _scu = new DicomScu(this);
            }

            // set up the default transfer syntaxes proposed
            _transferSyntaxes = new TransferSyntaxes(HliScp.IMPLICIT_VR_LITTLE_ENDIAN,
                                                     HliScp.EXPLICIT_VR_LITTLE_ENDIAN,
                                                     HliScp.EXPLICIT_VR_BIG_ENDIAN);
        }
コード例 #20
0
ファイル: IheFramework.cs プロジェクト: top501/DVTK-1
        /// <summary>
        /// Get the Actor with the given actor name.
        /// </summary>
        /// <param name="actorName">Actor Name to seach for.</param>
        /// <returns>Actor with given name - maybe null.</returns>
        public BaseActor GetActor(ActorName actorName)
        {
            BaseActor lActor = null;

            // search all the actors for one with the given name
            foreach (BaseActor actor in _actors)
            {
                if (actor.ActorName.TypeId == actorName.TypeId)
                {
                    lActor = actor;
                    break;
                }
            }

            return(lActor);
        }
コード例 #21
0
        /// <summary>
        /// Trigger the Client.
        /// </summary>
        /// <param name="actorName">Destination Actor Name.</param>
        /// <param name="trigger">Trigger message.</param>
        /// <param name="awaitCompletion">Boolean indicating whether this a synchronous call or not.</param>
        /// <returns>Boolean indicating success or failure.</returns>
        public bool TriggerClient(ActorName actorName, BaseTrigger trigger, bool awaitCompletion)
        {
            _awaitCompletion = awaitCompletion;

            Hl7Trigger hl7Trigger = (Hl7Trigger)trigger;

            _triggerQueue.Enqueue(hl7Trigger);

            // Check if this is a synchronous call or not
            if (_awaitCompletion == true)
            {
                // Timeout of 0 means "no timeout".
                _semaphore.Wait(0);
            }

            return(true);
        }
コード例 #22
0
        /// <summary>
        /// Handle an HL7 Transation from the given Actor Name.
        /// </summary>
        /// <param name="actorName">Source Actor Name.</param>
        /// <param name="hl7Transaction">HL7 Transaction.</param>
        protected override void HandleTransactionFrom(ActorName actorName, Hl7Transaction hl7Transaction)
        {
            Hl7Message request = hl7Transaction.Request;

            switch (actorName.Type)
            {
            case ActorTypeEnum.DssOrderFiller:
                // received Procedure Scheduled [RAD-4] or
                // received Patient Update [Rad-12] or
                // received Procedure Updated [RAD-13]
                UpdateImageArchiveActor(request);
                break;

            default:
                break;
            }
        }
コード例 #23
0
        /// <summary>
        /// Class constructor.
        /// </summary>
        /// <param name="parentActor">Parent Actor Name - (containing actor).</param>
        /// <param name="actorName">Destination Actor Name.</param>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="config">HL7 Configuration.</param>
        public Hl7Client(BaseActor parentActor, ActorName actorName, CommonConfig commonConfig, Hl7PeerToPeerConfig config) : base(parentActor, actorName)
        {
            _hl7ThreadForHl7Client = new Hl7ThreadForHl7Client(this);
            DvtkHighLevelInterface.Common.Threads.ThreadManager threadManager = new DvtkHighLevelInterface.Common.Threads.ThreadManager();
            _hl7ThreadForHl7Client.Initialize(threadManager);
            _hl7ThreadForHl7Client.Options.UseResultsFileNameIndex = true;
            _hl7ThreadForHl7Client.Options.SessionId  = config.SessionId;
            _hl7ThreadForHl7Client.Options.Identifier = String.Format("From_{0}_To_{1}",
                                                                      ParentActor.ActorName.TypeId,
                                                                      ActorName.TypeId);

            _triggerQueue = System.Collections.Queue.Synchronized(new System.Collections.Queue());
            _config       = config;


            if (commonConfig.ResultsDirectory != System.String.Empty)
            {
                if (commonConfig.ResultsSubdirectory != System.String.Empty)
                {
                    _hl7ThreadForHl7Client.Options.ResultsDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.ResultsDirectory + "\\" + commonConfig.ResultsSubdirectory);
                }
                else
                {
                    _hl7ThreadForHl7Client.Options.ResultsDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.ResultsDirectory);
                }
            }

            // Set up the HL7 Validation Profile Store
            if ((commonConfig.Hl7ProfileDirectory != System.String.Empty) &&
                (commonConfig.Hl7ProfileStoreName != System.String.Empty))
            {
                _hl7ProfileStore = new Hl7ProfileStore(RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.Hl7ProfileDirectory), commonConfig.Hl7ProfileStoreName);
            }

            // Set up the HL7 Validation Context
            if (commonConfig.Hl7ValidationContextFilename != System.String.Empty)
            {
                _hl7ValidationContext = new Hl7ValidationContext(RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.Hl7ValidationContextFilename));
            }

            // Set up the validation Web Service
            if (commonConfig.NistWebServiceUrl != System.String.Empty)
            {
                _nistWebServiceClient = new NistWebServiceClient(commonConfig.NistWebServiceUrl);
            }
        }
コード例 #24
0
        /// <summary>
        /// Assert that the correct number of the given DICOM message has been seen between the two given actors.
        /// Stop after the first occurence of the given dimseCommandName in the transaction log.
        /// </summary>
        /// <param name="actorName1">First actor name in transaction.</param>
        /// <param name="actorName2">Second actor name in transaction.</param>
        /// <param name="dimseCommandName">DICOM command name.</param>
        /// <param name="expectedCount">Number of times the given DICOM command was expected to occur between these actors.</param>
        /// <returns>bool - indication if the assertion was true or false.</returns>
        public bool AssertMessageCountBetweenActors(ActorName actorName1, ActorName actorName2, String dimseCommandName, int expectedCount)
        {
            bool assertion  = true;
            bool matchFound = false;

            // check all transactions - until the first occurence of the dimseCommandName - then break
            foreach (ActorsTransaction actorsTransaction in this)
            {
                // check if a transaction exists between the required actors
                String actorsTransactionFromActorNameTypeId = actorsTransaction.FromActorName.TypeId;
                String actorsTransactionToActorNameTypeId   = actorsTransaction.ToActorName.TypeId;
                if (((actorsTransactionFromActorNameTypeId == actorName1.TypeId) &&
                     (actorsTransactionFromActorNameTypeId == actorName2.TypeId)) ||
                    ((actorsTransactionFromActorNameTypeId == actorName2.TypeId) &&
                     (actorsTransactionToActorNameTypeId == actorName1.TypeId)))
                {
                    // get the number of messages in the transaction with the given DICOM command name
                    int actualCount = actorsTransaction.GetNumberOfDicomMessages(dimseCommandName);
                    if (actualCount != -1)
                    {
                        matchFound = true;

                        if (actualCount != expectedCount)
                        {
                            // the expected count does not equal the actual count
                            String testAssertionResult = String.Format("Assertion Failure: AssertMessageCountBetweenActors {0} and {1} for DICOM Command {2} - expected: {3} - actual: {4}",
                                                                       actorName1.TypeId, actorName2.TypeId, dimseCommandName, expectedCount, actualCount);
                            _testAssertionResults.Add(testAssertionResult);
                            assertion = false;
                        }
                        break;
                    }
                }
            }

            if (matchFound == false)
            {
                // the expected count does not equal the actual count
                String testAssertionResult = String.Format("Assertion Failure: AssertMessageCountBetweenActors {0} and {1} for DICOM Command {2} - expected: {3} - no corresponding messages found.",
                                                           actorName1.TypeId, actorName2.TypeId, dimseCommandName, expectedCount);
                _testAssertionResults.Add(testAssertionResult);
                assertion = false;
            }
            return(assertion);
        }
コード例 #25
0
ファイル: OrderPlacerActor.cs プロジェクト: top501/DVTK-1
        /// <summary>
        /// Handle an HL7 Transation from the given Actor Name.
        /// </summary>
        /// <param name="actorName">Source Actor Name.</param>
        /// <param name="hl7Transaction">HL7 Transaction.</param>
        protected override void HandleTransactionFrom(ActorName actorName, Hl7Transaction hl7Transaction)
        {
            switch (actorName.Type)
            {
            case ActorTypeEnum.AdtPatientRegistration:
                // received Patient Registration [RAD-1] or
                // received Patient Update [RAD-12]
                break;

            case ActorTypeEnum.DssOrderFiller:
                // received Filler Order Management [RAD-3] or
                // received Appointment Notification [RAD-48]
                break;

            default:
                break;
            }
        }
コード例 #26
0
 /// <summary>
 /// Class constructor.
 /// </summary>
 /// <param name="transactionNumber">Transaction Number.</param>
 /// <param name="fromActorName">Name of Actor sending Transaction.</param>
 /// <param name="toActorName">Name of Actor receiving Transaction.</param>
 /// <param name="transaction">Transaction itself.</param>
 /// <param name="resultsFilename">Results filename.</param>
 /// <param name="resultsPathname">Full Results filename - including directory.</param>
 /// <param name="nrErrors">Number of Errors in Transaction.</param>
 /// <param name="nrWarnings">Number of Warnings in Transaction.</param>
 public ActorsTransaction(int transactionNumber,
                          ActorName fromActorName,
                          ActorName toActorName,
                          BaseTransaction transaction,
                          System.String resultsFilename,
                          System.String resultsPathname,
                          uint nrErrors,
                          uint nrWarnings)
 {
     _transactionNumber = transactionNumber;
     _fromActorName     = fromActorName;
     _toActorName       = toActorName;
     _transaction       = transaction;
     _resultsFilename   = resultsFilename;
     _resultsPathname   = resultsPathname;
     _nrErrors          = nrErrors;
     _nrWarnings        = nrWarnings;
 }
コード例 #27
0
        /// <summary>
        /// Handle a Dicom Transaction from the given Actor Name.
        /// </summary>
        /// <param name="actorName">Source Actor Name.</param>
        /// <param name="dicomTransaction">Dicom Transaction.</param>
        protected override void HandleTransactionFrom(ActorName actorName, DicomTransaction dicomTransaction)
        {
            switch (actorName.Type)
            {
            case ActorTypeEnum.ImageManager:
                // received Storage Commitment [RAD-10]
                DicomMessageCollection nEventReportRequests = dicomTransaction.DicomMessages.NEventReportRequests;

                foreach (DvtkHighLevelInterface.Dicom.Messages.DicomMessage dicomMessage in nEventReportRequests)
                {
                    // Update the storage commit items with the appropriate status - as received in the
                    // event report request
                    GenerateTriggers.HandleNEventReportStorageCommitment(_storageCommitItems, dicomMessage);
                }
                break;

            default:
                break;
            }
        }
コード例 #28
0
        /// <summary>
        /// Get the number of files currently stored in the DICOM
        /// Storage Directory fromActorName.
        /// </summary>
        /// <param name="fromActorName">From actor name.</param>
        /// <returns>Number of files in directory.</returns>
        public int GetNoDicomStoreDataFiles(ActorName fromActorName)
        {
            int noDicomStoreDataFiles = 0;

            try
            {
                String        storeDataDirectory = GetDicomStoreDataDirectory(fromActorName);
                DirectoryInfo directoryInfo      = new DirectoryInfo(storeDataDirectory);
                if (directoryInfo != null)
                {
                    // get the number of files stored in the directory
                    FileInfo [] fileInfo = directoryInfo.GetFiles();
                    noDicomStoreDataFiles = fileInfo.Length;
                }
            }
            catch (System.Exception)
            {
            }

            return(noDicomStoreDataFiles);
        }
コード例 #29
0
        /// <summary>
        /// Get the name of the indexed file in the DICOM Storage Directory
        /// fromActorName. The filename can then be used to further access
        /// the file.
        /// </summary>
        /// <param name="fromActorName">From actor name.</param>
        /// <param name="index">Zero based index from directory System.IO.FileInfo[].</param>
        /// <returns>Full filename for indexed DICOM file.</returns>
        public String GetDicomStoreDataFilename(ActorName fromActorName, int index)
        {
            String dicomStoreDataFilename = String.Empty;

            try
            {
                String        storeDataDirectory = GetDicomStoreDataDirectory(fromActorName);
                DirectoryInfo directoryInfo      = new DirectoryInfo(storeDataDirectory);
                if (directoryInfo != null)
                {
                    // get the indexed filename
                    FileInfo[] fileInfo = directoryInfo.GetFiles();
                    dicomStoreDataFilename = fileInfo[index].FullName;
                }
            }
            catch (System.Exception)
            {
            }

            return(dicomStoreDataFilename);
        }
コード例 #30
0
        public override void Deserialize(FxArchive Owner, BinaryReader Reader)
        {
            base.Deserialize(Owner, Reader);

            AnimSet_Unk04 = Reader.ReadUInt32(); // Unknown; could be data about published or not.

            // This is not stored in the file
            ActorName.SetIndex(Owner, 1);

            // Read groups.
            uint NumAnimGroups = Reader.ReadUInt32();

            AnimGroups = new FxAnimGroup[NumAnimGroups];
            for (int i = 0; i < NumAnimGroups; i++)
            {
                FxAnimGroup GroupObject = new FxAnimGroup();
                GroupObject.Deserialize(Owner, Reader);

                AnimGroups[i] = GroupObject;
            }
        }