<div dir="ltr"><div>Dear all <br></div><div><br></div><div>i update the question i wrote wrong the perpendicular making changes</div><div> 
  double perpendicular[3] = { vt[0],0,vt[1] };</div><div><br></div><div>but i see that even i compute the perpendicular what it gives it is not what i want. What i want is the slice that intersects in this orientation not to create a new coordinate using this orientation. Any idea? <br></div><div><br></div><div>thanks<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El lun., 25 mar. 2019 a las 20:08, zandarina (<<a href="mailto:esmeralda.ruiz@alma3d.com">esmeralda.ruiz@alma3d.com</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear all<br>
<br>
I want to reslice a 3d volume computing the perpendicular<br>
between two points x and y. I compute the<br>
perpendicular berween point 1, point2 in x and y (z is the same for all<br>
points as the <br>
poins are obtained of one slice)<br>
<br>
And then i compute the perpendicular of x and y<br>
And i compute the rotation. And i get a blank image. I would like to<br>
cut the slice cutting through the perpendicular of those two points.<br>
<br>
I attach the code. Is there something wrong<br>
<br>
Any help?<br>
<br>
Thanks in advance<br>
<br>
<br>
  double vt[3];<br>
        vt[0] = pts2[0] - pts1[0];<br>
        vt[1] = pts2[1] - pts1[1];<br>
        vt[2] = pts2[2] - pts1[2]; // it will be 0 as z is the same in all<br>
points<br>
        double perpendicular[3] = { -vt[1],vt[0],0 };<br>
<br>
        double startPoint[3], endPoint[3];<br>
        startPoint[0] = tar_cen[0];<br>
        startPoint[1] = tar_cen[1];<br>
        startPoint[2] = tar_cen[2];<br>
        endPoint[0] = startPoint[0] + perpendicular[0];<br>
        endPoint[1] = startPoint[1] + perpendicular[1];<br>
        endPoint[2] = startPoint[2] + perpendicular[2];<br>
<br>
        // Compute a basis<br>
        double normalizedX[3];<br>
        double normalizedY[3];<br>
        double normalizedZ[3];<br>
<br>
        // The X axis is a vector from start to end<br>
        vtkMath::Subtract(endPoint, startPoint, normalizedX);<br>
        //double length = vtkMath::Norm(normalizedX);<br>
        vtkMath::Normalize(normalizedX);<br>
<br>
        // The Z axis is an arbitrary vector cross X<br>
        double arbitrary[3];<br>
        arbitrary[0] = vtkMath::Random(-10, 10);<br>
        arbitrary[1] = vtkMath::Random(-10, 10);<br>
        arbitrary[2] = vtkMath::Random(-10, 10);<br>
        vtkMath::Cross(normalizedX, arbitrary, normalizedZ);<br>
        vtkMath::Normalize(normalizedZ);<br>
<br>
        // The Y axis is Z cross X<br>
        vtkMath::Cross(normalizedZ, normalizedX, normalizedY);<br>
        vtkSmartPointer<vtkMatrix4x4> matrix =<br>
            vtkSmartPointer<vtkMatrix4x4>::New();<br>
<br>
        // Create the direction cosine matrix<br>
        matrix->Identity();<br>
        for (unsigned int i = 0; i < 3; i++)<br>
        {<br>
            matrix->SetElement(i, 0, normalizedX[i]);<br>
            matrix->SetElement(i, 1, normalizedY[i]);<br>
            matrix->SetElement(i, 2, normalizedZ[i]);<br>
        }<br>
<br>
        // Apply the transforms<br>
        vtkSmartPointer<vtkTransform> transform =<br>
            vtkSmartPointer<vtkTransform>::New();<br>
        transform->Translate(startPoint);<br>
        transform->Concatenate(matrix);<br>
<br>
<br>
<br>
<br>
        reslice->SetResliceTransform(transform);<br>
<br>
<br>
        //Step 3: done<br>
        reslice->Update();<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html</a><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://vtk.org/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div>