# Update image with itkwidget view 3D data

**URL:** https://discourse.itk.org/t/update-image-with-itkwidget-view-3d-data/3202
**Category:** Beginner Questions
**Created:** [June 18, 2020, 10:12am UTC](https://discourse.itk.org/t/update-image-with-itkwidget-view-3d-data/3202 "2020-06-18T10:12:33Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![emilljungberg](https://discourse.itk.org/user_avatar/discourse.itk.org/emilljungberg/32/1562_2.png) [@emilljungberg](https://discourse.itk.org/u/emilljungberg)
#### Post date: [June 18, 2020, 10:12am UTC](https://discourse.itk.org/t/update-image-with-itkwidget-view-3d-data/3202/1 "2020-06-18T10:12:33Z")

</div>

Hi!

I’ve recently started using the Python bindings for the latest version of ITK and it is working really great so far!

I’m currently building an interactive application for testing effects of different filters with my own reconstructed MRI data. However, when I’m using the `itkwidgets` `view` function to look at the data I’m noticing some strange behaviour when I’m updating the current image, the apparent intensity levels in the image changes, eventhough the image haven’t changed.

Example: I have produced an image as an itk image object and view it as

```python
viewer = view(img, mode='x', vmin=0, vmax=70)
viewer

```

 ![image](https://discourse.itk.org/uploads/default/original/2X/2/26b8bf151551dbfd0162e5d16b2791afad71c264.jpeg)

Now I add in another line to just update the viewer with the same image again, as I need to do when testing out different filters interactively, and the image comes out much darker, eventhough I have the same window levels. Any ideas why?

```python
viewer = view(img, mode='x', vmin=0, vmax=70)
viewer.image = img # <-- New line
viewer

```

 ![image](https://discourse.itk.org/uploads/default/original/2X/d/dfc7b28bf776103c979800e542f2b201b1ed03db.jpeg)

For debug purpose

```python
type(img)

>>> itk.itkImagePython.itkImageD3

```

What I didn’t show here is that the viewer will also override the values I set for `vmin` and `vmax` when I update the image.

I got the syntax for updating the current image (`viewer.image = image`) from your tutorial 3 on filtering at [https://github.com/KitwareMedical/CourseInBiomedicalImageAnalysisVisualizationAndArtificialIntelligence](https://github.com/KitwareMedical/CourseInBiomedicalImageAnalysisVisualizationAndArtificialIntelligence)

Is there something I’m missing in terms of updating the current image?

Thank you very much!

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [June 18, 2020, 4:59pm UTC](https://discourse.itk.org/t/update-image-with-itkwidget-view-3d-data/3202/2 "2020-06-18T16:59:02Z")

</div>

Hello @emilljungberg,

Welcome to the ITK community! 🌞

> [@emilljungberg](#):
>
> I’ve recently started using the Python bindings for the latest version of ITK and it is working really great so far!

Excellent! 🏍

> [@emilljungberg](#):
>
> What I didn’t show here is that the viewer will also override the values I set for `vmin` and `vmax` when I update the image.

Thank you for the nice description of the issue!

I was able to reproduce the reset of `vmin` and `vmax` when updating the image – a fix has been created, and it will be in a new release cut over the next few days.

---

<div class="post-metadata">

### Author: ![emilljungberg](https://discourse.itk.org/user_avatar/discourse.itk.org/emilljungberg/32/1562_2.png) [@emilljungberg](https://discourse.itk.org/u/emilljungberg)
#### Post date: [June 18, 2020, 5:15pm UTC](https://discourse.itk.org/t/update-image-with-itkwidget-view-3d-data/3202/3 "2020-06-18T17:15:39Z")

</div>

Thanks @matt.mccormick,

I’m still having the issue that my image comes out much darker in the second example above even when I reset the `vmin`/`vmax`. The image the I attached has the same window limits but comes out very different for some reason. Or is this still related to the vmin/vmax being changed behind the scenes eventhuogh I adjusted it on the UI?

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [June 19, 2020, 12:44am UTC](https://discourse.itk.org/t/update-image-with-itkwidget-view-3d-data/3202/4 "2020-06-19T00:44:47Z")

</div>

> [@emilljungberg](#):
>
> Or is this still related to the vmin/vmax being changed behind the scenes eventhuogh I adjusted it on the UI?

It could be related or an independent issue – let’s see if it persists after `vmin` / `vmax` are addressed.
