# Resample Scalar/Vector/DWI Volume produces weird results

**URL:** https://discourse.slicer.org/t/resample-scalar-vector-dwi-volume-produces-weird-results/38288
**Category:** Support
**Created:** [September 9, 2024, 9:14am UTC](https://discourse.slicer.org/t/resample-scalar-vector-dwi-volume-produces-weird-results/38288 "2024-09-09T09:14:31Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![koeglfryderyk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/koeglfryderyk/32/14638_2.png) [@koeglfryderyk](https://discourse.slicer.org/u/koeglfryderyk)
#### Post date: [September 9, 2024, 12:43pm UTC](https://discourse.slicer.org/t/resample-scalar-vector-dwi-volume-produces-weird-results/38288/2 "2024-09-09T12:43:31Z")

</div>

I also tried doing it in the Python console, as described [here](https://discourse.slicer.org/t/resample-scalar-volumes-scripting-in-python/19736) but I also get strange results.

When I set those 4 parameters:

```auto
params["inputVolume"] = slicer.util.getFirstNodeByName("moving")
params["outputVolume"] = slicer.util.getFirstNodeByName("moving_2")
params["interpolationType"] = "linear"
params["outputImageSpacing"] = (1,1,1)

```

the resampling works.

When I add this parameter

```auto
params["outputImageOrigin"] = (0,0,0)

```

the resampling finishes, but the origin remains unchanged and those two messages appear around 25 times each:

```auto
[VTK] Input port 0 of algorithm vtkImageMapToWindowLevelColors (0x80bc240) has 0 connections but is not optional.
[VTK] Input port 0 of algorithm vtkImageThreshold (0x80a9230) has 0 connections but is not optional.

```

When I remove the origin parameter and set the direction:

```auto
params["directionMatrix"] = (1,0,0,0,1,0,0,0,1)

```

the resampling finishes, the direction matrix is set correctly, but the entire image is now filled with 0s and the same VTK message appear

---

_[View the full topic](https://discourse.slicer.org/t/resample-scalar-vector-dwi-volume-produces-weird-results/38288)._
