<div dir="ltr">Hi Ang,<div><br></div><div>I tried your code with the VTK master branch and I didn't see any problem.</div><div>When I clicked on the image and moved the mouse, the image did not jump</div><div>to a new position. I can try this again with VTK 6.3, but probably not today.</div><div><br></div><div>You expect the image to stay centered in the window, correct?</div><div><br></div><div> - David</div><div><br></div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 15, 2015 at 8:21 PM, Ang <span dir="ltr"><<a href="mailto:ysa0829@gmail.com" target="_blank">ysa0829@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Cory,<br>
<br>
Below is my example .<br>
<br>
In vtk 6.0, click right mouse down and move mouse the image position is<br>
still in the center,<br>
<br>
but do the same thing in vtk 6.3, the image position will be changed when<br>
you click down and move.<br>
<br>
Please have a check, thanks for your assistance.<br>
<br>
//////////////////////////////////////////////////////////////////////////////////////////////<br>
<br>
vtkRenderWindow *renWin = vtkRenderWindow::New();<br>
vtkRenderWindowInteractor *interactor = vtkRenderWindowInteractor::New();<br>
vtkRenderer *renderer = vtkRenderer::New();<br>
vtkInteractorStyleImage *styleImage = vtkInteractorStyleImage::New();<br>
styleImage->SetInteractionModeToImageSlicing();<br>
interactor->SetInteractorStyle(styleImage);<br>
renWin->SetInteractor(interactor);<br>
renWin->AddRenderer(renderer);<br>
renderer->SetBackground(1, 0, 0);<br>
<br>
<br>
vtkImageResliceMapper *resliceMapper = vtkImageResliceMapper::New();<br>
vtkImageSlice *imageSlice = vtkImageSlice::New();<br>
vtkImageData *img = vtkImageData::New();<br>
img->SetDimensions(50, 50, 50);<br>
img->AllocateScalars(VTK_UNSIGNED_CHAR, 1);<br>
img->SetSpacing(1, 1, 1);<br>
<br>
for (int z = 0; z < img->GetDimensions()[2]; z++)<br>
{<br>
for (int x = 0; x < img->GetDimensions()[0]; x++)<br>
{<br>
for (int y = 0; y < img->GetDimensions()[1]; y++)<br>
{<br>
unsigned char *pixel = static_cast<unsigned<br>
char*>(img->GetScalarPointer(x, y, z));<br>
<br>
int c0 = img->GetDimensions()[0] / 2;<br>
int c1 = img->GetDimensions()[1] / 2;<br>
int c2 = img->GetDimensions()[2] / 2;<br>
double pointX = (x - c0)*(x - c0);<br>
double pointY = (y - c1)*(y - c1);<br>
double pointZ = (z - c2)*(z - c2);<br>
if (pointX + pointY + pointZ < 15 * 15)<br>
{<br>
*pixel = 255;<br>
}<br>
else<br>
{<br>
*pixel = 0;<br>
}<br>
}<br>
}<br>
}<br>
<br>
<br>
<br>
imageSlice->SetMapper(resliceMapper);<br>
resliceMapper->SetInputData(img);<br>
//set reslice plane to sagittal<br>
resliceMapper->GetSlicePlane()->SetNormal(1, 0, 0);<br>
resliceMapper->GetSlicePlane()->SetOrigin(25, 0, 0); // set plane to middle<br>
<br>
//set camera to sagittal orientation<br>
renderer->GetActiveCamera()->SetFocalPoint(0, 25, 25);<br>
renderer->GetActiveCamera()->SetPosition(200, 25, 25);<br>
renderer->GetActiveCamera()->SetViewUp(0, 0, 1);<br>
renderer->GetActiveCamera()->SetParallelScale(75);<br>
renderer->GetActiveCamera()->ParallelProjectionOn();<br>
<br>
renderer->AddActor(imageSlice);<br>
<br>
renWin->Render();<br>
interactor->Start();<br>
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br></blockquote></div></div></div></div>