/// <summary> /// Apply the Dicom Configuration to the Client, /// </summary> /// <param name="commonConfig">Common Configuration.</param> /// <param name="config">Dicom Configuration.</param> public override void ApplyConfig(CommonConfig commonConfig, DicomPeerToPeerConfig config) { // set up the worklist SCP WorklistScp worklistScp = new WorklistScp(); // update supported transfer syntaxes here //worklistScp.ClearTransferSyntaxes(); //worklistScp.AddTransferSyntax(HliScp.IMPLICIT_VR_LITTLE_ENDIAN); // Save the SCP and apply the configuration Scp = worklistScp; base.ApplyConfig(commonConfig, config); // set up the Modality Worklist information models _modalityWorklistInformationModel = new ModalityWorklistInformationModel(); // load the information models _modalityWorklistInformationModel.LoadInformationModel(RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, config.SourceDataDirectory)); // add any default attribute values to the information models bool overWriteExistingValue = true; _modalityWorklistInformationModel.AddDefaultAttributeToInformationModel(overWriteExistingValue, "0x00400001", VR.AE, config.FromActorAeTitle); _modalityWorklistInformationModel.AddDefaultAttributeToInformationModel(overWriteExistingValue, "0x00400002", VR.DA, System.DateTime.Now.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture)); _modalityWorklistInformationModel.AddDefaultAttributeToInformationModel(overWriteExistingValue, "0x00400003", VR.TM, System.DateTime.Now.ToString("HHmmss", System.Globalization.CultureInfo.InvariantCulture)); // add any additional attribute values to the information models //modalityWorklistInformationModel.AddAdditionalAttributeToInformationModel(overWriteExistingValue, "0x00080054", VR.AE, config.DvtAeTitle); // add the default message handlers with the information model worklistScp.AddDefaultMessageHandlers(_modalityWorklistInformationModel); }
/// <summary> /// Apply the Dicom Configuration to the Client, /// </summary> /// <param name="commonConfig">Common Configuration.</param> /// <param name="config">Dicom Configuration.</param> public override void ApplyConfig(CommonConfig commonConfig, DicomPeerToPeerConfig config) { // set up the Query/Retrieve information models QueryRetrieveInformationModels informationModels = new QueryRetrieveInformationModels(); // Do not load the Information Models here as they are loaded (refreshed) on each query // - just define the data directory informationModels.DataDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, config.SourceDataDirectory); // add any default attribute values to the information models bool overWriteExistingValue = true; informationModels.AddDefaultAttribute(overWriteExistingValue, "0x00080005", VR.CS, "ISO IR 6"); informationModels.AddDefaultAttribute(overWriteExistingValue, "0x00080090", VR.PN, "Referring^Physician^Dr"); // add any additional attribute values to the information models informationModels.AddAdditionalAttribute(overWriteExistingValue, "0x00080054", VR.AE, config.ToActorAeTitle); // set up the query/retrieve SCP QueryRetrieveScp queryRetrieveScp = new QueryRetrieveScp(); // update supported transfer syntaxes here //queryRetrieveScp.ClearTransferSyntaxes(); //queryRetrieveScp.AddTransferSyntax(HliScp.IMPLICIT_VR_LITTLE_ENDIAN); // Save the SCP and apply the configuration Scp = queryRetrieveScp; base.ApplyConfig(commonConfig, config); // add the default message handlers with the information models queryRetrieveScp.AddDefaultMessageHandlers(informationModels); }
/// <summary> /// Update the Dicom Configuration of the Server. /// </summary> /// <param name="commonConfig">Common Configuration.</param> /// <param name="clientConfig">Dicom Client Configuration.</param> public void UpdateConfig(CommonConfig commonConfig, DicomPeerToPeerConfig clientConfig) { _scp.Options.RemotePort = clientConfig.PortNumber; _scp.Options.RemoteHostName = clientConfig.ToActorIpAddress; foreach (System.String filename in clientConfig.DefinitionFiles) { _scp.Options.LoadDefinitionFile(RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, filename)); } }
/// <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); } }
/// <summary> /// Apply the Dicom Configuration to the Client, /// </summary> /// <param name="commonConfig">Common Configuration.</param> /// <param name="config">Dicom Configuration.</param> public override void ApplyConfig(CommonConfig commonConfig, DicomPeerToPeerConfig config) { // Do not load the Information Models here as hey are loaded (refreshed) on each storage commitment event // - just define the data directory _informationModels.DataDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, config.SourceDataDirectory); // add any default attribute values to the information models bool overWriteExistingValue = true; _informationModels.AddDefaultAttribute(overWriteExistingValue, "0x00080005", VR.CS, "ISO IR 6"); _informationModels.AddDefaultAttribute(overWriteExistingValue, "0x00080090", VR.PN, "Referring^Physician^Dr"); // set up the storage commit SCP StorageCommitScp storageCommitScp = new StorageCommitScp(); // update supported transfer syntaxes here //storageCommitScp.ClearTransferSyntaxes(); //storageCommitScp.AddTransferSyntax(HliScp.IMPLICIT_VR_LITTLE_ENDIAN); // Save the SCP and apply the configuration Scp = storageCommitScp; base.ApplyConfig(commonConfig, config); // use the common config option 1 to determine how the storage commitment should be handled if (ConfigOption1.Equals("DO_STORAGE_COMMITMENT_ON_SINGLE_ASSOCIATION") == true) { // add the default message handlers with the information model // - allows support for the NActionNEventReportHandler which // returns an N-EVENT-REPORT-RQ on the same association as the // N-ACTION-RQ was received. storageCommitScp.AddDefaultMessageHandlers(_informationModels, 5000); } else { // add the default message handlers storageCommitScp.AddDefaultMessageHandlers(); } }
/// <summary> /// Apply the Dicom Configuration to the Server. /// </summary> /// <param name="commonConfig">Common Configuration.</param> /// <param name="config">Dicom Configuration.</param> public virtual void ApplyConfig(CommonConfig commonConfig, DicomPeerToPeerConfig config) { if (_scp != null) { _scp.Initialize(ParentActor.ThreadManager); _scp.Options.SessionId = config.SessionId; _scp.Options.Identifier = String.Format("To_{0}_From_{1}", ParentActor.ActorName.TypeId, ActorName.TypeId); if (commonConfig.ResultsDirectory != System.String.Empty) { _scp.Options.StartAndStopResultsGatheringEnabled = true; _scp.ResultsFilePerAssociation = true; if (commonConfig.ResultsSubdirectory != System.String.Empty) { _scp.Options.ResultsDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.ResultsDirectory + "\\" + commonConfig.ResultsSubdirectory); } else { _scp.Options.ResultsDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.ResultsDirectory); } } else { _scp.Options.StartAndStopResultsGatheringEnabled = false; } _scp.Options.CredentialsFilename = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.CredentialsFilename); _scp.Options.CertificateFilename = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.CertificateFilename); _scp.Options.SecureConnection = config.SecureConnection; _scp.Options.LocalAeTitle = config.ToActorAeTitle; _scp.Options.LocalPort = config.PortNumber; _scp.Options.RemoteAeTitle = config.FromActorAeTitle; _scp.Options.RemotePort = config.PortNumber; _scp.Options.RemoteHostName = config.ToActorIpAddress; _scp.Options.AutoValidate = config.AutoValidate; _scp.Options.DataDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, config.StoreDataDirectory); if (config.StoreData == true) { _scp.Options.StorageMode = Dvtk.Sessions.StorageMode.AsMediaOnly; } else { _scp.Options.StorageMode = Dvtk.Sessions.StorageMode.NoStorage; } foreach (System.String filename in config.DefinitionFiles) { _scp.Options.LoadDefinitionFile(RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, filename)); } // finally copy any config options _configOption1 = config.ActorOption1; _configOption2 = config.ActorOption2; _configOption3 = config.ActorOption3; } }
/// <summary> /// Apply the ActorConfigs by instantiating the corresponding actors. /// </summary> public void ApplyConfig() { // set the results subdirectory name - fixed location is "resultsfiles" Config.CommonConfig.ResultsSubdirectory = "resultsfiles"; if (Config.CommonConfig.OverwriteResults == false) { // create a date/time stamp as the results subdirectory name so that the results are overwritten each time the framework is re-started Config.CommonConfig.ResultsSubdirectory = System.DateTime.Now.ToString("yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture); } _resultsDirectory = RootedBaseDirectory.GetFullPathname(Config.CommonConfig.RootedBaseDirectory, Config.CommonConfig.ResultsDirectory + "\\" + Config.CommonConfig.ResultsSubdirectory); // create the results directory System.IO.DirectoryInfo directoryInfo = Directory.CreateDirectory(_resultsDirectory); // iterate over all the actors in the configuration foreach (ActorConfig actorConfig in Config.ActorConfig) { // only instantiate those that need to be emulated if (actorConfig.ConfigState == ActorConfigStateEnum.ActorBeingEmulated) { BaseActor actor = CreateActor(actorConfig.ActorName); actor.ConfigActor(Config.CommonConfig, Config.PeerToPeerConfig); _actors.Add(actor); } } // By inspecting which actors are emulated, build a CompareCondition in such a way that // for two "inversed" transactions (transaction that have the same actor but a different Direction) // only one of the transactions will be compared to other transactions. this._actorsTransactionLog.CompareCondition = new ConditionFalse(); for (int index1 = 0; index1 < Config.ActorConfig.Count; index1++) { for (int index2 = index1 + 1; index2 < Config.ActorConfig.Count; index2++) { if ((Config.ActorConfig[index1].ConfigState == ActorConfigStateEnum.ActorBeingEmulated) && (Config.ActorConfig[index2].ConfigState == ActorConfigStateEnum.ActorBeingEmulated)) { ActorName actorName1 = Config.ActorConfig[index1].ActorName; ActorName actorName2 = Config.ActorConfig[index2].ActorName; Condition actorPairCondition1 = Condition.And( new ActorsTransactionConditionFromActor(actorName1), new ActorsTransactionConditionToActor(actorName2)); Condition actorPairCondition2 = Condition.And( new ActorsTransactionConditionFromActor(actorName2), new ActorsTransactionConditionToActor(actorName1)); Condition combinedactorPairCondition = Condition.Or(actorPairCondition1, actorPairCondition2); Condition completeCondition = Condition.And(combinedactorPairCondition, new ActorsTransactionConditionDirection(TransactionDirectionEnum.TransactionSent)); this._actorsTransactionLog.CompareCondition = Condition.Or(this._actorsTransactionLog.CompareCondition, completeCondition); } } } this._actorsTransactionLog.CompareCondition = Condition.Not(this._actorsTransactionLog.CompareCondition); }