예제 #1
0
        private string ToolTipTextFromAimAnnotation(aim_dotnet.Annotation annotation)
        {
            var toolTipText = String.Empty;

            toolTipText += annotation.Name + "\n";
            toolTipText += annotation.DateTime.ToString() + "\n";
            toolTipText += annotation.CodeValue + "\n";
            toolTipText += annotation.CodeMeaning += "\n";
            toolTipText += annotation.Comment;

            return(toolTipText);
        }
        public static string GetAimHtml(aim_dotnet.Annotation annotation)
        {
            if (annotation == null)
            {
                return(GetEmptyHtml());
            }

            switch (annotation.AnnotationKind)
            {
            case aim_dotnet.AnnotationKind.AK_ImageAnnotation:
                return(GetImageAnnotationHtml(annotation as aim_dotnet.ImageAnnotation));

            case aim_dotnet.AnnotationKind.AK_AnnotationOfAnnotation:
                return(GetAnnotationOfAnnotationHtml(annotation as aim_dotnet.AnnotationOfAnnotation));
            }

            Debug.Assert(false, "Uknown Annotation Type");
            Platform.Log(LogLevel.Error, "Annotation Display Formatting (HTML): unknown annotation type");
            return("Unknown Annotation Type");
        }
예제 #3
0
        private aim_dotnet.ImageStudy AimStudyFromAnnotation(aim_dotnet.Annotation annotation)
        {
            aim_dotnet.ImageAnnotation imageAnnotation = annotation as aim_dotnet.ImageAnnotation;

            if (imageAnnotation == null || imageAnnotation.ImageReferenceCollection.Count == 0)
            {
                return(null);
            }

            aim_dotnet.DICOMImageReference dicomImageReference = imageAnnotation.ImageReferenceCollection[0] as aim_dotnet.DICOMImageReference;
            if (dicomImageReference == null)
            {
                return(null);
            }

            if (dicomImageReference.Study == null || dicomImageReference.Study.Series == null ||
                dicomImageReference.Study.Series.ImageCollection == null || dicomImageReference.Study.Series.ImageCollection.Count == 0)
            {
                return(null);
            }

            return(dicomImageReference.Study);
        }
 internal Aim3ObjectReference(aim_dotnet.Annotation aimAnnotation)
 {
     AimAnnotation = aimAnnotation;
 }
예제 #5
0
 public string GetSeriesUIDFromAimAnnotation(aim_dotnet.Annotation annotation)
 {
     return(AimStudyFromAnnotation(annotation).Series.InstanceUID);
 }
예제 #6
0
        public void ShowImageWithAnnotation(string aimUid)
        {
            if (_activeViewer == null)
            {
                return;
            }

            aim_dotnet.Annotation annotationToShow = null;
            foreach (var annotation in AvailableAnnotations)
            {
                if (annotation.UniqueIdentifier == aimUid)
                {
                    annotationToShow = annotation;
                    break;
                }
            }

            if (annotationToShow == null)
            {
                _activeViewer.DesktopWindow.ShowMessageBox("Could not locate annotation (UID = " + aimUid + ").", MessageBoxActions.Ok);
                return;
            }

            var studyToOpen = AimStudyFromAnnotation(annotationToShow);

            if (studyToOpen == null)
            {
                _activeViewer.DesktopWindow.ShowMessageBox("Error reading image information (annotation UID = " + aimUid + ").", MessageBoxActions.Ok);
                return;
            }

            // Search displayed images first
            foreach (var imageBox in _activeViewer.PhysicalWorkspace.ImageBoxes)
            {
                if (imageBox.DisplaySet == null || imageBox.DisplaySet.PresentationImages == null || imageBox.DisplaySet.PresentationImages.Count == 0)
                {
                    continue;
                }

                var imageSopProvider = imageBox.DisplaySet.PresentationImages[0] as IImageSopProvider;
                if (imageSopProvider == null)
                {
                    continue;
                }

                if (imageSopProvider.ImageSop.StudyInstanceUid == studyToOpen.InstanceUID &&
                    imageSopProvider.ImageSop.SeriesInstanceUid == studyToOpen.Series.InstanceUID)
                {
                    foreach (var presentationImage in imageBox.DisplaySet.PresentationImages)
                    {
                        imageSopProvider = presentationImage as IImageSopProvider;
                        if (imageSopProvider == null)
                        {
                            continue;
                        }
                        if (imageSopProvider.ImageSop.SopInstanceUid == studyToOpen.Series.ImageCollection[0].SopInstanceUID)
                        {
                            try
                            {
                                imageBox.TopLeftPresentationImage = presentationImage;
                                imageBox.Tiles[0].Select();
                                SelectAimGraphic(presentationImage, aimUid);
                                imageBox.Draw();

                                return;
                            }
                            catch (Exception ex)
                            {
                                ExceptionHandler.Report(ex, _desktopWindow);
                            }
                        }
                    }
                }
            }

            // Search other available images
            foreach (var imageSet in _activeViewer.LogicalWorkspace.ImageSets)
            {
                foreach (var displaySet in imageSet.DisplaySets)
                {
                    if (displaySet.PresentationImages.Count > 0)
                    {
                        var imageSopProvider = displaySet.PresentationImages[0] as IImageSopProvider;
                        if (imageSopProvider == null)
                        {
                            continue;
                        }

                        if (imageSopProvider.ImageSop.StudyInstanceUid == studyToOpen.InstanceUID &&
                            imageSopProvider.ImageSop.SeriesInstanceUid == studyToOpen.Series.InstanceUID)
                        {
                            foreach (var presentationImage in displaySet.PresentationImages)
                            {
                                imageSopProvider = presentationImage as IImageSopProvider;
                                if (imageSopProvider == null)
                                {
                                    continue;
                                }
                                if (imageSopProvider.ImageSop.SopInstanceUid == studyToOpen.Series.ImageCollection[0].SopInstanceUID)
                                {
                                    try
                                    {
                                        var targetImageBox = _activeViewer.PhysicalWorkspace.SelectedImageBox ??
                                                             (_activeViewer.PhysicalWorkspace.ImageBoxes.Count > 0 ? _activeViewer.PhysicalWorkspace.ImageBoxes[0] : null);
                                        if (targetImageBox == null)
                                        {
                                            _activeViewer.DesktopWindow.ShowMessageBox("Failed to find available display", MessageBoxActions.Ok);
                                            Platform.Log(LogLevel.Error, "Failed to locate a target ImageBox to display requested annotation (aimUID=" + aimUid + ").");
                                            return;
                                        }

                                        var targetDisplaySet        = displaySet.CreateFreshCopy();
                                        var targetPresentationImage = FindRequiredImage(targetDisplaySet.PresentationImages,
                                                                                        studyToOpen.InstanceUID, studyToOpen.Series.InstanceUID,
                                                                                        studyToOpen.Series.ImageCollection[0].SopInstanceUID);
                                        if (targetPresentationImage == null)
                                        {
                                            _activeViewer.DesktopWindow.ShowMessageBox("Failed to find required image", MessageBoxActions.Ok);
                                            Platform.Log(LogLevel.Error, "Failed to locate a target ImageBox to display requested annotation (aimUID=" + aimUid + ").");
                                            return;
                                        }

                                        targetImageBox.DisplaySet = targetDisplaySet;
                                        targetImageBox.TopLeftPresentationImage = targetPresentationImage;
                                        targetImageBox.Tiles[0].Select();
                                        SelectAimGraphic(targetPresentationImage, aimUid);
                                        targetImageBox.Draw();

                                        return;
                                    }
                                    catch (Exception ex)
                                    {
                                        ExceptionHandler.Report(ex, _desktopWindow);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }