Beispiel #1
0
        /// <summary>
        /// Load Annotation của một ảnh để hiển thị cho người dùng xem
        /// </summary>
        /// <param name="cell"></param>
        /// <param name="fileName"></param>
        /// <param name="AutoIgnoreCropObject"></param>
        private void LoadAnnotation(MedicalViewerMultiCell cell, string fileName, bool AutoIgnoreCropObject)
        {
            return;
            int count = 1;
            #region 17.5
            //try
            //{
            //    if (fileName != null)
            //    {
            //        AnnCodecs _annCodecs = new AnnCodecs();
            //        _annCodecs.Load(fileName, cell.GetAnnotationContainer(0), 1);

            //        if (AutoIgnoreCropObject)
            //        {
            //            Leadtools.Annotations.AnnContainer _AnnContainer;
            //            lastRecObj = null;
            //            bool bHasRecObj = false;
            //            _AnnContainer = ((MedicalViewerMultiCell)_DicomMedicalViewer._medicalViewer.Cells[_DicomMedicalViewer._medicalViewerCellIndex]).GetAnnotationContainer(0);
            //            ((MedicalViewerMultiCell)_DicomMedicalViewer._medicalViewer.Cells[_DicomMedicalViewer._medicalViewerCellIndex]).SetAnnotationContainer(new AnnContainer());
            //            AnnContainer _newAnn = new AnnContainer();
            //            foreach (AnnObject AnnObj in _AnnContainer.Objects)
            //                if (AnnObj.GetType().Equals(new AnnRectangleObject().GetType()) || (AnnObj.GetType().Equals(new AnnTextObject().GetType()) && ((AnnTextObject)AnnObj).Text != null && (((AnnTextObject)AnnObj).Text.ToString() == "L" || ((AnnTextObject)AnnObj).Text.ToString() == "R")))
            //                {
            //                    if (AnnObj.GetType().Equals(new AnnRectangleObject().GetType()) && ((AnnRectangleObject)AnnObj).Name.ToUpper() == "CẮT ẢNH")
            //                    {
            //                        lastRecObj = (AnnRectangleObject)AnnObj;
            //                    }
            //                    else
            //                        _newAnn.Objects.Add(AnnObj);
            //                }



            //            ((MedicalViewerMultiCell)_DicomMedicalViewer._medicalViewer.Cells[_DicomMedicalViewer._medicalViewerCellIndex]).SetAnnotationContainer(_newAnn);
            //            ((MedicalViewerMultiCell)_DicomMedicalViewer._medicalViewer.Cells[_DicomMedicalViewer._medicalViewerCellIndex]).Invalidate();
            //        }

            //        //count += cell.Image.PageCount;
            //    }
            //}
            //catch (Exception ex)
            //{
            //}
            #endregion
            #region 17.0

            try
            {
                if (fileName != null)
                {
                    FileStream f = new FileStream(fileName, FileMode.OpenOrCreate);
                   
                    cell.LoadAnnotations(f);
                    f.Flush();
                    f.Close();
                    return;
                    if (AutoIgnoreCropObject)
                    {
                        Leadtools.Annotations.AnnContainer _AnnContainer;
                        lastRecObj = null;
                        bool bHasRecObj = false;
                        _AnnContainer = ((MedicalViewerMultiCell)_DicomMedicalViewer._medicalViewer.Cells[_DicomMedicalViewer._medicalViewerCellIndex]).GetAnnotationContainer(0);
                        ((MedicalViewerMultiCell)_DicomMedicalViewer._medicalViewer.Cells[_DicomMedicalViewer._medicalViewerCellIndex]).SetAnnotationContainer(new AnnContainer());
                        AnnContainer _newAnn = new AnnContainer();
                        foreach (AnnObject AnnObj in _AnnContainer.Objects)
                            if (AnnObj.GetType().Equals(new AnnRectangleObject().GetType()) || (AnnObj.GetType().Equals(new AnnTextObject().GetType()) && ((AnnTextObject)AnnObj).Text != null && (((AnnTextObject)AnnObj).Text.ToString() == "L" || ((AnnTextObject)AnnObj).Text.ToString() == "R")))
                            {
                                if (AnnObj.GetType().Equals(new AnnRectangleObject().GetType()) && ((AnnRectangleObject)AnnObj).Tag != null && ((AnnRectangleObject)AnnObj).Tag.ToString().ToUpper() == "2100")
                                {
                                    lastRecObj = (AnnRectangleObject)AnnObj;
                                }
                                else
                                    _newAnn.Objects.Add(AnnObj);
                            }
                        ((MedicalViewerMultiCell)_DicomMedicalViewer._medicalViewer.Cells[_DicomMedicalViewer._medicalViewerCellIndex]).SetAnnotationContainer(_newAnn);
                        ((MedicalViewerMultiCell)_DicomMedicalViewer._medicalViewer.Cells[_DicomMedicalViewer._medicalViewerCellIndex]).Invalidate();
                    }

                    //count += cell.Image.PageCount;
                }
            }
            catch (Exception ex)
            {
            }
            #endregion
        }