<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><DIV style="LINE-HEIGHT: 1.7; FONT-FAMILY: arial; COLOR: #000000; FONT-SIZE: 14px">
<DIV>Hi,</DIV>
<DIV>We try to locate a instance of vtkImageActor at the center of a cube, but not at the correct location.Our code as the </DIV>
<DIV>following:</DIV>
<DIV> </DIV>
<DIV>//instance OutlineFilter, imagedata is type of vtkImageData</DIV>
<DIV> vtkSmartPointer<vtkOutlineFilter> outlineData = vtkSmartPointer<vtkOutlineFilter>::New();<BR> outlineData->SetInput(imagedata);<BR> outlineData->Update();</DIV>
<DIV><BR> vtkSmartPointer<vtkPolyDataMapper> mapOutline =vtkSmartPointer<vtkPolyDataMapper>::New();<BR> mapOutline->SetInputConnection(outlineData->GetOutputPort());</DIV>
<DIV><BR> vtkSmartPointer<vtkActor> outline = vtkSmartPointer<vtkActor>::New();<BR> outline->SetMapper(mapOutline);<BR> outline->GetProperty()->SetColor(0,0,0);</DIV>
<DIV><BR> ren->AddActor(outline);</DIV>
<DIV> </DIV>
<DIV>//get the center of the outline</DIV>
<DIV> outline->GetBounds(bounds);<BR> width[0]=bounds[1]-bounds[0];<BR> width[1]=bounds[3]-bounds[2];<BR> width[2]=bounds[5]-bounds[4];<BR> center[0]=bounds[0]+width[0]*0.5;<BR> center[1]=bounds[2]+width[1]*0.5;<BR> center[2]=bounds[4]+width[2]*0.5;</DIV>
<DIV> </DIV>
<DIV>//instance vtkImageMapToColors</DIV>
<DIV>vtkSmartPointer<vtkImageMapToColors> axialColors = vtkSmartPointer<vtkImageMapToColors>::New();<BR> axialColors->SetInput(imagedata);<BR> axialColors->Update();</DIV>
<DIV> </DIV>
<DIV>//add axialColors to ImageActor</DIV>
<DIV> vtkSmartPointer<vtkImageActor> axial =vtkSmartPointer<vtkImageActor>::New();<BR> axial->SetInput(axialColors->GetOutput());<BR> axial->SetDisplayExtent(bounds[0],bounds[1], bounds[2],bounds[3],center[2],center[2]);//the center of Z axis</DIV>
<DIV> </DIV>
<DIV>We use the method of "vtkImageActor::SetDisplayExtent" to locate the imageactor at the center of the outline, but</DIV>
<DIV>it not at the center. The result shown in the attached image "result.png". We don't modify the coordinate system</DIV>
<DIV>(all are default). How could we solve this problem.</DIV>
<DIV>
<DIV><SPAN name="subject">The version of VTK is 5.10.0, which is compiled from source, our systerm is Windows XP (SP3).</SPAN></DIV></DIV>
<DIV>Thanks!</DIV>
<DIV> </DIV>
<DIV>XiongXiang Zhang</DIV></DIV></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>