/// <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());
        }
        //updatatuje okno wziualizacji 3d
        public void update3DVisualization(float windowLevel, float windowWidth)
        {
            this.windowLevel = windowLevel;
            this.windowWidth = windowWidth;

            spwf = vtkPiecewiseFunction.New();
            spwf.AddPoint(this.windowLevel - (this.windowWidth / 2), 0);
            spwf.AddPoint(this.windowLevel, 1);
            spwf.AddPoint(this.windowLevel + (this.windowWidth / 2), 0);
            vol.GetProperty().SetScalarOpacity(spwf);

            window.Validate();
            window.Update();
            window.RenderWindow.Render();
        }