# Zoom in and out button from the standard toolbar

**URL:** <https://discourse.slicer.org/t/zoom-in-and-out-button-from-the-standard-toolbar/18077>\
**Category:** Support\
**Created:** [June 11, 2021, 12:13pm UTC](https://discourse.slicer.org/t/zoom-in-and-out-button-from-the-standard-toolbar/18077 "2021-06-11T12:13:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kshitij\_Panchal](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kshitij_panchal/32/10787_2.png) [@Kshitij\_Panchal](https://discourse.slicer.org/u/Kshitij_Panchal)\
**Post date:** [June 11, 2021, 12:13pm UTC](https://discourse.slicer.org/t/zoom-in-and-out-button-from-the-standard-toolbar/18077/1 "2021-06-11T12:13:19Z")

</div>

@lassoan @cpinter  
Hello. I am trying to create zoom buttons. Basically, these buttons will zoom in and out the loaded Dicom data in a particular view (red slice, yellow slice, green slice).

It will be a simple zoom in and out. Like; if the red slice view is selected then by clicking on the zoom in (+) button it will be zoom in to 110 %. To zoom out click on the zoom out button (-) to go back to normal. If another view (let’s say yellow slice) is selected then the zoom value (default 100%) will be replaced according to that view.

please guide to develop this feature.

---

<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 11, 2021, 5:57pm UTC](https://discourse.slicer.org/t/zoom-in-and-out-button-from-the-standard-toolbar/18077/2 "2021-06-11T17:57:29Z")

</div>

Try to follow [this process](https://slicer.readthedocs.io/en/latest/developer_guide/python_faq.html#how-to-find-a-python-function-for-any-slicer-features). Let us know if you get stuck.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [June 11, 2021, 6:39pm UTC](https://discourse.slicer.org/t/zoom-in-and-out-button-from-the-standard-toolbar/18077/3 "2021-06-11T18:39:41Z")

</div>

[This code](https://github.com/pieper/CompareVolumes/blob/master/CompareVolumes.py#L447-L465) should also help.

---

<div class="post-metadata">

**Author:** ![drvarunagarwal](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/drvarunagarwal/32/8914_2.png) [@drvarunagarwal](https://discourse.slicer.org/u/drvarunagarwal)\
**Post date:** [June 14, 2021, 4:27pm UTC](https://discourse.slicer.org/t/zoom-in-and-out-button-from-the-standard-toolbar/18077/4 "2021-06-14T16:27:30Z")

</div>

how to do the same for brightness and contrast?  
trying to design and have buttons for it rather than mouse controls

---

<div class="post-metadata">

**Author:** ![drvarunagarwal](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/drvarunagarwal/32/8914_2.png) [@drvarunagarwal](https://discourse.slicer.org/u/drvarunagarwal)\
**Post date:** [June 14, 2021, 4:30pm UTC](https://discourse.slicer.org/t/zoom-in-and-out-button-from-the-standard-toolbar/18077/5 "2021-06-14T16:30:16Z")

</div>

Also how can I decrease the options in the layout toolbar?

Please advise many thanks

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [June 15, 2021, 9:18am UTC](https://discourse.slicer.org/t/zoom-in-and-out-button-from-the-standard-toolbar/18077/6 "2021-06-15T09:18:41Z")

</div>

> [@drvarunagarwal](#):
>
> how to do the same for brightness and contrast?

In this case the buttons will need to set [these values](https://github.com/Slicer/Slicer/blob/master/Libs/MRML/Core/vtkMRMLScalarVolumeDisplayNode.h#L93) after disabling [auto window/level](https://github.com/Slicer/Slicer/blob/master/Libs/MRML/Core/vtkMRMLScalarVolumeDisplayNode.h#L79).
