<div dir="ltr"><div>If that helps, this piece of Python code produces exactly the same geometries on my computer. I did not see the problem in your code, doesn't it produce the same geometries?<br></div><div><br></div><div><span style="font-family:monospace">import itk<br>from itk import RTK as rtk<br>import numpy as np<br><br>eu = itk.Euler3DTransform.New()<br>degreesToRadians = np.pi/180.<br>eu = itk.Euler3DTransform.New()<br>eu.SetRotation(20 * degreesToRadians, 0, 0);<br>locSourcePosition = eu.TransformPoint([0,0,1000]);<br>locDetectorPosition = eu.TransformPoint([0,0,-500]);<br>locDetectorRowDirection = eu.TransformVector([1,0,0]);<br>locDetectorColumnDirection = eu.TransformVector([0,1,0]);<br>geometry = rtk.ThreeDCircularProjectionGeometry.New()<br>geometry.AddProjection(locSourcePosition, locDetectorPosition, locDetectorRowDirection, locDetectorColumnDirection)<br>geometry2 = rtk.ThreeDCircularProjectionGeometry.New()<br>geometry2.AddProjection(1000.,1500.,0.,0.,0.,20.)<br>xmlWriter = rtk.ThreeDCircularProjectionGeometryXMLFileWriter.New()<br>xmlWriter.SetFilename ( 'g' )<br>xmlWriter.SetObject ( geometry )<br>xmlWriter.WriteFile()<br>xmlWriter.SetFilename ( 'g2' )<br>xmlWriter.SetObject ( geometry2 )<br>xmlWriter.WriteFile()</span></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 23, 2024 at 4:32 PM Nikolay Filatov <<a href="mailto:filatovna83@gmail.com" target="_blank">filatovna83@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Yes, it's original drawing, and I have solved it. Thx. Just another little question to clarify my understanding.<br>Here is the desired rotation <a href="https://imgur.com/a/OjVloNX" target="_blank">https://imgur.com/a/OjVloNX</a>. <br><div><br></div><div>Am I right that if I specify <span style="color:rgb(101,123,131)">outOfPlaneAngle by the following code (got from </span>rtkTestReg23ProjectionGeometry.cpp<span style="color:rgb(101,123,131)">) I can get the desired rotation, i.e. rotation in </span>object coordinate system.</div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(101,123,131)">eu</span><span style="color:rgb(101,123,131)">-></span><span style="color:rgb(101,123,131)">SetRotation</span>(<span style="color:rgb(101,123,131)">outOfPlaneAngle</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">*</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">degreesToRadians</span>,<span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">gantryAngle</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">*</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">degreesToRadians</span>,<span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">inPlaneAngle</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">*</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">degreesToRadians</span>);</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(101,123,131)">locSourcePosition</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">=</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">eu</span><span style="color:rgb(101,123,131)">-></span><span style="font-style:italic;color:rgb(101,123,131)">TransformPoint</span>(<span style="color:rgb(101,123,131)">sourcePosition</span>);</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(101,123,131)">locDetectorPosition</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">=</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">eu</span><span style="color:rgb(101,123,131)">-></span><span style="font-style:italic;color:rgb(101,123,131)">TransformPoint</span>(<span style="color:rgb(101,123,131)">detectorPosition</span>);</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(101,123,131)">locDetectorRowDirection</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">=</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">eu</span><span style="color:rgb(101,123,131)">-></span><span style="font-style:italic;color:rgb(101,123,131)">TransformVector</span>(<span style="color:rgb(101,123,131)">detectorRowDirection</span>);</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(101,123,131)">locDetectorColumnDirection</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">=</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">eu</span><span style="color:rgb(101,123,131)">-></span><span style="font-style:italic;color:rgb(101,123,131)">TransformVector</span>(<span style="color:rgb(101,123,131)">detectorColumnDirection</span>);</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:Arial,Helvetica,sans-serif;color:rgb(38,139,210)">geometry_</span><span style="font-family:Arial,Helvetica,sans-serif;color:rgb(101,123,131)">-></span><span style="font-family:Arial,Helvetica,sans-serif;color:rgb(101,123,131)">AddProjection</span><span style="font-family:Arial,Helvetica,sans-serif">(</span><span style="font-family:Arial,Helvetica,sans-serif;color:rgb(101,123,131)">locSourcePosition</span><span style="font-family:Arial,Helvetica,sans-serif">,</span><span style="font-family:Arial,Helvetica,sans-serif;color:rgb(238,232,213)"> </span><span style="font-family:Arial,Helvetica,sans-serif;color:rgb(101,123,131)">locDetectorPosition</span><span style="font-family:Arial,Helvetica,sans-serif">,</span><span style="font-family:Arial,Helvetica,sans-serif;color:rgb(238,232,213)"> </span><span style="font-family:Arial,Helvetica,sans-serif;color:rgb(101,123,131)">locDetectorRowDirection</span><span style="font-family:Arial,Helvetica,sans-serif">,</span><span style="font-family:Arial,Helvetica,sans-serif;color:rgb(238,232,213)"> </span><span style="font-family:Arial,Helvetica,sans-serif;color:rgb(101,123,131)">locDetectorColumnDirection</span><span style="font-family:Arial,Helvetica,sans-serif">);</span><br></pre></div><div><br></div><div>While in this call </div><div> geometry->AddProjection(args_info.sid_arg,<br> args_info.sdd_arg,<br> angle,<br> args_info.proj_iso_x_arg,<br> args_info.proj_iso_y_arg,<br> args_info.out_angle_arg,<br> args_info.in_angle_arg,<br> args_info.source_x_arg,<br> args_info.source_y_arg);<br></div><div>args_info.out_angle_arg performs rotation in detector coordinate system ?</div><div><br></div><div><br></div></div><div dir="ltr"><div><br></div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">eu</span><span style="color:rgb(101,123,131)">-></span><span style="color:rgb(101,123,131)">SetRotation</span>(<span style="color:rgb(101,123,131)">outOfPlaneAngle</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">*</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">degreesToRadians</span>,<span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">gantryAngle</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">*</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">degreesToRadians</span>,<span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">inPlaneAngle</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">*</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">degreesToRadians</span>);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">locSourcePosition</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">=</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">eu</span><span style="color:rgb(101,123,131)">-></span><span style="font-style:italic;color:rgb(101,123,131)">TransformPoint</span>(<span style="color:rgb(101,123,131)">sourcePosition</span>);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">locDetectorPosition</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">=</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">eu</span><span style="color:rgb(101,123,131)">-></span><span style="font-style:italic;color:rgb(101,123,131)">TransformPoint</span>(<span style="color:rgb(101,123,131)">detectorPosition</span>);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">locDetectorRowDirection</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">=</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">eu</span><span style="color:rgb(101,123,131)">-></span><span style="font-style:italic;color:rgb(101,123,131)">TransformVector</span>(<span style="color:rgb(101,123,131)">detectorRowDirection</span>);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">locDetectorColumnDirection</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">=</span><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">eu</span><span style="color:rgb(101,123,131)">-></span><span style="font-style:italic;color:rgb(101,123,131)">TransformVector</span>(<span style="color:rgb(101,123,131)">detectorColumnDirection</span>);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(238,232,213)"> </span><span style="color:rgb(38,139,210)">geometry_</span><span style="color:rgb(101,123,131)">-></span><span style="color:rgb(101,123,131)">AddReg23Projection</span>(<span style="color:rgb(101,123,131)">locSourcePosition</span>,<span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">locDetectorPosition</span>,<span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">locDetectorRowDirection</span>,<span style="color:rgb(238,232,213)"> </span><span style="color:rgb(101,123,131)">locDetectorColumnDirection</span>);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(238,232,213)"> </span></pre>doesn't the <span style="color:rgb(101,123,131)">outOfPlaneAngle variable correspond to </span>
args_info.out_angle_arg in the following call :<span style="color:rgb(101,123,131)"><br></span> geometry->AddProjection(args_info.sid_arg,<br> args_info.sdd_arg,<br> angle,<br> args_info.proj_iso_x_arg,<br> args_info.proj_iso_y_arg,<br> args_info.out_angle_arg,<br> args_info.in_angle_arg,<br> args_info.source_x_arg,<br> args_info.source_y_arg);<br>?<br><br>If these are the same,for some reason they work differently. If not, sorry that I haven't figured it out yet)<br><br>Best regards<br><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">вт, 23 июл. 2024 г. в 13:20, Simon Rit <<a href="mailto:simon.rit@creatis.insa-lyon.fr" target="_blank">simon.rit@creatis.insa-lyon.fr</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div>I don't follow what you're trying to achieve. outOfPlaneAnle and inPlaneAngle are angles in the detector coordinate system. In your example, you apply these rotations in the object coordinate systems so they can't be an in-plane angle and an out-of-plane angle.</div><div>If I look at your original drawing, you should just set source and detector offsets in the X direction.</div><div>Simon<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 23, 2024 at 9:17 AM Nikolay Filatov <<a href="mailto:filatovna83@gmail.com" target="_blank">filatovna83@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi. Yea, thx a lot, new method <span style="color:rgb(101,123,131)">AddReg23Projection almost does what I need. Tried all offsets and detector's orientations.</span><div><span style="color:rgb(101,123,131)">The only problem with new geometry method is that I can't setup </span><span style="color:rgb(101,123,131)">outOfPlaneAngle or </span><span style="color:rgb(101,123,131)">inPlaneAngle properly. </span></div><div><span style="color:rgb(101,123,131)">Here </span><a href="http://90.188.95.4:8080/index.php/s/oADGdyyzRUHfEO8" target="_blank">http://90.188.95.4:8080/index.php/s/oADGdyyzRUHfEO8</a> are two videos where I setup default geometry with arc=360 and <span style="color:rgb(101,123,131)">outOfPlaneAngle</span><span style="color:rgb(101,123,131)">=20 for both </span><span style="color:rgb(147,161,161);font-style:italic">AddProjection</span><span style="color:rgb(147,161,161);font-style:italic"> and </span><span style="color:rgb(101,123,131)">AddReg23Projection</span><span style="color:rgb(101,123,131)"> methods. </span><span style="color:rgb(147,161,161);font-style:italic">AddProjection is ok, while </span><span style="color:rgb(101,123,131)">AddReg23Projection</span><span style="color:rgb(101,123,131)"> looks strange to me. I expect the same result, as with </span><span style="color:rgb(101,123,131)">gantryAngle.</span></div><div><span style="color:rgb(101,123,131)"><br></span></div><div><span style="color:rgb(101,123,131)">Here is the simple code to generate geometry file with </span>AddReg23Projection.</div><div> sourcePosition[0] = 0;<br> sourcePosition[1] = 0.;<br> sourcePosition[2] = 1000.;<br> detectorPosition[0] = 0;<br> detectorPosition[1] = 0;<br> detectorPosition[2] = -536.;<br> detectorRowDirection[0] = 1;<br> detectorRowDirection[1] = 0;<br> detectorRowDirection[2] = 0;<br> detectorColumnDirection[0] = 0;<br> detectorColumnDirection[1] = 1;<br> detectorColumnDirection[2] = 0;<br><br> const double degreesToRadians = atan(1.0) / 45.;<br> double outOfPlaneAngle = 20;<br> double inPlaneAngle = 0;<br> double gantryAngle = 0;<br><br> for (int noProj = 0; noProj < 180; noProj++)<br> {<br> double angle = noProj * 360. / 180;<br> gantryAngle = angle;<br><br> eu->SetRotation(outOfPlaneAngle * degreesToRadians, gantryAngle * degreesToRadians, inPlaneAngle * degreesToRadians);<br> locSourcePosition = eu->TransformPoint(sourcePosition);<br> locDetectorPosition = eu->TransformPoint(detectorPosition);<br> locDetectorRowDirection = eu->TransformVector(detectorRowDirection);<br> locDetectorColumnDirection = eu->TransformVector(detectorColumnDirection);<br><br> if (!geometry->AddReg23Projection(locSourcePosition, locDetectorPosition, locDetectorRowDirection, locDetectorColumnDirection)) </div><div> {<br> lok = false;<br> }<br> }<br><br> // Write<br><br> rtk::WriteGeometry(geometry, "geometry.xml");<br></div><div><span style="color:rgb(101,123,131)"><br></span></div><div><span style="color:rgb(101,123,131)"><br></span></div><div><font color="#657b83">Also I executed </font>rtkTestReg23ProjectionGeometry with geometry specified above, and all tests passed.. </div><div>If I missed something, let me know please..</div><div><br></div><div>Best regards<br></div><div><span style="color:rgb(101,123,131)"><br></span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">ср, 10 июл. 2024 г. в 12:28, Simon Rit <<a href="mailto:simon.rit@creatis.insa-lyon.fr" target="_blank">simon.rit@creatis.insa-lyon.fr</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div>With 9 degrees of freedom, you can define any position and orientation of the source / detector with the current parametrization. What you are showing is a different GantryAngle with a SourceOffset. It's not always obvious how these should be set but there is a simpler solution: provide the source position, detector position and coordinates of the two axes of the detector:</div><div><a href="http://www.openrtk.org/Doxygen/classrtk_1_1ThreeDCircularProjectionGeometry.html#a0fb1475ed76a28cde24fac85eae18e1e" target="_blank">http://www.openrtk.org/Doxygen/classrtk_1_1ThreeDCircularProjectionGeometry.html#a0fb1475ed76a28cde24fac85eae18e1e</a></div><div>I hope it helps,</div><div>Simon<br></div><div> <br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 10, 2024 at 8:13 AM Nikolay Filatov <<a href="mailto:filatovna83@gmail.com" target="_blank">filatovna83@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello RTK users. I've got a question about geometry. I want to rotate the detector for all orientations around itself and InPlaneAngle, OutOfPlaneAngle perform two rotations, but GantryAngle is not exactly what I need (<a href="https://imgur.com/a/kDpfk5G" target="_blank">https://imgur.com/a/kDpfk5G</a>)<br>Thanks to geometry invariant I can specify this angle through source_x, detector_x offset, but source_x affects InPlaneAngle and OutOfPlaneAngle. IMHO one of the possible solutions is to change RTK geometry final matrix - swap Mrotation and Mtranslation, so source_x shouldn't affect InPlaneAngle and OutOfPlaneAngle.<br><br>Here<br>rtkThreeDCircularProjectionGeometry.cxx<br>void rtk::ThreeDCircularProjectionGeometry::AddProjectionInRadians(...)<br>{<br>...<br> matrix = this->GetProjectionTranslationMatrices().back().GetVnlMatrix() *<br> this->GetMagnificationMatrices().back().GetVnlMatrix() *<br> this->GetSourceTranslationMatrices().back().GetVnlMatrix();<br> this->GetRotationMatrices().back().GetVnlMatrix();<br>---><br> matrix = this->GetProjectionTranslationMatrices().back().GetVnlMatrix() *<br> this->GetMagnificationMatrices().back().GetVnlMatrix() *<br> this->GetRotationMatrices().back().GetVnlMatrix();<br> this->GetSourceTranslationMatrices().back().GetVnlMatrix();<br>...<br>}<br>didn't give desired result.<br><br>So, is it somehow possible to specify this angle along with InPlaneAngle, OutOfPlaneAngle ?<br></div>
_______________________________________________<br>
Rtk-users mailing list<br>
<a href="mailto:rtk-users@openrtk.org" target="_blank">rtk-users@openrtk.org</a><br>
<a href="https://www.creatis.insa-lyon.fr/mailman/listinfo/rtk-users" rel="noreferrer" target="_blank">https://www.creatis.insa-lyon.fr/mailman/listinfo/rtk-users</a><br>
</blockquote></div>
</blockquote></div></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div></div></div>
</blockquote></div>