Hi all,<br>
<font size="2"><br>
</font><span>I've come across a strange issue. I've been adding actors
to the renderer in order to display some overlays in the windows, and
initially they look fine, but when I scroll through the slices and
compare the transaxial, coronal, and sagittal views, it is apparent
that there are discrepencies between the views.<br><br>For example, in a test case, I added a single dot (vertex) to the rendered image at world coordinates (50,50,50).<br><br>
<br>If I add the actor by "this->RenderWidget->AddViewProp(actor);"<br>or<br>"this->RenderWidget->GetRenderer()->AddActor(actor);"<br>then,<br>
In the transaxial view, I will see this dot from all of slices 0-49, at XY coordinates (50, 50).<br>
In the coronal view, I will see the dot from all of slices 51-127, at XZ coordinates (50, 50).<br>
In the sagittal view, I will see the dot from all of slices 0-49, at YZ coordinates (50, 50).<br>
(strange, every slice EXCEPT the correct one!)<br>
<br>If I add the actor by "this->RenderWidget->AddOverlayViewProp(actor);"<br>
or<br>"this->RenderWidget->GetOverlayRenderer()->AddActor(actor);"<br>then,<br>
In the transaxial view, I will see this dot from all of slices 48-54, at XY coordinates (50, 50).<br>
In the coronal view, I will see the dot from all of slices 46-53, at XZ coordinates (50, 50).<br>
In the sagittal view, I will see the dot from all of slices 47-56, at YZ coordinates (50, 50).<br><br>
<br>If I add the actor by<br>"this->ImageViewer->GetRenderer()->AddActor(actor);"<br>then<br>
In the transaxial view, I will see this dot from all of slices 0-49, at XY coordinates (50, 50).<br>In the coronal view, I will see the dot from all of slices 51-127, at XZ coordinates (50, 50).<br>In the sagittal view, I will see the dot from all of slices 0-49, at YZ coordinates (50, 50).
<br><br>
<br>So it seems that the views being represented on the XY, XZ, and YZ
planes are fine, but they are showing up on the wrong slices, and on
multiple slices.<br><br>Note that when adding actors to the overlay
renderer, the results are very different than when adding to normal
renderers. It seems strange to me, because both are derived from the
vtkRenderer class, are they not?<br></span><br>
The following is my code that generates the actor and adds it to the renderer.<br>
<br>
vtkPoints *points = vtkPoints::New();<br>
vtkCellArray *c<font size="2">ellArra</font>y = vtkCellArray::New();<br>
cellArray->InsertNextCell(1);<br>
points->InsertPoint(0, 50, 50, 50);<br>
cellArray->InsertCellPoint(0);
<br>
vtkPolyData *polyData = vtkPolyData::New();<br>
polyData->SetPoints(points);<br>
polyData->SetVerts(cellArray);<br>
vtkPolyDataMapper *polyDataMapper = vtkPolyDataMapper::New();<br>
polyDataMapper->SetInput(polyData);<br>
vtkActor *actor = vtkActor::New();<br>
actor->SetMapper(polyDataMapper);<br>
actor->GetProperty()->SetColor(0,0,0);<br>
actor->GetProperty()->SetPointSize(2);<br>
<br>
// this->RenderWidget->AddViewProp(actor)<br>
// this->RenderWidget->GetRenderer()->AddActor(actor);<br>
<br>
// this->RenderWidget->AddOverlayViewProp(actor);<br>
// this->RenderWidget->GetOverlayRenderer()->AddActor(actor);<br>
<br>
this->ImageViewer->GetRenderer()->AddActor(actor);<br>
<br>
this->ImageViewer->Modified();<br>
this->ImageViewer->Render();<br>
this->RenderWidget->Render();<br>
<br>
...<br>
<br>
...::SliceChangerCallback(...)<br>
this->ImageViewer->SetSlice((int)value);<br>
this->RecentlyModified = 1;<br>
<br>
<br>
I could really use some guidance on how to figure this out. I'm out of ideas.<br>
Any suggestions at all would be very welcome.<br>
<br>
Thanks very much,<br>
Sonca Teng<br>