<div dir="ltr">Hi Panos,<div><br></div><div>Setting the clipping range is a good idea, the "Slice" interaction will not</div><div>move beyond the clipping planes.</div><div><br></div><div>I found another way to way to work around the "sliding" problem, but it</div><div>might cause the window/level interaction to slow down a bit:</div><div><br></div><div> dicomMapper->SeparateWindowLevelOperationOff();<br></div><div><br></div><div>Once I find the root cause of the problem, I'll submit a patch to VTK.</div><div><br></div><div>Cheers,</div><div> - David</div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 14, 2018 at 6:21 AM, ochampao <span dir="ltr"><<a href="mailto:ochampao@hotmail.com" target="_blank">ochampao@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi David,<br>
<br>
Thanks a lot for your helpful comments. Based on your suggestions I've tried<br>
a few things. Here's what I got:<br>
<br>
1. using style->SetImageOrientation(<wbr>vLeftToRight, vBottomToTop);<br>
<br>
Using this approach I am able to change the slicing plane on demand. I can<br>
still see the "sliding image" effect that I have mentioned above.<br>
<br>
2. using vtkImageSliceMapper instead of vtkImageResliceMapper:<br>
<br>
This approach solves the "sliding image".<br>
<br>
3. Setting the camera's clipping range manually so that the min/max clipping<br>
planes coincide exactly with the first (i.e. closest to camera) and last<br>
(i.e. furthest from camera) slice of the volume (normal to the direction of<br>
projection). Note that I am still using vtkImageResliceMapper here.<br>
<br>
This approach solves the "sliding image" effect as well. What I have noticed<br>
is, when using renderer-><wbr>ResetCameraClippingRange(), the clipping range<br>
calculated automatically does not coincide with the planes of the first and<br>
last slice of the volume. If the clipping range is set manually so that it<br>
does coincide using renderer->GetActiveCamera()-><wbr>SetClippingRange(dMin,<br>
dMax), then the "sliding image" effect does not appear. In fact, if I<br>
compare the clipping range calculated automatically when using<br>
vtkImageSliceMapper this is exactly what happens i.e. the clipping range<br>
coincides with the first/last slices of the volume.<br>
<br>
Here are the changes to my code above that I made to set the clipping range<br>
manually:<br>
<br>
==============================<wbr>====<br>
// ...<br>
dicomMapper-><wbr>SliceAtFocalPointOn();<br>
<br>
// ... more code ...<br>
<br>
// Setup renderers<br>
<span class="gmail-">vtkNew<vtkRenderer> renderer;<br>
renderer->AddViewProp(<wbr>imageStack);<br>
renderer->GetActiveCamera()-><wbr>ParallelProjectionOn();<br>
renderer->ResetCamera();<br>
</span>renderer->GetActiveCamera()-><wbr>Azimuth(270);<br>
renderer->GetActiveCamera()-><wbr>OrthogonalizeViewUp();<br>
<br>
// Assuming that the origin of the volume is at (0,0,0)<br>
double* cameraPosition = renderer->GetActiveCamera()-><wbr>GetPosition();<br>
int* dims = dicomReader->GetOutput()-><wbr>GetDimensions();<br>
double* spacing = dicomReader->GetOutput()-><wbr>GetSpacing();<br>
<br>
// Coordinates of points along the direction of projection that define the<br>
min/max clipping planes<br>
// such that the min/max clipping planes coincide with the slices closest<br>
and furthest from the camera.<br>
double pMin[3] = { 0, dims[1] / 2 * spacing[1], dims[2] / 2 * spacing[2] };<br>
double pMax[3] = { dims[0] * spacing[0], dims[1] / 2 * spacing[1], dims[2] /<br>
2 * spacing[2] };<br>
<br>
// Calculate min/max clipping range along the direction of projection<br>
double dMin = sqrt(vtkMath::<wbr>Distance2BetweenPoints(pMin, cameraPosition));<br>
double dMax = sqrt(vtkMath::<wbr>Distance2BetweenPoints(pMax, cameraPosition));<br>
<br>
// Update clipping range<br>
renderer->GetActiveCamera()-><wbr>SetClippingRange(dMin, dMax);<br>
==============================<wbr>====<br>
<br>
Kind regards,<br>
Panayiotis.<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br></div></div></blockquote></div></div></div></div>