private void SendImage(int cellIndex, string filmingIdentifier = FilmingIdentifier) { var dicomConvertorProxyFactory = new McsfDicomConvertorProxyFactory(); var dicomConvertorProxy = dicomConvertorProxyFactory.CreateDicomConvertorProxy(); var dicomDataHeader = dicomConvertorProxy.LoadFile(DicomFilePath, GetCommunicationProxy()); //2. Insert private tag var privateTag0X00613102String = CreateprivateTag0X00613102String(filmingIdentifier, cellIndex); SplitInfoString(privateTag0X00613102String); var privateTag0X00613102Value = System.Text.Encoding.UTF8.GetBytes(privateTag0X00613102String); //createPrivateTag var element = DicomAttribute.CreateAttribute(0x00613102); if (!element.SetBytes(0, privateTag0X00613102Value)) { Logger.Instance.LogDevError("Failed to Insert NULL " + privateTag0X00613102String + " to Data header"); } dicomDataHeader.AddDicomAttribute(element); //3.Send dataHeader byte[] imageData; dicomDataHeader.Serialize(out imageData); AsyncSendData(CommunicationNodeName.CreateCommunicationProxyName(McsfFilmingName, FrontEnd), imageData); }
public void CreateFilmBoxList(PeerNode peer, Core.ICommunicationProxy proxy, List <CardModel> cardList) { try { Logger.LogFuncUp(); var patient = new Patient(); //Job Info Title CurrentPeer = peer; var cellModels = FilmPageModel.CellModels.ToList(); patient.PatientAge = string.Join(";", cellModels.Select(c => c.PatientAge).Where(s => !string.IsNullOrWhiteSpace(s)).Distinct()); patient.PatientID = string.Join(";", cellModels.Select(c => c.PatientId).Where(s => !string.IsNullOrWhiteSpace(s)).Distinct()); patient.PatientName = string.Join(";", cellModels.Select(c => c.PatientsName).Where(s => !string.IsNullOrWhiteSpace(s)).Distinct()); patient.PatientSex = string.Join(";", cellModels.Select(c => c.PatientsSex).Where(s => !string.IsNullOrWhiteSpace(s)).Distinct()); patient.StudyID = string.Join(";", cellModels.Select(c => c.StudyId).Where(s => !string.IsNullOrWhiteSpace(s)).Distinct()); CurrentPatient = patient; // var printSetting = new PrintSetting(); PrintSetting.Copies = uint.Parse(PrinterSettingInfoModel.CurrCopyCount); PrintSetting.FilmDestination = this.PrinterSettingInfoModel.CurrFilmDestination; PrintSetting.FilmingDateTime = DateTime.Now; PrintSetting.IfSaveElectronicFilm = bool.Parse(this.PrinterSettingInfoModel.IfSave); PrintSetting.MediaType = this.PrinterSettingInfoModel.CurrMediumType; PrintSetting.Priority = PRINT_PRIORITY.MEDIUM; PrintSetting.IfColorPrint = bool.Parse(this.PrinterSettingInfoModel.IfColorPrint); var filmPageModel = FilmPageModel; var filmBox = new FilmingPrintJob.Types.FilmBox.Builder(); var dicomFilePath = Widget.CreatePrintImageFullPath(0, 0); var dicomConvertorProxy = McsfDicomConvertorProxyFactory.Instance().CreateDicomConvertorProxy(); dicomConvertorProxy.SaveFile(filmPageModel.EFilmModel.DataHeaderForPrint, dicomFilePath, proxy); var imageBoxForPrint = new FilmingPrintJob.Types.ImageBox.Builder { ImagePath = dicomFilePath }; //{ ImagePath = filmPageModel.EFilmModel.EFilmFilePath }; filmBox.AddImageBox(imageBoxForPrint); filmBox.FilmSize = this.PrinterSettingInfoModel.CurrFilmSize; filmBox.Orientation = this.PrinterSettingInfoModel.CurrOrientation == "0" ? FilmingPrintJob.Types.Orientation.PORTRAIT : FilmingPrintJob.Types.Orientation.LANDSCAPE; filmBox.Layout = "STANDARD\\1,1"; filmBox.PatientName = filmPageModel.PageTitleInfoModel.PatientName; filmBox.StudyInstanceUid = string.Join(";", filmPageModel.CellModels.Select(c => c.StudyInstanceUid).Where(s => !string.IsNullOrWhiteSpace(s)).Distinct()); //fill sopinstance list for print status updating var sopInstanceUids = filmPageModel.CellModels.Select(c => c.SopUid).Distinct(); foreach (var uid in sopInstanceUids) { var imageBoxForPrintStatusUpdating = new FilmingPrintJob.Types.ImageBox.Builder { OriginSOPInstanceUID = uid }; filmBox.AddImageBox(imageBoxForPrintStatusUpdating); } //fill seriesUid list for print status updating var seriesUids = filmPageModel.CellModels.Select(c => c.SeriesUid).Distinct().Where(s => !string.IsNullOrWhiteSpace(s)); filmBox.AddRangeSeriesInstanceUidList(seriesUids); filmBoxList.Add(filmBox); Logger.LogFuncDown(); } catch (Exception ex) { Logger.LogFuncException(ex.Message + ex.StackTrace); } }