Example #1
0
 public override void WriteXmlConfig(XmlTextWriter writer)
 {
     writer.WriteStartElement("PeerIheActorDicomConfiguration");
     writer.WriteElementString("ActorName", ActorNames.Name(ActorName));
     writer.WriteElementString("SessionId", _sessionId.ToString());
     writer.WriteStartElement("DvtNode");
     writer.WriteElementString("AeTitle", _dvtNode.AeTitle);
     writer.WriteElementString("IpAddress", _dvtNode.IpAddress);
     writer.WriteElementString("PortNumber", _dvtNode.PortNumber.ToString());
     writer.WriteEndElement();
     writer.WriteStartElement("SutNode");
     writer.WriteElementString("AeTitle", _sutNode.AeTitle);
     writer.WriteElementString("IpAddress", _sutNode.IpAddress);
     writer.WriteElementString("PortNumber", _sutNode.PortNumber.ToString());
     writer.WriteEndElement();
     writer.WriteElementString("DataDirectory", _dataDirectory);
     writer.WriteElementString("StoreData", _storeData.ToString());
     writer.WriteStartElement("DefinitionFiles");
     foreach (System.String defintionFilename in _definitionFiles)
     {
         writer.WriteElementString("DefinitionFile", defintionFilename);
     }
     writer.WriteEndElement();
     writer.WriteElementString("ResultsRootDirectory", _resultsRootDirectory);
     writer.WriteEndElement();
 }
Example #2
0
        public void SetComparators(Dvtk.Comparator.BaseComparatorCollection comparatorCollection)
        {
            if (_transaction is DicomTransaction)
            {
                System.String name = System.String.Empty;

                DicomTransaction dicomTransaction = (DicomTransaction)_transaction;
                switch (dicomTransaction.Direction)
                {
                case TransactionDirectionEnum.TransactionReceived:
                    name = System.String.Format("Received by {0} from {1}", ActorNames.Name(_fromActorName), ActorNames.Name(_toActorName));
                    break;

                case TransactionDirectionEnum.TransactionSent:
                    name = System.String.Format("Sent from {0} to {1}", ActorNames.Name(_fromActorName), ActorNames.Name(_toActorName));
                    break;

                default:
                    break;
                }

                for (int i = 0; i < dicomTransaction.DicomMessages.Count; i++)
                {
                    DicomMessage dicomMessage = (DicomMessage)dicomTransaction.DicomMessages[i];

                    DvtkHighLevelInterface.Comparator.Comparator comparator = new DvtkHighLevelInterface.Comparator.Comparator(name);
                    Dvtk.Comparator.DicomComparator dicomComparator         = comparator.InitializeDicomComparator(dicomMessage);
                    if (dicomComparator != null)
                    {
                        comparatorCollection.Add(dicomComparator);
                    }
                }
            }
        }
Example #3
0
        private BaseActor CreateActor(System.String actorNameString)
        {
            BaseActor     actor     = null;
            ActorNameEnum actorName = ActorNames.NameEnum(actorNameString);

            switch (actorName)
            {
            case ActorNameEnum.AdtPatientRegistration:
                actor = new AdtPatientRegistrationActor(_actorsTransactionLog);
                break;

            case ActorNameEnum.OrderPlacer:
                actor = new OrderPlacerActor(_actorsTransactionLog);
                break;

            case ActorNameEnum.DssOrderFiller:
                actor = new DssOrderFillerActor(_actorsTransactionLog);
                break;

            case ActorNameEnum.AcquisitionModality:
                actor = new AcquisitionModalityActor(_actorsTransactionLog);
                break;

            case ActorNameEnum.ImageManager:
                actor = new ImageManagerActor(_actorsTransactionLog);
                break;

            case ActorNameEnum.ImageArchive:
                actor = new ImageArchiveActor(_actorsTransactionLog);
                break;

            case ActorNameEnum.PerformedProcedureStepManager:
                actor = new PpsManagerActor(_actorsTransactionLog);
                break;

            case ActorNameEnum.EvidenceCreator:
                actor = new EvidenceCreatorActor(_actorsTransactionLog);
                break;

//				case ActorNameEnum.ReportManager:
//					actor = new ReportManagerActor(_actorsTransactionLog);
//					break;
            case ActorNameEnum.PrintComposer:
                actor = new PrintComposerActor(_actorsTransactionLog);
                break;

            case ActorNameEnum.PrintServer:
                actor = new PrintServerActor(_actorsTransactionLog);
                break;

            case ActorNameEnum.Unknown:
            default:
                break;
            }

            return(actor);
        }
Example #4
0
 private void InitActor()
 {
     _hl7Servers       = new Hashtable();
     _hl7Clients       = new Hashtable();
     _dicomServers     = new Hashtable();
     _dicomClients     = new Hashtable();
     _actorState       = ActorStateEnum.ActorCreated;
     _dvtThreadManager = new DvtThreadManager(ActorNames.Name(_actorName));
 }
Example #5
0
 public void WriteXmlConfig(XmlTextWriter writer)
 {
     writer.WriteStartElement("IheActorConfiguration");
     writer.WriteElementString("ActorName", ActorNames.Name(_actorName));
     foreach (BaseConfig baseConfig in this)
     {
         baseConfig.WriteXmlConfig(writer);
     }
     writer.WriteEndElement();
 }
Example #6
0
        public void StartServer()
        {
            Console.WriteLine("{0}: DICOM SCP from {1} - started on port: {2}",
                              ActorNames.Name(ParentActor.ActorName),
                              ActorNames.Name(ActorName),
                              _scp.Options.DvtPort);
            SubscribeEvent();

            int delay = 0;

            if (_scp != null)
            {
                _scp.Start(delay);
            }
        }
Example #7
0
        public virtual void ApplyConfig(DicomConfig config)
        {
            if (_scp != null)
            {
                _scp.Initialize(ParentActor.DvtThreadManager);
                _scp.Options.Identifier = String.Format("{0:000}_To_{1}_From_{2}",
                                                        config.SessionId, ActorNames.Name(ParentActor.ActorName), ActorNames.Name(ActorName));

                if (config.ResultsRootDirectory.Length != 0)
                {
                    _scp.Options.StartAndEndResultsGathering = true;
                    _scp.Options.ResultsFilePerAssociation   = true;
                    _scp.Options.ResultsFileName             = String.Format("{0:000}_To_{1}_From_{2}_res.xml",
                                                                             config.SessionId, ActorNames.Name(ParentActor.ActorName), ActorNames.Name(ActorName));
                    _scp.Options.ResultsDirectory = config.ResultsRootDirectory;
                }
                else
                {
                    _scp.Options.StartAndEndResultsGathering = false;
                }

                _scp.Options.DvtAeTitle = config.DvtAeTitle;
                _scp.Options.DvtPort    = config.DvtPortNumber;

                _scp.Options.SutAeTitle   = config.SutAeTitle;
                _scp.Options.SutPort      = config.SutPortNumber;
                _scp.Options.SutIpAddress = config.SutIpAddress;

                _scp.Options.DataDirectory = config.DataDirectory;
                if (config.StoreData == true)
                {
                    _scp.Options.StorageMode = Dvtk.Sessions.StorageMode.AsMedia;
                }
                else
                {
                    _scp.Options.StorageMode = Dvtk.Sessions.StorageMode.NoStorage;
                }

                foreach (System.String filename in config.DefinitionFiles)
                {
                    _scp.Options.LoadDefinitionFile(filename);
                }
            }
        }
Example #8
0
        public void ConsoleDisplay()
        {
            Console.WriteLine("<<- {0} -------------------------------------------------------------->>", _transactionNumber);
            if (_transaction is DicomTransaction)
            {
                DicomTransaction dicomTransaction = (DicomTransaction)_transaction;
                switch (dicomTransaction.Direction)
                {
                case TransactionDirectionEnum.TransactionReceived:
                    Console.WriteLine("DICOM Transaction received by {0}", ActorNames.Name(_fromActorName));
                    Console.WriteLine("from {0}", ActorNames.Name(_toActorName));
                    break;

                case TransactionDirectionEnum.TransactionSent:
                    Console.WriteLine("DICOM Transaction sent from {0}", ActorNames.Name(_fromActorName));
                    Console.WriteLine("to {0}", ActorNames.Name(_toActorName));
                    break;

                default:
                    break;
                }
                Console.WriteLine("{0} errors, {1} warnings", _nrErrors, _nrWarnings);
                for (int i = 0; i < dicomTransaction.DicomMessages.Count; i++)
                {
                    Console.WriteLine("DICOM Message {0}...", i + 1);
                    DicomMessage dicomMessage = (DicomMessage)dicomTransaction.DicomMessages[i];
                    if (dicomMessage.CommandSet != null)
                    {
                        Console.WriteLine("Command Attributes: {0}", dicomMessage.CommandSet.Count);
                    }
                    if (dicomMessage.DataSet != null)
                    {
                        Console.WriteLine("Dataset Attributes: {0}", dicomMessage.DataSet.Count);
                    }
                }
            }
            else
            {
                Hl7Transaction hl7Transaction = (Hl7Transaction)_transaction;
            }
            Console.WriteLine("Results Filename: \"{0}\"", _resultsFilename);

            Console.WriteLine("<<------------------------------------------------------------------>>");
        }
Example #9
0
        private void ReportTransactions()
        {
            System.String message = System.String.Format("<h1>IHE {0} Integration Profile</h1>", _profileName);
            _resultsReporter.WriteHtmlInformation(message);
            _resultsReporter.WriteHtmlInformation("<h2>DICOM Actor Transactions</h2>");
            for (int i = 0; i < _actorsTransactionLog.Count; i++)
            {
                foreach (ActorsTransaction actorsTransaction in _actorsTransactionLog)
                {
                    if (actorsTransaction.TransactionNumber == i + 1)
                    {
                        actorsTransaction.ConvertResult(_applicationDirectory, _resultsDirectory);
                        System.String resultsFilename = _resultsDirectory + "\\Detail_" + actorsTransaction.ResultsFilename.Replace(".xml", ".html");
                        switch (actorsTransaction.Direction)
                        {
                        case TransactionDirectionEnum.TransactionReceived:
                            message = System.String.Format("{0:000} - <a href=\"{1}\">Received by {2} from {3}</a><br/>",
                                                           actorsTransaction.TransactionNumber,
                                                           resultsFilename,
                                                           ActorNames.Name(actorsTransaction.FromActorName),
                                                           ActorNames.Name(actorsTransaction.ToActorName));
                            _resultsReporter.WriteHtmlInformation(message);
                            break;

                        case TransactionDirectionEnum.TransactionSent:
                            message = System.String.Format("{0:000} - <a href=\"{1}\">Sent from {2} to {3}</a><br/>",
                                                           actorsTransaction.TransactionNumber,
                                                           resultsFilename,
                                                           ActorNames.Name(actorsTransaction.FromActorName),
                                                           ActorNames.Name(actorsTransaction.ToActorName));
                            _resultsReporter.WriteHtmlInformation(message);
                            break;

                        default:
                            break;
                        }
                        break;
                    }
                }
            }
        }
Example #10
0
        public void LoadConfiguration(System.String configurationFilename)
        {
            XmlTextReader reader = new XmlTextReader(configurationFilename);

            while (reader.EOF == false)
            {
                reader.ReadStartElement("IheIntegrationProfile");
                _profileName = reader.ReadElementString("IntegrationProfileName");

                while (reader.IsStartElement())
                {
                    reader.ReadStartElement("IheActorConfiguration");
                    System.String actorNameString = reader.ReadElementString("ActorName");

                    BaseActor   actor       = CreateActor(actorNameString);
                    ActorConfig actorConfig = new ActorConfig(actor.ActorName);

                    while (reader.IsStartElement())
                    {
                        reader.ReadStartElement("PeerIheActorDicomConfiguration");
                        System.String peerActorNameString = reader.ReadElementString("ActorName");

                        ActorNameEnum peerActorName = ActorNames.NameEnum(peerActorNameString);
                        DicomConfig   dicomConfig   = new DicomConfig(peerActorName);

                        dicomConfig.SessionId = UInt16.Parse(reader.ReadElementString("SessionId"));
                        reader.ReadStartElement("DvtNode");
                        dicomConfig.DvtAeTitle    = reader.ReadElementString("AeTitle");
                        dicomConfig.DvtIpAddress  = reader.ReadElementString("IpAddress");
                        dicomConfig.DvtPortNumber = UInt16.Parse(reader.ReadElementString("PortNumber"));
                        reader.ReadEndElement();
                        reader.ReadStartElement("SutNode");
                        dicomConfig.SutAeTitle    = reader.ReadElementString("AeTitle");
                        dicomConfig.SutIpAddress  = reader.ReadElementString("IpAddress");
                        dicomConfig.SutPortNumber = UInt16.Parse(reader.ReadElementString("PortNumber"));
                        reader.ReadEndElement();
                        dicomConfig.DataDirectory = reader.ReadElementString("DataDirectory");
                        System.String storeData = reader.ReadElementString("StoreData");
                        if (storeData == "True")
                        {
                            dicomConfig.StoreData = true;
                        }
                        else
                        {
                            dicomConfig.StoreData = false;
                        }
                        reader.ReadStartElement("DefinitionFiles");

                        bool readingDefinitions = true;
                        while (readingDefinitions == true)
                        {
                            dicomConfig.AddDefinitionFile(reader.ReadElementString("DefinitionFile"));
                            reader.Read();
                            if ((reader.NodeType == XmlNodeType.EndElement) &&
                                (reader.Name == "DefinitionFiles"))
                            {
                                reader.Read();
                                readingDefinitions = false;
                            }
                        }

                        dicomConfig.ResultsRootDirectory = reader.ReadElementString("ResultsRootDirectory");

                        _resultsDirectory = dicomConfig.ResultsRootDirectory;

                        reader.ReadEndElement();

                        actorConfig.Add(dicomConfig);
                    }
                    reader.ReadEndElement();

                    actor.ConfigActor(actorConfig);
                    _actors.Add(actor);
                }
                reader.ReadEndElement();
            }

            reader.Close();
        }