<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">Hello all,</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; ">I think ContourWidget doesn't like me at all.</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; ">Now I am trying to put a default circle as contour widget over a DICOM Image and it doesn't appear.</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;
 ">Do you have any idea?</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; "><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; "><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; ">Thanks,</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; "><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; ">Dora</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size:
 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; "><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; ">Here is the code:</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; "><br></div><div style="background-color: transparent; "><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">#include "vtkImageViewer2.h"&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">#include "vtkRenderWindowInteractor.h"&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">#include "vtkContourWidget.h"&nbsp;</font></div><div style="background-color:
 transparent; "><font face="times new roman, new york, times, serif">#include "vtkContourLineInterpolator.h"&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">#include "vtkOrientedGlyphContourRepresentation.h"&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">#include "vtkDICOMImageReader.h"&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">#include "vtkProperty.h"</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">#include "vtkPolyData.h"</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">#include "vtkSmartPointer.h"</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">#include
 "vtkMath.h"</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">#include "vtkCellArray.h"</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><br></font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">int main()&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">{&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; //Setting up Viewer<span class="Apple-tab-span" style="white-space:pre">        </span></font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; vtkImageViewer2* viewer = vtkImageViewer2::New();&nbsp;</font></div><div style="background-color:
 transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; viewer-&gt;SetupInteractor(iren);&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><br></font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; //Load DICOM Image into Viewer&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; vtkDICOMImageReader* reader = vtkDICOMImageReader::New();&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp;
 &nbsp; &nbsp; reader-&gt;SetDirectoryName("F:/Neurostar/Imaging Data/MRSet");&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; reader-&gt;Update();&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; viewer-&gt;SetInput(reader-&gt;GetOutput());</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">        </span>viewer-&gt;SetSlice(40);</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><br></font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                </span>//Draw the Circle</font></div><div
 style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                </span>vtkSmartPointer&lt;vtkPolyData&gt; pd = vtkSmartPointer&lt;vtkPolyData&gt;::New();</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                </span>vtkSmartPointer&lt;vtkPoints&gt; points = vtkSmartPointer&lt;vtkPoints&gt;::New();</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                </span>vtkSmartPointer&lt;vtkCellArray&gt; lines = vtkSmartPointer&lt;vtkCellArray&gt;::New();</font></div><div style="background-color: transparent; "><font face="times new roman, new york,
 times, serif"><span class="Apple-tab-span" style="white-space:pre">                </span>vtkIdType* lineIndices = new vtkIdType[21];</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                        </span>for (int i = 0; i&lt; 20; i++)</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                        </span>{</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                                </span>const double angle = 2.0*vtkMath::Pi()*i/20.0;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                                </span>points-&gt;InsertPoint(static_cast&lt;vtkIdType&gt;(i),
 0.1*cos(angle),0.1*sin(angle), 0.0 );</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                                </span>lineIndices[i] = static_cast&lt;vtkIdType&gt;(i);</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                        </span>}</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                        </span>lineIndices[20] = 0;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                        </span>lines-&gt;InsertNextCell(21,lineIndices);</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span
 class="Apple-tab-span" style="white-space:pre">                        </span>delete [] lineIndices;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                        </span>pd-&gt;SetPoints(points);</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                        </span>pd-&gt;SetLines(lines);</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><br></font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; //Setting up Contour Widget&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; vtkContourWidget* widget =
 vtkContourWidget::New();&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; vtkOrientedGlyphContourRepresentation* rep = vtkOrientedGlyphContourRepresentation::New();&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; rep-&gt;GetLinesProperty()-&gt;SetColor(1, 0, 0);</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                </span>widget-&gt;SetRepresentation(rep);</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; widget-&gt;SetCurrentRenderer(viewer-&gt;GetRenderer());</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times,
 serif">&nbsp; &nbsp; &nbsp; &nbsp; widget-&gt;SetInteractor(iren);</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                </span>widget-&gt;On();</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                </span>widget-&gt;SetEnabled(true);</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                </span>widget-&gt;ProcessEventsOn();&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><br></font></div><div style="background-color:
 transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; //Start Interaction</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                </span>widget-&gt;Initialize(pd);</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                </span>widget-&gt;Render();</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //viewer-&gt;Render();</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><span class="Apple-tab-span" style="white-space:pre">                </span>iren-&gt;Initialize();</font></div><div style="background-color: transparent; "><font face="times
 new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; iren-&gt;Start();&nbsp;</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">}&nbsp;</font></div></div></div></body></html>