# Actor is oddly coloured

**URL:** https://discourse.vtk.org/t/actor-is-oddly-coloured/1504
**Category:** Development
**Created:** [August 7, 2019, 1:01pm UTC](https://discourse.vtk.org/t/actor-is-oddly-coloured/1504 "2019-08-07T13:01:49Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![at123](https://discourse.vtk.org/user_avatar/discourse.vtk.org/at123/32/748_2.png) [@at123](https://discourse.vtk.org/u/at123)
#### Post date: [August 7, 2019, 1:01pm UTC](https://discourse.vtk.org/t/actor-is-oddly-coloured/1504/1 "2019-08-07T13:01:49Z")

</div>

Hi,

I declared a vtkActor and set it to one colour. I pass a vtkBooleanOperationPolyDataFilter to the vtkPolyDataMapper and then to the vtkActor. When the vtkActor is rendered, it is not the colour I specified. Instead, it is blue and progressively transitions to red. How do I make it one colour?

Thanks. Any help would be greatly appreciated.

---

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [August 7, 2019, 1:39pm UTC](https://discourse.vtk.org/t/actor-is-oddly-coloured/1504/2 "2019-08-07T13:39:29Z")

</div>

Set ScalarVisibilityOff on your mapper.

---

<div class="post-metadata">

### Author: ![at123](https://discourse.vtk.org/user_avatar/discourse.vtk.org/at123/32/748_2.png) [@at123](https://discourse.vtk.org/u/at123)
#### Post date: [August 7, 2019, 2:07pm UTC](https://discourse.vtk.org/t/actor-is-oddly-coloured/1504/3 "2019-08-07T14:07:49Z")

</div>

Thanks so much! One more question, when I try to render a vtkBooleanOperatonPolyDataFilter using vtkMapper and vtkActor, the render fails and I am given this error:

Segmentation fault (core dumped)

Do you know what this means and how to fix it? Thanks!

---

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [August 7, 2019, 3:39pm UTC](https://discourse.vtk.org/t/actor-is-oddly-coloured/1504/4 "2019-08-07T15:39:57Z")

</div>

It’s hard to tell without seeing the code. Can you supply an example that illustrates the problem?

---

<div class="post-metadata">

### Author: ![at123](https://discourse.vtk.org/user_avatar/discourse.vtk.org/at123/32/748_2.png) [@at123](https://discourse.vtk.org/u/at123)
#### Post date: [August 7, 2019, 3:50pm UTC](https://discourse.vtk.org/t/actor-is-oddly-coloured/1504/5 "2019-08-07T15:50:55Z")

</div>

I have problems with lines 218 and 219. RemoveAllInputs() did not remove the data in port 0 and 1 of vtkBooleanOperationPolyDataFilter. It only removed data in port 0. So I tried to remove data for each port using RemoveAllInputConnections(portNumber) for port 0 and 1. This does the job. I get 0 inputs for both ports. The purpose of the code is to merge multiple volumes created by vtkDelaunay and display them. I get this error:

ERROR: In /work/standalone-x64-build/VTK-source/Filters/General/vtkOBBTree.cxx, line 1058  
vtkOBBTree (0x801dfa0): Can’t build OBB tree - no data available!

I don’t know what is wrong and how to fix it. Thanks so much by the way!

[code.txt](https://discourse.vtk.org/uploads/short-url/4Ikw58orR1D48Dk4vSKQ5Wn98yF.txt) (4.4 KB)

---

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [August 7, 2019, 6:40pm UTC](https://discourse.vtk.org/t/actor-is-oddly-coloured/1504/6 "2019-08-07T18:40:11Z")

</div>

Please post your code and a CMakelist file.

---

<div class="post-metadata">

### Author: ![at123](https://discourse.vtk.org/user_avatar/discourse.vtk.org/at123/32/748_2.png) [@at123](https://discourse.vtk.org/u/at123)
#### Post date: [August 7, 2019, 6:43pm UTC](https://discourse.vtk.org/t/actor-is-oddly-coloured/1504/7 "2019-08-07T18:43:15Z")

</div>

```
171 orderedContourDict = OrderedDict(sorted(self.reslicers[self.contourOrientation].contours.items()))
172 contourList = []
173 for slice, contour in orderedContourDict.items():
174 contourList.append(contour)
175 
176 numberOfContours = len(orderedContourDict)
177 volumePolyDataList = []
178 for i in range(0, numberOfContours - 1):
179 appendPolyData = vtkAppendPolyData()
180 appendPolyData.AddInputData(contourList[i].GetContourRepresentation().GetContourRepresentationAsPolyData())
181 appendPolyData.AddInputData(contourList[i + 1].GetContourRepresentation().GetContourRepresentationAsPolyData())
182 appendPolyData.Update()
183 delaunay = vtkDelaunay3D()
184 delaunay.SetInputData(appendPolyData.GetOutput())
185 surfaceFilter = vtkDataSetSurfaceFilter()
186 surfaceFilter.SetInputConnection(0, delaunay.GetOutputPort())
187 surfaceFilter.Update()
188 polyData = surfaceFilter.GetOutput()
189 volumePolyDataList.append(polyData)
190 
191 if len(volumePolyDataList) == 1:
192 delaunay = vtkDelaunay3D()
193 delaunay.SetInputData(volumePolyDataList[0])
194 delaunayMapper = vtkDataSetMapper()
195 delaunayMapper.SetInputConnection(delaunay.GetOutputPort())
196 self.actor.SetMapper(delaunayMapper)
197 self.planes.GetRenderWindow().Render()
198 else:
199 booleanOperation = vtkBooleanOperationPolyDataFilter()
200 booleanOperation1 = vtkBooleanOperationPolyDataFilter()
201 booleanOperation.SetOperationToUnion()
202 booleanOperation1.SetOperationToUnion()
203 
204 for i in range(0, len(volumePolyDataList)):
205 if i == 0:
206 booleanOperation.AddInputData(0, volumePolyDataList[i])
207 #booleanOperation.Update()
208 elif i == 1:
209 booleanOperation.AddInputData(1, volumePolyDataList[i])
210 #booleanOperation.Update()
211 elif i == 2:
212 booleanOperation1.AddInputData(0, booleanOperation.GetOutput())
213 booleanOperation1.AddInputData(1, volumePolyDataList[i])
214 #booleanOperation1.Update()
215 else:
216 boolCopy = booleanOperation1.GetOutput()
217 # booleanOperation1.RemoveAllInputs()
218 booleanOperation1.RemoveAllInputConnections(0)
219 booleanOperation1.RemoveAllInputConnections(1)
220 # booleanOperation1.Update()
221 print(booleanOperation.GetNumberOfInputConnections(0), booleanOperation.GetNumberOfInputConnections(1), booleanOpera tion1.GetNumberOfInputConnections(0), booleanOperation1.GetNumberOfInputConnections(1))
222 booleanOperation1.AddInputData(0, boolCopy)
223 booleanOperation1.AddInputData(1, volumePolyDataList[i])
224 #booleanOperation1.Update()
225 
226 print(booleanOperation.GetNumberOfInputConnections(0), booleanOperation.GetNumberOfInputConnections(1), booleanOperation1.Ge tNumberOfInputConnections(0), booleanOperation1.GetNumberOfInputConnections(1))
227 
228 # print(booleanOperation.GetNumberOfInputConnections(0), booleanOperation.GetNumberOfInputConnections(1), booleanOperatio n1.GetNumberOfInputConnections(0), booleanOperation1.GetNumberOfInputConnections(1))
229 
230 mapper = vtkPolyDataMapper()
231 if len(volumePolyDataList) == 2:
232 mapper.SetInputConnection(booleanOperation.GetOutputPort())
233 else:
234 mapper.SetInputConnection(booleanOperation1.GetOutputPort())
235 mapper.ScalarVisibilityOff()
236 self.actor.SetMapper(mapper)
237 self.planes.GetRenderWindow().Render()
238 
239 self.reslicers[self.contourOrientation].stopContouring()
240 self.contouring = False
241 self.orientationBox.setEnabled(True)
242 self.startContouringButton.setEnabled(True)
243 self.generateVolumeButton.setEnabled(False)
244 self.cancelContouringButton.setEnabled(False)
245 self.applyButton.setEnabled(True)
```
