Esempio n. 1
0
        private vtkGenericRenderWindowInteractor GetInteractor(IPresentationImage selectedImage)
        {
            if (selectedImage == null)
            {
                return(null);
            }

            VolumePresentationImage image = selectedImage as VolumePresentationImage;

            if (image == null)
            {
                return(null);
            }

            VolumePresentationImageRenderer renderer = image.ImageRenderer as VolumePresentationImageRenderer;

            if (renderer == null)
            {
                return(null);
            }

            vtkGenericRenderWindowInteractor interactor = vtkGenericRenderWindowInteractor.SafeDownCast(renderer.Interactor);

            return(interactor);
        }
        public void CreateVolume()
        {
            if (this.ImageViewer == null)
            {
                return;
            }

            if (this.ImageViewer.SelectedImageBox == null)
            {
                return;
            }

            IDisplaySet             selectedDisplaySet = this.ImageViewer.SelectedImageBox.DisplaySet;
            VolumePresentationImage image = new VolumePresentationImage(selectedDisplaySet);

            AddTissueLayers(image);

            IDisplaySet displaySet = new DisplaySet(String.Format("{0} (3D)", selectedDisplaySet.Name), String.Format("VTK.{0}", Guid.NewGuid().ToString()));

            displaySet.PresentationImages.Add(image);
            this.ImageViewer.LogicalWorkspace.ImageSets[0].DisplaySets.Add(displaySet);

            IImageBox imageBox = this.ImageViewer.SelectedImageBox;

            imageBox.DisplaySet = displaySet;
            imageBox.Draw();
            imageBox[0, 0].Select();

            NotifyAllPropertiesChanged();
        }
        private void AddTissueLayers(VolumePresentationImage image)
        {
            GraphicCollection layers = image.TissueLayers;

            TissueSettings tissue = new TissueSettings();

            tissue.SelectPreset("Bone");
            layers.Add(new VolumeGraphic(tissue));

            tissue = new TissueSettings();
            tissue.SelectPreset("Blood");
            layers.Add(new VolumeGraphic(tissue));
        }