public void AddFilmPage(PageModel pageModel, bool ifPageNo) { try { Logger.LogFuncUp(); this.FilmTitleViewModel.ResetModel(pageModel.PageTitleInfoModel); var rootCell = this._filmingViewerControl.LayoutManager.RootCell; rootCell.RemoveAll(); //rootCell.BorderThickness = -1D; rootCell.SetBorderThicknessWithoutRefresh(-1D); this._filmingViewerControl.LayoutManager.SetLayoutByXML(pageModel.Layout, new Func <MedViewerLayoutCell>(() => { return(new MedViewerLayoutCell() { BorderThickness = -1D, CellControlMargin = 0 }); })); this._filmingViewerControl.GraphicContextMenu.GraphicsStatisticItemsMode = pageModel.PageGraphicOperationModel.GraphicsStatisticItemsMode; List <MedViewerControlCell> controlCells = new List <MedViewerControlCell>(); foreach (var cellModel in pageModel.CellModels) { var cell = new MedViewerControlCell(); controlCells.Add(cell); var sop = cellModel.Sop as ImageSop; if (null != sop) { var displayData = FilmPageControl.DataAccessorInstance.CreateImageDataForFilming(sop.DicomSource, sop.GetNormalizedPixelData(), cellModel.Ps, cellModel.PtUnit); cell.Image.AddPage(displayData); //图元颜色修改 if (pageModel.EFilmModel.IfSaveImageAsGrayScale) { var overlayGraphics = displayData.GetOverlay(OverlayType.Graphics) as OverlayGraphics; if (null != overlayGraphics) { foreach (var graphic in overlayGraphics.Graphics) { var parent = graphic as IComposed; if (parent != null) { foreach (var obj in parent.Components) { var graphicBase = obj as DynamicGraphicBase; if (graphicBase != null) { graphicBase.GeometryProperty.NormalColor = Colors.White; //设置打印图元线颜色 if (!(graphicBase is GraphicText)) { graphicBase.GeometryProperty.Thickness = 2D; //设置打印图元线宽 } } } } else { var graphicBase = graphic as DynamicGraphicBase; if (null != graphicBase) { graphicBase.GeometryProperty.NormalColor = Colors.White; //设置打印图元线颜色 if (!(graphicBase is GraphicText)) { graphicBase.GeometryProperty.Thickness = 2D; //设置打印图元线宽 } } } } } } //四角信息配置(出厂and高级应用) var overlayFilmTxt = displayData.GetOverlay(OverlayType.FilmingText) as OverlayFilmingText; if (null == overlayFilmTxt) { return; } overlayFilmTxt.GraphicFilmingImageText.LeftMargin = 0; overlayFilmTxt.GraphicFilmingImageText.RightMargin = 0; overlayFilmTxt.GraphicFilmingImageText.BottomMargin = 0; overlayFilmTxt.GraphicFilmingImageText.TopMargin = 0; overlayFilmTxt.GraphicFilmingImageText.FontStyle = "Arial"; overlayFilmTxt.GraphicFilmingImageText.ImgTxtMgPostion = cellModel.ImgTxTPosition; overlayFilmTxt.GraphicFilmingImageText.IsShowOrientation = (cellModel.MgOrientationIsShow == "1"?true:false); overlayFilmTxt.GraphicFilmingImageText.IsImgTxtShowFromF1 = (cellModel.IsShowImgTxt == "1" ? true : false); overlayFilmTxt.GraphicFilmingImageText.IsRulerShowFromF1 = (cellModel.IsShowRuler == "1" ? true : false); if (ImgTxtDisplayState.All == displayData.PState.DisplayMode || ImgTxtDisplayState.Customization == displayData.PState.DisplayMode) { string modalities; mcsf_clr_systemenvironment_config.GetModalityName(out modalities); if (modalities == "DBT") { if (null != overlayFilmTxt.Page && null != overlayFilmTxt.Page.Image && null != overlayFilmTxt.Page.Image.Cell) { var config = overlayFilmTxt.Page.Image.Cell.ViewerControlSetting.Configuration; config.EntryConfig.ImageTextMap = Printers.Instance.Modality2FilmingImageTextConfigPath; } } //overlayFilmTxt.ConfigStandardImageText(displayData.ImageHeader.DicomHeader, // cellModel.ImgTxtFilePathOrContent, // cellModel.ImgTxtItemPathOrContent); overlayFilmTxt.GraphicFilmingImageText.GraphicImageText.SerializedContent = cellModel.ImgTxtFilePathOrContent; } else if (ImgTxtDisplayState.FromApplication == displayData.PState.DisplayMode) { //ImageTextConfigContent imageTextConfigContent = new ImageTextConfigContent() // { // ImageTextFileContent = cellModel.ImgTxtFilePathOrContent, // //TextItemFileContent = cellModel.ImgTxtItemPathOrContent // }; //overlayFilmTxt.ConfigApplicationConfigReader(displayData.ImageHeader.DicomHeader, imageTextConfigContent); overlayFilmTxt.GraphicFilmingImageText.GraphicImageText.SerializedContent = cellModel.ImgTxtFilePathOrContent; overlayFilmTxt.GraphicFilmingImageText.GraphicImageText.SerializedDataHeader = cellModel.ImgTxTContent; } //定位像参考线 if (!string.IsNullOrEmpty(cellModel.LocalizedImageUid) && null != cellModel.LocalizedImageSop) { DisplayData smallDisplayData = DataAccessorInstance.CreateImageData(cellModel.LocalizedImageSop.DicomSource, (cellModel.LocalizedImageSop as ImageSop).GetNormalizedPixelData()); ImgTxtPosEnum pos = ImgTxtPosEnum.Center; if (!string.IsNullOrEmpty(cellModel.LocalizedImagePSInfo)) { smallDisplayData.PSXml = cellModel.LocalizedImagePSInfo; smallDisplayData.DeserializePSInfo(); } if (!string.IsNullOrEmpty(cellModel.LocalizedImagePosion)) { Enum.TryParse(cellModel.LocalizedImagePosion, out pos); overlayFilmTxt.GraphicFilmingImageText.ReferenceLinePos = pos; overlayFilmTxt.GraphicFilmingImageText.HasReferenceLine = true; } DataAccessorInstance.AddOverlayLocalizedImage(displayData, smallDisplayData, pos); if (pageModel.EFilmModel.IfSaveImageAsGrayScale) { var overlayReferenceLine = smallDisplayData.Overlays.FirstOrDefault(n => n is OverlayReferenceLine2Filming) as OverlayReferenceLine2Filming; if (overlayReferenceLine != null) { overlayReferenceLine.LineColor = Colors.White; //设置打印参考线颜色 //overlayReferenceLine.LineThickness = 0.3D; //设置打印参考线线宽 } } } //比例尺 var overlayRuler = displayData.GetOverlay(OverlayType.Ruler) as OverlayRuler; if (null != overlayRuler) { overlayRuler.IsVisible = cellModel.RulerVisible; overlayRuler.GraphicRuler.MinimalCellSize = 0D; } var tagName2Value = new Dictionary <uint, string>(); tagName2Value.Add(ServiceTagName.PatientAge, string.Empty); tagName2Value.Add(ServiceTagName.PatientID, string.Empty); tagName2Value.Add(ServiceTagName.PatientName, string.Empty); tagName2Value.Add(ServiceTagName.PatientSex, string.Empty); tagName2Value.Add(ServiceTagName.StudyID, string.Empty); tagName2Value.Add(ServiceTagName.SeriesInstanceUID, string.Empty); tagName2Value.Add(ServiceTagName.StudyInstanceUID, string.Empty); tagName2Value.Add(ServiceTagName.Modality, string.Empty); Widget.GetTagValue(cell, tagName2Value); cellModel.PatientAge = tagName2Value[ServiceTagName.PatientAge]; cellModel.PatientId = tagName2Value[ServiceTagName.PatientID]; cellModel.PatientsName = tagName2Value[ServiceTagName.PatientName]; cellModel.PatientsSex = tagName2Value[ServiceTagName.PatientSex]; cellModel.StudyId = tagName2Value[ServiceTagName.StudyID]; cellModel.SeriesUid = tagName2Value[ServiceTagName.SeriesInstanceUID]; cellModel.StudyInstanceUid = tagName2Value[ServiceTagName.StudyInstanceUID]; cellModel.Modality = tagName2Value[ServiceTagName.Modality]; } } this._filmingViewerControl.AddCells(controlCells); foreach (var controlCell in controlCells) { controlCell.Refresh(); } //only for PT this.PageTitle_AddDrugForPT(); var eFilmModel = pageModel.EFilmModel; if (eFilmModel.IfSaveEFilm) { var sampleCell = controlCells.FirstOrDefault(c => c != null && c.Image != null && c.Image.CurrentPage != null); if (!eFilmModel.IsMixed) { eFilmModel.FillTagsFrom(sampleCell); string modalities; mcsf_clr_systemenvironment_config.GetModalityName(out modalities); eFilmModel.EFilmModality = modalities; } } if (pageModel.EFilmModel.PeerNode.NodeType == PeerNodeType.GENERAL_PRINTER) { #region [--纸质打印--] this.PrintByGeneralPrinter(eFilmModel, ifPageNo); #endregion } else { #region [--胶片打印--] this.GeneralFilms(eFilmModel, ifPageNo); #endregion } ClearViewerControl(_filmingViewerControl); Logger.LogFuncDown(); } catch (Exception ex) { Logger.LogFuncException(ex.Message + ex.StackTrace); } }