snehal  
                (snehal)
               
                 
              
                  
                    December 26, 2019,  4:48am
                   
                   
              1 
               
             
            
              Hello all, 
I am new in VTK  please help me to resolve the following issue. 
I have volume data when i try to pass in vtkCutter function its give me the following error
volume = vtk.vtkVolume() 
volume.SetMapper(volumeMapper) 
volume.SetProperty(volumeProperty)
#create  a plane to cut,here it cuts in the XZ direction (xz normal=(1,0,0);XY =(0,0,1),YZ =(0,1,0) 
plane=vtk.vtkPlane() 
plane.SetOrigin(10,0,0) 
plane.SetNormal(1,0,0)
#create  cutter 
cutter=vtk.vtkCutter() 
cutter.SetCutFunction(plane) 
cutter.SetInputConnection(volume.GetOutputPort()) 
cutter.Update() 
cutterMapper=vtk.vtkPolyDataMapper() 
cutterMapper.SetInputConnection( cutter.GetOutputPort())
#create  plane actor 
planeActor=vtk.vtkActor() 
planeActor.GetProperty().SetColor(1.0,1,0) 
planeActor.GetProperty().SetLineWidth(2) 
planeActor.SetMapper(cutterMapper)
AttributeError :Traceback (most recent call last) 
 in  
7 cutter=vtk.vtkCutter() 
8 cutter.SetCutFunction(plane) 
----> 9 cutter.SetInputConnection(volume.GetOutputPort()) 
10 cutter.Update() 
11 cutterMapper=vtk.vtkPolyDataMapper()
AttributeError: ‘vtkRenderingCorePython.vtkVolume’ object has no attribute ‘GetOutputPort’
             
            
               
               
               
            
            
           
          
            
              
                marcomusy  
                (Marco Musy)
               
              
                  
                    December 27, 2019, 12:37am
                   
                   
              2 
               
             
            
              …if you already have a volume object this should work:
    #vol = vtkVolume()
    boxWidget = vtk.vtkBoxWidget()
    boxWidget.SetInteractor(vp.interactor)
    boxWidget.SetPlaceFactor(1.0)
    renderer.AddVolume(vol)
    interactor.Render()
    planes = vtk.vtkPlanes()
    def clipVolumeRender(obj, event):
        obj.GetPlanes(planes)
        vol.GetMapper().SetClippingPlanes(planes)
    boxWidget.SetInputData(vol.GetMapper().GetInput())
    boxWidget.OutlineCursorWiresOn()
    boxWidget.GetSelectedOutlineProperty().SetColor(1, 0, 1)
    boxWidget.GetOutlineProperty().SetColor(0.2, 0.2, 0.2)
    boxWidget.GetOutlineProperty().SetOpacity(0.7)
    boxWidget.SetPlaceFactor(1.0)
    boxWidget.PlaceWidget()
    boxWidget.InsideOutOn()
    boxWidget.AddObserver("InteractionEvent", clipVolumeRender)
    renderer.ResetCamera()
    boxWidget.On()
    interactor.Start()
 
check out also here .
             
            
               
               
               
            
            
           
          
            
              
                snehal  
                (snehal)
               
              
                  
                    December 27, 2019,  4:30am
                   
                   
              3 
               
             
            
              Thank you for your reply, definately i will try this. 
But basically i am looking for the cutter function which cuts the 3d volume dicom image, 
which is exactly done in ITK-SNAP.
             
            
               
               
               
            
            
           
          
            
              
                snehal  
                (snehal)
               
              
                  
                    December 27, 2019, 12:17pm
                   
                   
              4 
               
             
            
              When i used vtkplotter.addons.addCutterTool( volume ) it gives me following error :
AttributeError  Traceback (most recent call last) in 
----> 1 vtkplotter.addons.addCutterTool(volume)
c:\users\s.jadhav\appdata\local\continuum\anaconda3\envs\cad\lib\site-packages\vtkplotter\addons.py in addCutterTool(actor) 
527     “”" 
528     if isinstance(actor, vtk.vtkVolume): 
–> 529         return _addVolumeCutterTool(actor) 
530     elif isinstance(actor, vtk.vtkImageData): 
531         from vtkplotter import Volume
c:\users\s.jadhav\appdata\local\continuum\anaconda3\envs\cad\lib\site-packages\vtkplotter\addons.py in _addVolumeCutterTool(vol) 
600 def _addVolumeCutterTool(vol): 
601     vp = settings.plotter_instance 
–> 602     if not vp.renderer: 
603         save_int = vp.interactive 
604         vp.show(interactive=0)
AttributeError: ‘NoneType’ object has no attribute ‘renderer’
             
            
               
               
               
            
            
           
          
            
              
                marcomusy  
                (Marco Musy)
               
              
                  
                    December 27, 2019,  1:48pm
                   
                   
              5 
               
             
            
              Please submit an issue here .