# Override automatic display of newly-loaded volume?

**URL:** <https://discourse.slicer.org/t/override-automatic-display-of-newly-loaded-volume/846>\
**Category:** Development\
**Created:** [August 9, 2017, 2:00pm UTC](https://discourse.slicer.org/t/override-automatic-display-of-newly-loaded-volume/846 "2017-08-09T14:00:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [August 9, 2017, 2:00pm UTC](https://discourse.slicer.org/t/override-automatic-display-of-newly-loaded-volume/846/1 "2017-08-09T14:00:03Z")

</div>

Writing my first module.  
When I use the DICOM widget to load an image set, and use a qMRMLNodeComboBox, the newly-loaded node is automatically displayed in the Red, Yellow, and Green MRML slice views. I’m hoping to override this action, so that the newly-loaded volume is only displayed in either (but only one of) the Red or Yellow view. How would I do that? Thanks.  
Code is below:

```
def setup(self):
    ScriptedLoadableModuleWidget.setup(self)

    #Link to image database for SSFP
    self.LoadSSFPButton = qt.QPushButton("Load SSFP Image Series")
    self.LoadSSFPButton.toolTip = "Select the SSFP image series from the image database"
    self.LoadSSFPButton.enabled = True
    self.layout.addWidget(self.LoadSSFPButton)

    # SSFP volume selector
    self.SSFPSelector = slicer.qMRMLNodeComboBox()
    self.SSFPSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"]
    self.SSFPSelector.selectNodeUponCreation = True
    self.SSFPSelector.addEnabled = False
    self.SSFPSelector.removeEnabled = False
    self.SSFPSelector.noneEnabled = False
    self.SSFPSelector.showHidden = False
    self.SSFPSelector.showChildNodeTypes = False
    self.SSFPSelector.setMRMLScene( slicer.mrmlScene )
    self.addRow("SSFP Image Volume: ", self.SSFPSelector)

    #Connections
    self.LoadSSFPButton.connect('clicked()', self.loadImageSeriesClicked)
    self.SSFPSelector.connect("currentNodeChanged(bool)", self.onSSFPSelect)

def loadImageSeriesClicked(self):
    slicer.modules.dicom.widgetRepresentation()
    slicer.modules.DICOMWidget.enter()
```

---

<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:** [August 9, 2017, 2:26pm UTC](https://discourse.slicer.org/t/override-automatic-display-of-newly-loaded-volume/846/2 "2017-08-09T14:26:47Z")

</div>

This a really good question. After taking a quick look, I think the DoPropagateVolumeSelection member in vtkMRMLSliceCompositeNode is just to do this. A code snippet about how to access the node and set the flag. Of course you will want to do it differently, not iterating over all 2D views.

```
  layoutManager = slicer.app.layoutManager()
  sliceWidgetNames = ['Red', 'Green', 'Yellow']
  for sliceWidgetName in sliceWidgetNames:
    slice = layoutManager.sliceWidget(sliceWidgetName)
    if slice is None:
      continue
    sliceLogic = slice.sliceLogic()
    compositeNode = sliceLogic.GetSliceCompositeNode()
    compositeNode.SetDoPropagateVolumeSelection(False)
```

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [August 9, 2017, 8:52pm UTC](https://discourse.slicer.org/t/override-automatic-display-of-newly-loaded-volume/846/3 "2017-08-09T20:52:11Z")

</div>

Excellent, thank you! That worked well.
