Example #1
0
        public override bool HandleNSetRequest(DicomMessage dicomMessage)
        {
            // Try to get the IOD Name
            System.String iodName = DicomThread.GetIodNameFromDefinition(dicomMessage);

            System.String messsage = String.Format("Processed N-SET-RQ {0}", iodName);
            DicomThread.WriteInformation(messsage);

            DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.NSETRSP);

            responseMessage.Set("0x00000900", DvtkData.Dimse.VR.US, 0);

            this.Send(responseMessage);

            return(true);
        }
Example #2
0
		public override bool HandleNCreateRequest(DicomMessage dicomMessage)
		{
			// Try to get the IOD Name
			System.String iodName = DicomThread.GetIodNameFromDefinition(dicomMessage);

			// Try to get the Patient Name			
			DvtkHighLevelInterface.Values attributeValues = dicomMessage.GetAttributeValues("0x00100010");
			System.String patientName = attributeValues.GetString(1);
			System.String messsage = String.Format("Processed N-CREATE-RQ {0}: \"{1}\"", iodName, patientName);
			DicomThread.WriteInformation(messsage);

			DicomMessage responseMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.NCREATERSP);

			responseMessage.Set("0x00000900", DvtkData.Dimse.VR.US, 0);

			this.Send(responseMessage);
			return true;
		}
Example #3
0
        protected override void Execute()
        {
            //
            // The Worklist message handler.
            //
            MessageHandlerSendRandomCFindRsp wlHandler = null;

            Dvtk.DvtkDicomEmulators.WorklistMessageHandlers.CFindHandler worklistCFindHandler = null;

            if (sendRandomizeRsps)
            {
                worklistThread.WriteInformation(string.Format("Test true info model"));
                #region Нужно доделатььььььь
                // ModalityWorklistInformationModel modalityWorklistInformationModel = RisEmulator.CreateMWLInformationModel(false, worklistThread);
                // worklistCFindHandler = new Dvtk.DvtkDicomEmulators.WorklistMessageHandlers.CFindHandler(modalityWorklistInformationModel);
                #endregion
            }
            else
            {
                worklistThread.WriteInformation(string.Format("sending randomized responses"));
                wlHandler = new MessageHandlerSendRandomCFindRsp();
                RandomizeDatasets();
                wlHandler.setRandomDatasets(randomizedDatasets);
            }

            //
            // The MPPS message handlers.
            //
            Dvtk.DvtkDicomEmulators.MppsMessageHandlers.NCreateHandler mppsNCreateHandler = new Dvtk.DvtkDicomEmulators.MppsMessageHandlers.NCreateHandler();
            Dvtk.DvtkDicomEmulators.MppsMessageHandlers.NSetHandler    mppsNSetHandler    = new Dvtk.DvtkDicomEmulators.MppsMessageHandlers.NSetHandler();
            MessageHandlerShowMPPSStatus messageHandlerShowMPPSStatus = new MessageHandlerShowMPPSStatus();

            //
            // Create the actual SCP's
            //
            if (this.mppsOptions.LocalPort == this.worklistOptions.LocalPort)
            {
                WriteWarning("Worklist SCP and MPPS are configured to listen to the same port. Only one DicomThread is started using the settings from the Worklist SCP");

                RISScp worklistMppsScp = new RISScp("Worklist_MPPS_SCP");
                worklistMppsScp.Initialize(this);
                worklistMppsScp.Options.DeepCopyFrom(this.worklistOptions);
                worklistMppsScp.Options.Identifier = "Worklist_MPPS_SCP";
                worklistMppsScp.setSupportedTS(selectedTSList);

                if (sendRandomizeRsps)
                {
                    worklistThread.WriteInformation(string.Format("Test true"));
                    //worklistMppsScp.AddToFront(worklistCFindHandler);
                }
                else
                {
                    worklistMppsScp.AddToFront(wlHandler);
                }

                worklistMppsScp.AddToFront(messageHandlerShowMPPSStatus);
                //worklistMppsScp.AddToFront(mppsNCreateHandler);
                //worklistMppsScp.AddToFront(mppsNSetHandler);

                worklistMppsScp.Start();
            }
            else
            {
                RISScp mppsScp = new RISScp("MPPS_SCP");
                mppsScp.Initialize(this);
                mppsScp.Options.DeepCopyFrom(this.mppsOptions);
                mppsScp.Options.Identifier = "MPPS_SCP";
                mppsScp.setSupportedTS(selectedTSList);

                RISScp worklistScp = new RISScp("Worklist_SCP");
                worklistScp.Initialize(this);
                worklistScp.Options.DeepCopyFrom(this.worklistOptions);
                worklistScp.Options.Identifier = "Worklist_SCP";
                //worklistScp.setSupportedTS(selectedTSList);

                // Add the message handlers.
                if (sendRandomizeRsps)
                {
                    worklistThread.WriteInformation(string.Format("Test true"));
                    //worklistScp.AddToFront(worklistCFindHandler);
                }
                else
                {
                    worklistScp.AddToFront(wlHandler);
                }

                mppsScp.AddToFront(messageHandlerShowMPPSStatus);
                //mppsScp.AddToFront(mppsNCreateHandler);
                //mppsScp.AddToFront(mppsNSetHandler);

                worklistScp.Start();
                mppsScp.Start();
            }
        }
Example #4
0
        private bool HandleSubOperation(System.String moveDestinationAE, System.String dcmFilename, int subOperationIndex)
        {
            SCU storageScu = new SCU(true);

            storageScu.Initialize(DicomThread.ThreadManager);

            storageScu.Options.Identifier = "StorageSubOperationAsScu";

            if (DicomThread.Options.StartAndEndResultsGathering == true)
            {
                storageScu.Options.StartAndEndResultsGathering = true;
                storageScu.Options.ResultsFilePerAssociation   = false;

                System.String filenameFormat  = DicomThread.Options.ResultsFileName.Replace("_res", "_StorageSubOperationAsScu{0}_res");
                System.String resultsFilename = String.Format(filenameFormat, subOperationIndex);
                storageScu.Options.ResultsFileName  = resultsFilename;
                storageScu.Options.ResultsDirectory = DicomThread.Options.ResultsDirectory;

                System.String message = String.Format("StorageSubOperation filename: {0}", storageScu.Options.ResultsDirectory + "Detail_" + storageScu.Options.ResultsFileName);
                DicomThread.WriteInformation(message);
            }
            else
            {
                storageScu.Options.StartAndEndResultsGathering = false;
            }

            storageScu.Options.DvtAeTitle = DicomThread.Options.DvtAeTitle;
            storageScu.Options.DvtPort    = DicomThread.Options.DvtPort;

            storageScu.Options.SutAeTitle   = moveDestinationAE;
            storageScu.Options.SutPort      = DicomThread.Options.SutPort;
            storageScu.Options.SutIpAddress = DicomThread.Options.SutIpAddress;

            storageScu.Options.DataDirectory = DicomThread.Options.DataDirectory;
            storageScu.Options.StorageMode   = Dvtk.Sessions.StorageMode.AsDataSet;

//			foreach (System.String filename in config.DefinitionFiles)
//			{
//				storageScu.Options.LoadDefinitionFile(filename);
//			}

            System.String       sopClassUid = "1.2.840.10008.5.1.4.1.1.7";
            PresentationContext presentationContext
                = new PresentationContext(sopClassUid,                 // Abstract Syntax Name
                                          "1.2.840.10008.1.2");        // Transfer Syntax Name(s)

            PresentationContext[] presentationContexts = new PresentationContext[1];
            presentationContexts[0] = presentationContext;

            DicomMessage storageMessage = new DicomMessage(DvtkData.Dimse.DimseCommand.CSTORERQ);

            storageMessage.DataSet.Read(dcmFilename, storageScu);

            storageScu.NonThreadedStart();

            bool sendResult = false;

            try
            {
                sendResult = storageScu.SendAssociation(storageMessage, presentationContexts);
            }
            catch (System.Exception)
            {
                DicomThread.WriteError("Storage Sub-Operation As SCU Failed");
            }
            finally
            {
                storageScu.NonThreadedStop();
            }

            return(sendResult);
        }