(vtkImageData id, vtkAlgorithmOutput out)
| 66 | } |
| 67 | |
| 68 | public void setImageData(vtkImageData id, vtkAlgorithmOutput out) { |
| 69 | // The shared picker enables us to use 3 planes at one time |
| 70 | // and gets the picking order right |
| 71 | vtkCellPicker picker = new vtkCellPicker(); |
| 72 | picker.SetTolerance(0.005); |
| 73 | |
| 74 | // The 3 image plane widgets are used to probe the dataset. |
| 75 | vtkImagePlaneWidget planeWidgetX = new vtkImagePlaneWidget(); |
| 76 | planeWidgetX.DisplayTextOn(); |
| 77 | planeWidgetX.SetInputData(id); |
| 78 | planeWidgetX.SetInteractor(getRenderWindowInteractor()); |
| 79 | planeWidgetX.SetPlaneOrientationToXAxes(); |
| 80 | planeWidgetX.SetSliceIndex(32); |
| 81 | planeWidgetX.SetPicker(picker); |
| 82 | planeWidgetX.SetKeyPressActivationValue('x'); |
| 83 | planeWidgetX.GetPlaneProperty().SetColor(1, 0, 0); |
| 84 | planeWidgetX.On(); |
| 85 | |
| 86 | vtkImagePlaneWidget planeWidgetY = new vtkImagePlaneWidget(); |
| 87 | planeWidgetY.DisplayTextOn(); |
| 88 | planeWidgetY.SetInputData(id); |
| 89 | planeWidgetY.SetInteractor(getRenderWindowInteractor()); |
| 90 | planeWidgetY.SetPlaneOrientationToYAxes(); |
| 91 | planeWidgetY.SetSliceIndex(32); |
| 92 | planeWidgetY.SetPicker(picker); |
| 93 | planeWidgetY.SetKeyPressActivationValue('y'); |
| 94 | planeWidgetY.GetPlaneProperty().SetColor(1, 1, 0); |
| 95 | planeWidgetY.SetLookupTable(planeWidgetX.GetLookupTable()); |
| 96 | planeWidgetY.On(); |
| 97 | |
| 98 | // for the z-slice, turn off texture interpolation: |
| 99 | // interpolation is now nearest neighbour, to demonstrate |
| 100 | // cross-hair cursor snapping to pixel centers |
| 101 | vtkImagePlaneWidget planeWidgetZ = new vtkImagePlaneWidget(); |
| 102 | planeWidgetZ.DisplayTextOn(); |
| 103 | planeWidgetZ.SetInputData(id); |
| 104 | planeWidgetZ.TextureInterpolateOff(); |
| 105 | planeWidgetZ.SetInteractor(getRenderWindowInteractor()); |
| 106 | planeWidgetZ.SetPlaneOrientationToZAxes(); |
| 107 | planeWidgetZ.SetSliceIndex(46); |
| 108 | planeWidgetZ.SetPicker(picker); |
| 109 | planeWidgetZ.SetKeyPressActivationValue('z'); |
| 110 | planeWidgetZ.GetPlaneProperty().SetColor(0, 0, 1); |
| 111 | planeWidgetZ.SetLookupTable(planeWidgetX.GetLookupTable()); |
| 112 | planeWidgetZ.On(); |
| 113 | |
| 114 | // An outline is shown for context. |
| 115 | vtkOutlineFilter outline = new vtkOutlineFilter(); |
| 116 | outline.SetInputConnection(out); |
| 117 | |
| 118 | vtkPolyDataMapper outlineMapper = new vtkPolyDataMapper(); |
| 119 | outlineMapper.SetInputConnection(outline.GetOutputPort()); |
| 120 | |
| 121 | vtkActor outlineActor = new vtkActor(); |
| 122 | outlineActor.SetMapper(outlineMapper); |
| 123 | |
| 124 | GetRenderer().AddActor(outlineActor); |
| 125 |
no test coverage detected