<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" </font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">#include "vtkRenderWindowInteractor.h" </font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">#include "vtkContourWidget.h" </font></div><div style="background-color:
transparent; "><font face="times new roman, new york, times, serif">#include "vtkContourLineInterpolator.h" </font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">#include "vtkOrientedGlyphContourRepresentation.h" </font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">#include "vtkDICOMImageReader.h" </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() </font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">{ </font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"> //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"> vtkImageViewer2* viewer = vtkImageViewer2::New(); </font></div><div style="background-color:
transparent; "><font face="times new roman, new york, times, serif"> vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New(); </font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"> viewer->SetupInteractor(iren); </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"> //Load DICOM Image into Viewer </font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"> vtkDICOMImageReader* reader = vtkDICOMImageReader::New(); </font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">
reader->SetDirectoryName("F:/Neurostar/Imaging Data/MRSet"); </font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"> reader->Update(); </font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"> viewer->SetInput(reader->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->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<vtkPolyData> pd = vtkSmartPointer<vtkPolyData>::New();</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"> </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<vtkPoints> points = vtkSmartPointer<vtkPoints>::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<vtkCellArray> lines = vtkSmartPointer<vtkCellArray>::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< 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->InsertPoint(static_cast<vtkIdType>(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<vtkIdType>(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->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->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->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"> //Setting up Contour Widget </font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"> vtkContourWidget* widget =
vtkContourWidget::New(); </font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"> vtkOrientedGlyphContourRepresentation* rep = vtkOrientedGlyphContourRepresentation::New(); </font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"> rep->GetLinesProperty()->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->SetRepresentation(rep);</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"> widget->SetCurrentRenderer(viewer->GetRenderer());</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times,
serif"> widget->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->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->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->ProcessEventsOn(); </font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"> </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"> //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->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->Render();</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"> //viewer->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->Initialize();</font></div><div style="background-color: transparent; "><font face="times
new roman, new york, times, serif"> iren->Start(); </font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">} </font></div></div></div></body></html>