# View controller module doesnt check whether the orientation exist or not

**URL:** <https://discourse.slicer.org/t/view-controller-module-doesnt-check-whether-the-orientation-exist-or-not/21820>\
**Category:** Development\
**Created:** [February 6, 2022, 11:39am UTC](https://discourse.slicer.org/t/view-controller-module-doesnt-check-whether-the-orientation-exist-or-not/21820 "2022-02-06T11:39:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [February 6, 2022, 11:39am UTC](https://discourse.slicer.org/t/view-controller-module-doesnt-check-whether-the-orientation-exist-or-not/21820/1 "2022-02-06T11:39:53Z")

</div>

Hi,

[qSlicerViewControllersModule::writeDefaultSliceViewSettings](https://github.com/Slicer/Slicer/blob/4d756f0ef57832d654df7a8dc1a8b10e38b8fba9/Modules/Loadable/ViewControllers/qSlicerViewControllersModule.cxx#L238-L246) function tries to determine the patient position based on `Axial` slice orientation preset. But in custom applications it is possible to redefine presets (to `XYZ` for example) and in this case an error is shown in the log.

I propose to modify that part to preliminary check whether the orientation preset exist or not:

```cpp
if (defaultViewNode->HasSliceOrientationPreset("Axial")){
  // do the check and write settings
}

```

May I create a PR?
