# Volume reslice driver crashes Slicer

**URL:** <https://discourse.slicer.org/t/volume-reslice-driver-crashes-slicer/7265>\
**Category:** Support\
**Created:** [June 20, 2019, 6:09pm UTC](https://discourse.slicer.org/t/volume-reslice-driver-crashes-slicer/7265 "2019-06-20T18:09:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zapaishchykova](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/zapaishchykova/32/66121_2.png) [@zapaishchykova](https://discourse.slicer.org/u/zapaishchykova)\
**Post date:** [June 20, 2019, 6:09pm UTC](https://discourse.slicer.org/t/volume-reslice-driver-crashes-slicer/7265/1 "2019-06-20T18:09:18Z")

</div>

Hi there!  
I’m trying to use Volume reslice driver from python script ( since from console it works fine):

```
  def onTransformImageClicked(self):
    logic = ModuleLogic()
    result = logic.transformationImage()
    driver = slicer.vtkSlicerVolumeResliceDriverLogic() # .MODE_TRANSVERSE = 6
    layoutManager = slicer.app.layoutManager()
    redView = layoutManager.layoutLogic().GetViewNodes().GetItemAsObject(0)
    driver.SetModeForSlice(6, redView)
    driver.SetDriverForSlice('vtkMRMLScalarVolumeNode1', redView)

    qt.QMessageBox.information(slicer.util.mainWindow(), 'Slicer Python', result)

```

And It just crashes without any error. I want to change following params (see image)

 ![3](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/1/e13d01fb1a67d630eb046a34895df6d8a9c4ffb5.png)  
Any ideas what is wrong here?

---

<div class="post-metadata">

**Author:** ![zapaishchykova](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/zapaishchykova/32/66121_2.png) [@zapaishchykova](https://discourse.slicer.org/u/zapaishchykova)\
**Post date:** [June 20, 2019, 6:23pm UTC](https://discourse.slicer.org/t/volume-reslice-driver-crashes-slicer/7265/2 "2019-06-20T18:23:25Z")

</div>

Just figured it out, forgot to set scene before, now it doesn’t crush anymore. But still, small error will be nicer than a crash:)

```
    driver = slicer.vtkSlicerVolumeResliceDriverLogic() # .MODE_TRANSVERSE = 6
    layoutManager = slicer.app.layoutManager()
    redView = layoutManager.layoutLogic().GetViewNodes().GetItemAsObject(0)
    driver.SetMRMLScene(slicer.mrmlScene) 
    driver.SetModeForSlice(6, redView)
    driver.SetDriverForSlice('vtkMRMLScalarVolumeNode1', redView)
```

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [June 20, 2019, 6:42pm UTC](https://discourse.slicer.org/t/volume-reslice-driver-crashes-slicer/7265/3 "2019-06-20T18:42:31Z")

</div>

For loadable modules, module logic is instantiated by the application and there should be only one instance. So, instead of creating a new module logic, use the existing one:

```
driver = slicer.modules.volumereslicedriver.logic()
```
