<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Hi Jason,</div><div class="gmail_quote"><br></div><div class="gmail_quote">This approach does not work well because AutoCropOutputOn() changes</div><div class="gmail_quote">the extent of the output depending on the direction cosines.</div><div class="gmail_quote"><br></div><div class="gmail_quote">In general, it is not possible to do what you are trying to do with a simple</div><div class="gmail_quote">VTK pipeline.  Callbacks or some similar mechanism must be used to</div><div class="gmail_quote">properly update the the slice position every time the direction changes.</div><div class="gmail_quote">Position changes can be accomplished in two ways:</div><div class="gmail_quote">1) by changing the fourth column of the ResliceAxes matrix (this modifies</div><div class="gmail_quote">the position in the "x" coordinate system, i.e. your 3D coordinate system)</div><div class="gmail_quote">2) by changing the OutputOrigin (this modifies the position in x' coords)</div><div class="gmail_quote"><br></div><div class="gmail_quote">As an example, see the UpdatePlane() method of vtkImagePlaneWidget:</div><div class="gmail_quote"><a href="http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Interaction/Widgets/vtkImagePlaneWidget.cxx#l1550">http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Interaction/Widgets/vtkImagePlaneWidget.cxx#l1550</a><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">For VTK 5.10 and VTK 6, you can try using the vtkImageResliceMapper.</div><div class="gmail_quote"><br></div><div class="gmail_quote"> - David</div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">On Thu, Apr 30, 2015 at 12:19 PM, Jason <span dir="ltr"><<a href="mailto:2130220212@email.szu.edu.cn" target="_blank">2130220212@email.szu.edu.cn</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi, David<br>
<br>
I cannot set the parameters like SetOutputOrigin, SetOutputSpacing,and<br>
SetOutputExtent for vtkImageReslice, as I get a slice image by the cosin<br>
value and one point's position.It will get a wrong slice if I set these<br>
paremeters for vtkImageReslice<br>
static double axialElements[16] = {<br>
        1, 0, 0, 0,<br>
        0, 0.866025, -0.5, 0,<br>
        0, 0.5, 0.866025, 0,<br>
        0, 0, 0, 1 };<br>
<br>
vtkSmartPointer<vtkMatrix4x4> resliceAxes =<br>
vtkSmartPointer<vtkMatrix4x4>::New();<br>
resliceAxes->DeepCopy(axialElements);<br>
resliceAxes->SetElement(0, 3, 10);<br>
resliceAxes->SetElement(1, 3, 10);<br>
resliceAxes->SetElement(2, 3, 10);<br>
<br>
vtkSmartPointer<vtkImageReslice> reslice =<br>
vtkSmartPointer<vtkImageReslice>::New();<br>
reslice->SetInput(connector->GetOutput());<br>
reslice->SetOutputDimensionality(2);<br>
reslice->SetResliceAxes(resliceAxes);<br>
reslice->SetInterpolationModeToLinear();<br>
reslice->AutoCropOutputOn();<br>
<br>
vtkSmartPointer<vtkLookupTable> colorTable =<br>
vtkSmartPointer<vtkLookupTable>::New();<br>
colorTable->SetRange(0, 1000);<br>
colorTable->SetValueRange(0.0, 1.0);<br>
colorTable->SetSaturationRange(0.0, 0.0);<br>
colorTable->SetRampToLinear();<br>
colorTable->Build();<br>
<br>
My purpose is to calculate the origin of image(2D) in 3D volume position,and<br>
I can only get the bounds of the slice image through vtkImageActor :<br>
vtkSmartPointer<vtkImageMapToColors> colorMap =<br>
vtkSmartPointer<vtkImageMapToColors>::New();<br>
colorMap->SetLookupTable(colorTable);<br>
colorMap->SetInputConnection(reslice->GetOutputPort());<br>
<br>
vtkSmartPointer<vtkImageActor> imgActor =<br>
vtkSmartPointer<vtkImageActor>::New();<br>
imgActor->SetInput(colorMap->GetOutput());<br>
double extent[6]={0};<br>
imgActor->GetBounds(extent);<br>
<br>
Can I take point'(extent[0],extet[2]) as the original position of the slice<br>
image ?<br>
And calculate its corresponding position in 3D volume by  point = M*point' ?<br>
<br>
I'm not so sure if this is right or not. Maybe there is a way to get the<br>
original position(2D) by vtkImageReslice itself.<br></blockquote></div></div></div>