public void ChangeDirectory(String directoryPath) { _dicomReader.Dispose(); _dicomReader = new vtkDICOMImageReader(); _dicomReader.SetDirectoryName(directoryPath); _dicomReader.Update(); }
public void ChangeDirectory(String directoryPath) { _dicomReader.Dispose(); _dicomReader = new vtkDICOMImageReader(); _dicomReader.SetDirectoryName(directoryPath); _dicomReader.Update(); }
public DicomLoader(String directoryPath) { _dicomReader = new vtkDICOMImageReader(); _dicomReader.SetDirectoryName(directoryPath); _dicomReader.Update(); int a = _dicomReader.GetWidth(); int b = _dicomReader.GetHeight(); }
public Form1() { InitializeComponent(); dicomReader = vtkDICOMImageReader.New(); dicomReader.SetDirectoryName(directoryName); dicomReader.Update(); }
public DicomLoader(String directoryPath) { _dicomReader = new vtkDICOMImageReader(); _dicomReader.SetDirectoryName(directoryPath); _dicomReader.Update(); int a = _dicomReader.GetWidth(); int b = _dicomReader.GetHeight(); }
public Form1() { InitializeComponent(); dicomReader = vtkDICOMImageReader.New(); dicomReader.SetDirectoryName(directoryName); dicomReader.Update(); }
public Visualization2D(RenderWindowControl window, vtkDICOMImageReader dicomReader) { this.window = window; this.dicomReader = dicomReader; vtkRenderer renderer = window.RenderWindow.GetRenderers().GetFirstRenderer(); vtkRenderWindowInteractor renderWindowInteractor = window.RenderWindow.GetInteractor(); viewer = vtkImageViewer2.New(); viewer.OffScreenRenderingOn(); viewer.SetupInteractor(renderWindowInteractor); viewer.SetRenderer(renderer); }
public Visualization2D(RenderWindowControl window, vtkDICOMImageReader dicomReader) { this.window = window; this.dicomReader = dicomReader; vtkRenderer renderer = window.RenderWindow.GetRenderers().GetFirstRenderer(); vtkRenderWindowInteractor renderWindowInteractor = window.RenderWindow.GetInteractor(); viewer = vtkImageViewer2.New(); viewer.OffScreenRenderingOn(); viewer.SetupInteractor(renderWindowInteractor); viewer.SetRenderer(renderer); }
//wizualizacja 3d ----------------------------------------------------------------- public Visualization3D(RenderWindowControl window, vtkDICOMImageReader dicomReader) { this.window = window; this.dicomReader = dicomReader; this.presetMapper = new PresetMapper(); vtkRenderer renderer = window.RenderWindow.GetRenderers().GetFirstRenderer(); vtkSmartVolumeMapper mapper = vtkSmartVolumeMapper.New(); vol = vtkVolume.New(); vtkLookupTable bwLut = vtkLookupTable.New(); bwLut.SetTableRange(0, 2000); bwLut.SetSaturationRange(0, 0); bwLut.SetHueRange(0, 0); bwLut.SetValueRange(0, 1); bwLut.Build(); //effective built vtkImageMapToColors sagittalColors = vtkImageMapToColors.New(); sagittalColors.SetInputConnection(dicomReader.GetOutputPort()); sagittalColors.SetLookupTable(bwLut); sagittalColors.Update(); vtkImageActor sagittal = vtkImageActor.New(); sagittal.SetInput(sagittalColors.GetOutput()); sagittal.SetDisplayExtent(117, 117, 0, 173, 1, 180); vtkImageReslice reslicer = vtkImageReslice.New(); reslicer.SetResliceAxesDirectionCosines(1, 0, 0, 2, 0, 0, 0, 0, 0); mapper.SetInputConnection(dicomReader.GetOutputPort()); this.setColorFunction(); this.setOpacityFunction(); this.setGradientOpacity(); vol.SetMapper(mapper); renderer.AddActor(sagittal); renderer.AddVolume(vol); }
public void Render3D(string folder) { reader3D = vtkDICOMImageReader.New(); reader3D.SetDirectoryName(folder); reader3D.Update(); renderer3D = vtkRenderer.New(); renderWindow3D = vtkRenderWindow.New(); renderWindowControl.Dock = DockStyle.Fill; panel1.Controls.Add(renderWindowControl); renderWindow3D = renderWindowControl.RenderWindow; renderWindow3D.AddRenderer(renderer3D); Coloring(); }
//wizualizacja 3d ----------------------------------------------------------------- public Visualization3D(RenderWindowControl window, vtkDICOMImageReader dicomReader) { this.window = window; this.dicomReader = dicomReader; this.presetMapper = new PresetMapper(); vtkRenderer renderer = window.RenderWindow.GetRenderers().GetFirstRenderer(); vtkSmartVolumeMapper mapper = vtkSmartVolumeMapper.New(); vol = vtkVolume.New(); vtkLookupTable bwLut =vtkLookupTable.New(); bwLut.SetTableRange (0, 2000); bwLut.SetSaturationRange (0, 0); bwLut.SetHueRange (0, 0); bwLut.SetValueRange (0, 1); bwLut.Build(); //effective built vtkImageMapToColors sagittalColors =vtkImageMapToColors.New(); sagittalColors.SetInputConnection(dicomReader.GetOutputPort()); sagittalColors.SetLookupTable(bwLut); sagittalColors.Update(); vtkImageActor sagittal = vtkImageActor.New(); sagittal.SetInput(sagittalColors.GetOutput()); sagittal.SetDisplayExtent(117,117,0,173,1,180); vtkImageReslice reslicer = vtkImageReslice.New(); reslicer.SetResliceAxesDirectionCosines(1,0,0,2,0,0,0,0,0); mapper.SetInputConnection(dicomReader.GetOutputPort()); this.setColorFunction(); this.setOpacityFunction(); this.setGradientOpacity(); vol.SetMapper(mapper); renderer.AddActor(sagittal); renderer.AddVolume(vol); }
public DicomLoader(String directoryPath) { _dicomReader = new vtkDICOMImageReader(); _dicomReader.SetDirectoryName(directoryPath); _dicomReader.Update(); }
static void PrintImage(string Ipath) { vtkDICOMImageReader reader = vtkDICOMImageReader.New(); reader.SetDirectoryName(Ipath); reader.Update(); X = reader.GetWidth(); Y = reader.GetHeight(); Z = reader.GetPixelSpacing(); Console.WriteLine(X * Z[0]); Console.WriteLine(Y * Z[1]); Console.WriteLine(Z[2]); // Visualize _ImageViewer = vtkImageViewer2.New(); _ImageViewer.SetInputConnection(reader.GetOutputPort()); // Get range of slices (min is the first index, max is the last index) _ImageViewer.GetSliceRange(ref _MinSlice, ref _MaxSlice); Console.WriteLine(_MinSlice); Console.WriteLine(_MaxSlice); _SliceStatusMapper = vtkTextMapper.New(); _SliceStatusMapper.SetInputConnection(reader.GetOutputPort()); vtkActor2D sliceStatusActor = vtkActor2D.New(); sliceStatusActor.SetMapper(_SliceStatusMapper); vtkRenderWindow renderWindow = vtkRenderWindow.New(); //Display in full screen renderWindow.SetFullScreen(1); vtkInteractorStyleImage interactorStyle = vtkInteractorStyleImage.New(); renderWindow.GetRenderers().InitTraversal(); vtkRenderer ren; while ((ren = renderWindow.GetRenderers().GetNextItem()) != null) { renderWindow.AddRenderer(ren); } _ImageViewer.SetRenderWindow(renderWindow); _ImageViewer.GetRenderer().AddActor2D(sliceStatusActor); _ImageViewer.SetSlice(_Slice); _ColorLevel = 500; _ImageViewer.SetColorLevel(_BlackLevel); _ImageViewer.Render(); Down(_period, 62); Backward(_period, 1); _ImageViewer.SetColorLevel(_ColorLevel); _ImageViewer.Render(); System.Threading.Thread.Sleep(_layertime); // delay iren = vtkRenderWindowInteractor.New(); iren.SetRenderWindow(renderWindow); renderWindow.Render(); //Start Timer InitTimer(); iren.Start(); if (reader != null) { reader.Dispose(); } if (_ImageViewer != null) { _ImageViewer.Dispose(); } if (_SliceStatusMapper != null) { _SliceStatusMapper.Dispose(); } if (sliceStatusActor != null) { sliceStatusActor.Dispose(); } if (renderWindow != null) { renderWindow.Dispose(); } if (interactorStyle != null) { interactorStyle.Dispose(); } if (ren != null) { ren.Dispose(); } if (iren != null) { iren.Dispose(); } }
public DicomLoader(String directoryPath) { _dicomReader = new vtkDICOMImageReader(); _dicomReader.SetDirectoryName(directoryPath); _dicomReader.Update(); }
private void ReadDICOMSeries() { // Path to vtk data must be set as an environment variable // VTK_DATA_ROOT = "C:\VTK\vtkdata-5.8.0" vtkTesting test = vtkTesting.New(); string root = test.GetDataRoot(); // Read all the DICOM files in the specified directory. // Caution: folder "DicomTestImages" don't exists by default in the standard vtk data folder // sample data are available at http://www.vtk.org/Wiki/images/1/12/VTK_Examples_StandardFormats_Input_DicomTestImages.zip //string folder = Path.Combine(root, @"Data\DicomTestImages"); string folder = @"provaDicom/" + studyUID; Console.WriteLine(folder); vtkDICOMImageReader reader = vtkDICOMImageReader.New(); reader.SetDirectoryName(folder); reader.Update(); // Visualize _ImageViewer = vtkImageViewer2.New(); _ImageViewer.SetInputConnection(reader.GetOutputPort()); // get range of slices (min is the first index, max is the last index) _ImageViewer.GetSliceRange(ref _MinSlice, ref _MaxSlice); Debug.WriteLine("slices range from : " + _MinSlice.ToString() + " to " + _MaxSlice.ToString()); // slice status message vtkTextProperty sliceTextProp = vtkTextProperty.New(); sliceTextProp.SetFontFamilyToCourier(); sliceTextProp.SetFontSize(20); sliceTextProp.SetVerticalJustificationToBottom(); sliceTextProp.SetJustificationToLeft(); _SliceStatusMapper = vtkTextMapper.New(); _SliceStatusMapper.SetInput("Slice No " + (_Slice + 1).ToString() + "/" + (_MaxSlice + 1).ToString()); _SliceStatusMapper.SetTextProperty(sliceTextProp); vtkActor2D sliceStatusActor = vtkActor2D.New(); sliceStatusActor.SetMapper(_SliceStatusMapper); sliceStatusActor.SetPosition(15, 10); // usage hint message vtkTextProperty usageTextProp = vtkTextProperty.New(); usageTextProp.SetFontFamilyToCourier(); usageTextProp.SetFontSize(14); usageTextProp.SetVerticalJustificationToTop(); usageTextProp.SetJustificationToLeft(); vtkTextMapper usageTextMapper = vtkTextMapper.New(); usageTextMapper.SetInput("Slice with mouse wheel\nor Up/Down-Key"); usageTextMapper.SetTextProperty(usageTextProp); vtkActor2D usageTextActor = vtkActor2D.New(); usageTextActor.SetMapper(usageTextMapper); usageTextActor.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay(); usageTextActor.GetPositionCoordinate().SetValue(0.05, 0.95); vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow; vtkInteractorStyleImage interactorStyle = vtkInteractorStyleImage.New(); // NOTA:non funziona la rotellina del mouse per cambiare slice <-------------------------------------- // l'errore รจ causato dalla funzione DicomCFindRequest(della sorgente di FellowOak) //in QueryFellowOak.cs, in particolare dal costruttore // DicomCFindRequest(DicomQueryRetrieveLevel level) // interactorStyle.MouseWheelForwardEvt += new vtkObject.vtkObjectEventHandler(interactor_MouseWheelForwardEvt); // interactorStyle.MouseWheelBackwardEvt += new vtkObject.vtkObjectEventHandler(interactor_MouseWheelBackwardEvt); renderWindow.GetInteractor().SetInteractorStyle(interactorStyle); renderWindow.GetRenderers().InitTraversal(); vtkRenderer ren; while ((ren = renderWindow.GetRenderers().GetNextItem()) != null) { ren.SetBackground(0.0, 0.0, 0.0); } _ImageViewer.SetRenderWindow(renderWindow); _ImageViewer.GetRenderer().AddActor2D(sliceStatusActor); _ImageViewer.GetRenderer().AddActor2D(usageTextActor); _ImageViewer.SetSlice(_MinSlice); _ImageViewer.Render(); }