[Rtk-users] rotating the detector around itself
Simon Rit
simon.rit at creatis.insa-lyon.fr
Tue Jul 23 14:24:45 CEST 2024
Back to the mailing list, otherwise I won't reply.
Is this drawing <https://imgur.com/a/kDpfk5G> the original one? If yes,
this drawing does not show any out of plane rotation. The detector might
not be orthogonal to the screen but the drawing does not show it. This
drawing only shows a gantry angle with source and detector offsets in the X
direction.
So if I look at your code, you need to set sourcePosition[0] and
detectorPosition[0] to non zero values (e.g. -200 and 200) and set
outOfPlane to 0.
On Tue, Jul 23, 2024 at 1:31 PM Nikolay Filatov <filatovna83 at gmail.com>
wrote:
> Hi again.
> My original drawing is working fine. Now I want to perform rotation which
> specified with
> --out_angle=DOUBLE Out of plane angle (default=`0')
> (rtksimulatedgeometry)
> but with new method AddReg23Projection.
> When we write the following code
>
> eu->SetRotation(outOfPlaneAngle * degreesToRadians, gantryAngle * degreesToRadians, inPlaneAngle * degreesToRadians);
>
> locSourcePosition = eu->TransformPoint(sourcePosition);
>
> locDetectorPosition = eu->TransformPoint(detectorPosition);
>
> locDetectorRowDirection = eu->TransformVector(detectorRowDirection);
>
> locDetectorColumnDirection = eu->TransformVector(detectorColumnDirection);
>
>
> geometry_->AddReg23Projection(locSourcePosition, locDetectorPosition, locDetectorRowDirection, locDetectorColumnDirection);
>
> doesn't the outOfPlaneAngle variable correspond to
> args_info.out_angle_arg in the following call :
> geometry->AddProjection(args_info.sid_arg,
> args_info.sdd_arg,
> angle,
> args_info.proj_iso_x_arg,
> args_info.proj_iso_y_arg,
> args_info.out_angle_arg,
> args_info.in_angle_arg,
> args_info.source_x_arg,
> args_info.source_y_arg);
> ?
>
> If these are the same,for some reason they work differently. If not, sorry
> that I haven't figured it out yet)
>
> Best regards
>
>
> вт, 23 июл. 2024 г. в 13:20, Simon Rit <simon.rit at creatis.insa-lyon.fr>:
>
>> Hi,
>> 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.
>> If I look at your original drawing, you should just set source and
>> detector offsets in the X direction.
>> Simon
>>
>> On Tue, Jul 23, 2024 at 9:17 AM Nikolay Filatov <filatovna83 at gmail.com>
>> wrote:
>>
>>> Hi. Yea, thx a lot, new method AddReg23Projection almost does what I
>>> need. Tried all offsets and detector's orientations.
>>> The only problem with new geometry method is that I can't setup outOfPlaneAngle
>>> or inPlaneAngle properly.
>>> Here http://90.188.95.4:8080/index.php/s/oADGdyyzRUHfEO8 are two videos
>>> where I setup default geometry with arc=360 and outOfPlaneAngle=20 for
>>> both AddProjection and AddReg23Projection methods. AddProjection is
>>> ok, while AddReg23Projection looks strange to me. I expect the same
>>> result, as with gantryAngle.
>>>
>>> Here is the simple code to generate geometry file with
>>> AddReg23Projection.
>>> sourcePosition[0] = 0;
>>> sourcePosition[1] = 0.;
>>> sourcePosition[2] = 1000.;
>>> detectorPosition[0] = 0;
>>> detectorPosition[1] = 0;
>>> detectorPosition[2] = -536.;
>>> detectorRowDirection[0] = 1;
>>> detectorRowDirection[1] = 0;
>>> detectorRowDirection[2] = 0;
>>> detectorColumnDirection[0] = 0;
>>> detectorColumnDirection[1] = 1;
>>> detectorColumnDirection[2] = 0;
>>>
>>> const double degreesToRadians = atan(1.0) / 45.;
>>> double outOfPlaneAngle = 20;
>>> double inPlaneAngle = 0;
>>> double gantryAngle = 0;
>>>
>>> for (int noProj = 0; noProj < 180; noProj++)
>>> {
>>> double angle = noProj * 360. / 180;
>>> gantryAngle = angle;
>>>
>>> eu->SetRotation(outOfPlaneAngle * degreesToRadians, gantryAngle
>>> * degreesToRadians, inPlaneAngle * degreesToRadians);
>>> locSourcePosition = eu->TransformPoint(sourcePosition);
>>> locDetectorPosition = eu->TransformPoint(detectorPosition);
>>> locDetectorRowDirection =
>>> eu->TransformVector(detectorRowDirection);
>>> locDetectorColumnDirection =
>>> eu->TransformVector(detectorColumnDirection);
>>>
>>> if (!geometry->AddReg23Projection(locSourcePosition,
>>> locDetectorPosition, locDetectorRowDirection, locDetectorColumnDirection))
>>>
>>> {
>>> lok = false;
>>> }
>>> }
>>>
>>> // Write
>>>
>>> rtk::WriteGeometry(geometry, "geometry.xml");
>>>
>>>
>>> Also I executed rtkTestReg23ProjectionGeometry with geometry specified
>>> above, and all tests passed..
>>> If I missed something, let me know please..
>>>
>>> Best regards
>>>
>>>
>>> ср, 10 июл. 2024 г. в 12:28, Simon Rit <simon.rit at creatis.insa-lyon.fr>:
>>>
>>>> Hi,
>>>> 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:
>>>>
>>>> http://www.openrtk.org/Doxygen/classrtk_1_1ThreeDCircularProjectionGeometry.html#a0fb1475ed76a28cde24fac85eae18e1e
>>>> I hope it helps,
>>>> Simon
>>>>
>>>>
>>>> On Wed, Jul 10, 2024 at 8:13 AM Nikolay Filatov <filatovna83 at gmail.com>
>>>> wrote:
>>>>
>>>>> 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 (https://imgur.com/a/kDpfk5G)
>>>>> 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.
>>>>>
>>>>> Here
>>>>> rtkThreeDCircularProjectionGeometry.cxx
>>>>> void rtk::ThreeDCircularProjectionGeometry::AddProjectionInRadians(...)
>>>>> {
>>>>> ...
>>>>> matrix =
>>>>> this->GetProjectionTranslationMatrices().back().GetVnlMatrix() *
>>>>> this->GetMagnificationMatrices().back().GetVnlMatrix() *
>>>>> this->GetSourceTranslationMatrices().back().GetVnlMatrix();
>>>>> this->GetRotationMatrices().back().GetVnlMatrix();
>>>>> --->
>>>>> matrix =
>>>>> this->GetProjectionTranslationMatrices().back().GetVnlMatrix() *
>>>>> this->GetMagnificationMatrices().back().GetVnlMatrix() *
>>>>> this->GetRotationMatrices().back().GetVnlMatrix();
>>>>> this->GetSourceTranslationMatrices().back().GetVnlMatrix();
>>>>> ...
>>>>> }
>>>>> didn't give desired result.
>>>>>
>>>>> So, is it somehow possible to specify this angle along with
>>>>> InPlaneAngle, OutOfPlaneAngle ?
>>>>> _______________________________________________
>>>>> Rtk-users mailing list
>>>>> rtk-users at openrtk.org
>>>>> https://www.creatis.insa-lyon.fr/mailman/listinfo/rtk-users
>>>>>
>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20240723/a4ac3adf/attachment-0001.htm>
More information about the Rtk-users
mailing list