/// <summary>
        /// Update 3d view after directory has changed.
        /// </summary>
        /// <param name="dicomLoader">Updated dicom loader.</param>
        public void ChangeDirectory(DicomLoader dicomLoader)
        {
            _dicomLoader = dicomLoader;
            _mapper.Dispose();
            _mapper = vtkSmartVolumeMapper.New();
            _mapper.SetInput(_dicomLoader.GetOutput());
            _mapper.Update();

            _window.RenderWindow.GetRenderers().GetFirstRenderer().RemoveVolume(_volume);
            _volume.Dispose();
            _volume = vtkVolume.New();
            _volume.SetMapper(_mapper);
            _volume.Update();

            _window.RenderWindow.GetRenderers().GetFirstRenderer().AddVolume(_volume);
            _window.RenderWindow.GetRenderers().GetFirstRenderer().Render();

            SetupPlane(PlaneWidgetX);
            SetupPlane(PlaneWidgetY);
            SetupPlane(PlaneWidgetZ);

            // Render
            _window.RenderWindow.Render();
            _window.Validate();
            _window.Update();

            _clipingModule = new ClipingObject(GetObjectSize());
        }
 private void Window_Closed(object sender, EventArgs e)
 {
     temp.Dispose();
     testimgdata.Dispose();
     volumeProperty.Dispose();
     opacityTransferFunction.Dispose();
     colorTransferFunction.Dispose();
     compositeFunction.Dispose();
     volumeMapper.Dispose();
     volume.Dispose();
     aCamera.Dispose();
 }
Esempio n. 3
0
 ///<summary>Deletes all static objects created</summary>
 public static void deleteAllVTKObjects()
 {
     //clean up vtk objects
     if (reader != null)
     {
         reader.Dispose();
     }
     if (magnify != null)
     {
         magnify.Dispose();
     }
     if (image_cursor != null)
     {
         image_cursor.Dispose();
     }
     if (axes != null)
     {
         axes.Dispose();
     }
     if (axes_mapper != null)
     {
         axes_mapper.Dispose();
     }
     if (axesActor != null)
     {
         axesActor.Dispose();
     }
     if (viewer != null)
     {
         viewer.Dispose();
     }
     if (opacity_transfer_function != null)
     {
         opacity_transfer_function.Dispose();
     }
     if (color_transfer_function != null)
     {
         color_transfer_function.Dispose();
     }
     if (volume_property != null)
     {
         volume_property.Dispose();
     }
     if (composite_function != null)
     {
         composite_function.Dispose();
     }
     if (volume_mapper != null)
     {
         volume_mapper.Dispose();
     }
     if (volume != null)
     {
         volume.Dispose();
     }
     if (outline != null)
     {
         outline.Dispose();
     }
     if (outline_mapper != null)
     {
         outline_mapper.Dispose();
     }
     if (outlineActor != null)
     {
         outlineActor.Dispose();
     }
     if (ren1 != null)
     {
         ren1.Dispose();
     }
     if (renWin2 != null)
     {
         renWin2.Dispose();
     }
 }
Esempio n. 4
0
 ///<summary>Deletes all static objects created</summary>
 public static void deleteAllVTKObjects()
 {
     //clean up vtk objects
     if (ren1 != null)
     {
         ren1.Dispose();
     }
     if (renWin != null)
     {
         renWin.Dispose();
     }
     if (iren != null)
     {
         iren.Dispose();
     }
     if (camera != null)
     {
         camera.Dispose();
     }
     if (reader != null)
     {
         reader.Dispose();
     }
     if (readerSS != null)
     {
         readerSS.Dispose();
     }
     if (bounds != null)
     {
         bounds.Dispose();
     }
     if (boundsMapper != null)
     {
         boundsMapper.Dispose();
     }
     if (boundsActor != null)
     {
         boundsActor.Dispose();
     }
     if (contour != null)
     {
         contour.Dispose();
     }
     if (contourMapper != null)
     {
         contourMapper.Dispose();
     }
     if (contourActor != null)
     {
         contourActor.Dispose();
     }
     if (opacityTransferFunction != null)
     {
         opacityTransferFunction.Dispose();
     }
     if (colorTransferFunction != null)
     {
         colorTransferFunction.Dispose();
     }
     if (volumeProperty != null)
     {
         volumeProperty.Dispose();
     }
     if (compositeFunction != null)
     {
         compositeFunction.Dispose();
     }
     if (volumeMapper != null)
     {
         volumeMapper.Dispose();
     }
     if (volume != null)
     {
         volume.Dispose();
     }
     if (Sphere != null)
     {
         Sphere.Dispose();
     }
     if (Glyph != null)
     {
         Glyph.Dispose();
     }
     if (AtomsMapper != null)
     {
         AtomsMapper.Dispose();
     }
     if (Atoms != null)
     {
         Atoms.Dispose();
     }
     if (Tube != null)
     {
         Tube.Dispose();
     }
     if (BondsMapper != null)
     {
         BondsMapper.Dispose();
     }
     if (Bonds != null)
     {
         Bonds.Dispose();
     }
 }