Пример #1
0
        public void SendDownloadRequest(object param)
        {
            try
            {
                DicomDataSet ds = new DicomDataSet();

                //you can set what ever elements you need, PatientID, StudyInstanceUID, SeriesInstnaceUID...
                //if you need to create private tags to set custom information we have to do it like this:
                // check this link for more information about creating custom tags:
                //https://www.leadtools.com/help/leadtools/v175/dh/di/leadtools.dicom~leadtools.dicom.dicomdataset~createprivatecreatordataelement.html

                {
                    DicomElement privateCreatorElement = ds.CreatePrivateCreatorDataElement(null, 0x0017, 0x0012, "DownloadService");

                    DicomElement element = ds.InsertElement(null, false, CustomTags.JobID, DicomVRType.LT, false, 0);

                    if (null != element)
                    {
                        ds.SetStringValue(element, param.ToString(), DicomCharacterSetType.Default); //(0x11,0x0010)
                    }
                    else
                    {
                        throw new Exception("Can't Insert Element");
                    }
                }

                byte presentation = GetPresentation();

                SendNActionRequest(presentation, 1, CustomUID.DownloadImagesClass, CustomUID.DownloadImagesInstance, 1, ds);

                Wait(); //blocks until we receive the response from the server
                Release();

                if (_status != DicomCommandStatusType.Success)
                {
                    throw new ApplicationException("Error adding a c-move job: " + _status.ToString());
                }
                else
                {
                    //success, the server received the request and processing the message.
                }
            }
            catch (Exception e)
            {
                Logger.Global.Log(string.Empty, string.Empty, -1, string.Empty, string.Empty, -1, DicomCommandType.Undefined, DateTime.Now,
                                  LogType.Information, MessageDirection.None, e.Message, null, null);

                throw;
            }
        }