<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thanks, vtkContourTriangulator worked well and I’ll continue to work my way through your first two points.<div class=""><div class=""><br class=""></div><div class="">For the third point:</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">I also haven't managed to see both the circle and the DICOM image at the<br class="">same time, despite what feels like every combination of setOpacity,<br class="">setAmbient, etc. When I set the background of the newly cut circle to green,<br class="">everything goes green, so I think it might be that the background of the<br class="">circle is masking the DICOM slice, can I set it to have a transparent<br class="">background?<br class=""></blockquote><div class=""><br class=""></div><div class="">There is no way to set the background for a single actor, AFAIK the only way to</div><div class="">set the background is in the vtkRenderer, in which case you are setting the background</div><div class="">for everything, and the background will therefore be behind everything and cannot</div><div class="">ever be in front of something. Can you explain in more detail what you are doing?</div></div></div></div></blockquote><div><blockquote type="cite" class=""><div class="">
</div></blockquote></div><br class=""></div></div><div class="">Beneath I’ve copied the code that I’ve been trying. worldCoords is the point returned by the user’s click using GetIJK (by the way, the difference between GetIJK and GetPickPosition & GetMapperPosition is IJK is the rounded to int, the values are otherwise the same?). I try to add the newly cut circle to the QVTKWidget already containing the DICOM slice using GetRenderindow()->AddRenderer(renderer) at the end, and the output is a semi-transparent red circle (because opacity is 40%) on a bright green background. I can’t for the life of me figure out where I need to point the camera to see the DICOM slice again.</div><div class=""><br class=""></div><div class="">Cheers for the help,</div><div class="">Richard</div><div class=""><br class=""></div><div class="">P.S. I know the vtkCamera settings are nonsensical, I am just messing about with them at this stage.</div><div class=""><br class=""></div><div class="">
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><!--StartFragment--><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">vtkSmartPointer</span><<span style=" color:#800080;" class="">vtkSphereSource</span>><span style=" color:#c0c0c0;" class=""> </span>sphere<span style=" color:#c0c0c0;" class=""> </span>=<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">vtkSmartPointer</span><<span style=" color:#800080;" class="">vtkSphereSource</span>>::New();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>sphere-><span style="font-style: italic;" class="">SetCenter</span>(mmCoords);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>sphere-><span style="font-style: italic;" class="">SetPhiResolution</span>(<span style=" color:#000080;" class="">30</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>sphere-><span style="font-style: italic;" class="">SetThetaResolution</span>(<span style=" color:#000080;" class="">30</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>sphere-><span style="font-style: italic;" class="">SetRadius</span>(<span style=" color:#000080;" class="">5</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>sphere-><span style="font-style: italic;" class="">Update</span>();<!--EndFragment--></pre><div class=""><div style="margin: 0px;" class=""><br class=""></div>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">vtkSmartPointer</span><<span style=" color:#800080;" class="">vtkPlane</span>><span style=" color:#c0c0c0;" class=""> </span>plane<span style=" color:#c0c0c0;" class=""> </span>=<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">vtkSmartPointer</span><<span style=" color:#800080;" class="">vtkPlane</span>>::New();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>plane-><span style="font-style: italic;" class="">SetOrigin</span>(worldCoords[<span style=" color:#000080;" class="">0</span>],<span style=" color:#c0c0c0;" class=""> </span>worldCoords[<span style=" color:#000080;" class="">1</span>],<span style=" color:#c0c0c0;" class=""> </span>worldCoords[<span style=" color:#000080;" class="">2</span>]);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>plane-><span style="font-style: italic;" class="">SetNormal</span>(<span style=" color:#000080;" class="">0</span>,<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#000080;" class="">0</span>,<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#000080;" class="">1</span>);<!--EndFragment--></pre><div class=""><br class=""></div></div></div><div class="">
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><!--StartFragment--><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">vtkSmartPointer</span><<span style=" color:#800080;" class="">vtkContourTriangulator</span>><span style=" color:#c0c0c0;" class=""> </span>triangles<span style=" color:#c0c0c0;" class=""> </span>=<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">vtkSmartPointer</span><<span style=" color:#800080;" class="">vtkContourTriangulator</span>>::New();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>triangles-><span style="font-style: italic;" class="">SetInputConnection</span>(sphereCutter->GetOutputPort());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#008000;" class="">//</span><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#008000;" class="">Visualize</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">vtkSmartPointer</span><<span style=" color:#800080;" class="">vtkPolyDataMapper</span>><span style=" color:#c0c0c0;" class=""> </span>mapper<span style=" color:#c0c0c0;" class=""> </span>=<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">vtkSmartPointer</span><<span style=" color:#800080;" class="">vtkPolyDataMapper</span>>::New();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>mapper-><span style="font-style: italic;" class="">SetInputConnection</span>(triangles->GetOutputPort());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">vtkSmartPointer</span><<span style=" color:#800080;" class="">vtkActor</span>><span style=" color:#c0c0c0;" class=""> </span>actor<span style=" color:#c0c0c0;" class=""> </span>=<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">vtkSmartPointer</span><<span style=" color:#800080;" class="">vtkActor</span>>::New();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>actor-><span style="font-style: italic;" class="">SetMapper</span>(mapper);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>actor->GetProperty()-><span style="font-style: italic;" class="">SetColor</span>(<span style=" color:#000080;" class="">1.0</span>,<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#000080;" class="">0.0</span>,<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#000080;" class="">0.0</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>actor->GetProperty()-><span style="font-style: italic;" class="">EdgeVisibilityOff</span>();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>actor->GetProperty()-><span style="font-style: italic;" class="">SetAmbient</span>(<span style=" color:#000080;" class="">1.0</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>actor->GetProperty()-><span style="font-style: italic;" class="">SetDiffuse</span>(<span style=" color:#000080;" class="">1.0</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>actor->GetProperty()-><span style="font-style: italic;" class="">SetOpacity</span>(<span style=" color:#000080;" class="">0.4</span>);</pre><pre style="margin-top: 0px; margin-bottom: 0px;" class="">
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><!--StartFragment--><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">vtkSmartPointer</span><<span style=" color:#800080;" class="">vtkCamera</span>><span style=" color:#c0c0c0;" class=""> </span>camera<span style=" color:#c0c0c0;" class=""> </span>=<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">vtkSmartPointer</span><<span style=" color:#800080;" class="">vtkCamera</span>>::New();</pre><pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>camera->SetPosition(worldCoords[<span style=" color:#000080;" class="">0</span>],<span style=" color:#c0c0c0;" class=""> </span>worldCoords[<span style=" color:#000080;" class="">1</span>],<span style=" color:#c0c0c0;" class=""> </span>worldCoords[<span style=" color:#000080;" class="">2</span>]+<span style=" color:#000080;" class="">50</span>);</pre><pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>camera->SetFocalPoint(worldCoords[<span style=" color:#000080;" class="">0</span>],<span style=" color:#c0c0c0;" class=""> </span>worldCoords[<span style=" color:#000080;" class="">1</span>],<span style=" color:#c0c0c0;" class=""> </span>worldCoords[<span style=" color:#000080;" class="">2</span>]);<!--EndFragment--></pre><div class=""><br class=""></div></pre><div class="">
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><!--StartFragment--><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">vtkSmartPointer</span><<span style=" color:#800080;" class="">vtkRenderer</span>><span style=" color:#c0c0c0;" class=""> </span>renderer<span style=" color:#c0c0c0;" class=""> </span>=<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">vtkSmartPointer</span><<span style=" color:#800080;" class="">vtkRenderer</span>>::New();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>renderer->AddActor(actor);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>renderer-><span style="font-style: italic;" class="">SetBackground</span>(<span style=" color:#000080;" class="">0</span>,<span style=" color:#000080;" class="">1</span>,<span style=" color:#000080;" class="">0</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>renderer->SetActiveCamera(camera);<!--EndFragment--></pre><pre style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></pre><pre style="margin-top: 0px; margin-bottom: 0px;" class=""><pre style="margin-top: 0px; margin-bottom: 0px;" class=""> ui->qvtk-><span style="font-style: italic;" class="">GetRenderWindow</span>()-><span style="font-style: italic;" class="">AddRenderer</span>(renderer);<!--EndFragment--></pre><div class=""><br class=""></div></pre><div class=""><br class=""></div></div></div></body></html>