Hi Alex,

I would assume your first approach to work, given how we can get the control 
points in world coordinates internally [1,2]. How did you notice that approach 
not working? What did not fit?

Best,
Caspar

[1] 
https://phabricator.mitk.org/source/mitk/browse/master/Modules/PlanarFigure/src/DataManagement/mitkPlanarFigure.cpp;ded9a12a0fdb8ae6b20771913e610e5dcd40f41b$256-262
[2] 
https://phabricator.mitk.org/source/mitk/browse/master/Modules/Core/src/DataManagement/mitkPlaneGeometry.cpp;ded9a12a0fdb8ae6b20771913e610e5dcd40f41b$881-894


Von: Alex Rothberg [mailto:[email protected]]
Gesendet: Samstag, 30. September 2017 20:27
An: [email protected]
Betreff: [mitk-users] Converting PlanarLine to World Coordinates

I would like to convert the coordinates of a PlanarLine defined in a pf file to 
world coordinates. I assumed that the way to do this was multiple the (x, y, 0) 
of each control point by a transformation matrix specific by the 
transformParam. That does not seem to work. Apparently I am just supposed to 
add the origin to the control point. What am I misunderstanding with how the 
planar figure / PlanarLine is represented in XML? These files are created using 
MITK-GEM and stored in an mitk scene file.

Here is the pf file:

<?xml version="1.0" ?>

<Version 
Writer="C:\MITK\build2013\MITK\Modules\PlanarFigure\src\IO\mitkPlanarFigureWriter.cpp"
 CVSRevision="$Revision: 17055 $" FileVersion="1" />

<PlanarFigure type="PlanarLine">

    <property key="closed" type="BoolProperty">

        <bool value="false" />

    </property>

    <property key="initiallyplaced" type="BoolProperty">

        <bool value="true" />

    </property>

    <ControlPoints>

        <Vertex id="0" x="115.8695640182204" y="213.91333499194826" />

        <Vertex id="1" x="112.39129840859526" y="44.347886522720955" />

    </ControlPoints>

    <Geometry>

        <transformParam param0="0.958333313465118" param1="0" param2="0" 
param3="0" param4="-0.958333313465118" param5="0" param6="0" param7="0" 
param8="-6.50000047683716" param9="-112.320826202631" 
param10="112.13685862045457" param11="29.695721817634535" />

        <boundsParam bound0="0" bound1="240" bound2="0" 
bound3="262.53344449978272" bound4="0" bound5="1" />

        <Spacing x="0.958333313465118" y="0.958333313465118" 
z="6.500000476837157" />

        <Origin x="-112.320826202631" y="112.13685862045457" 
z="29.695721817634535" />

    </Geometry>

</PlanarFigure>



naively this was the matrix I tried to use:

array([[   0.95833331,    0.        ,    0.        ,    0.        ],

       [   0.        ,   -0.95833331,    0.        ,    0.        ],

       [   0.        ,    0.        ,   -6.50000048,    0.        ],

       [-112.32082367,  112.13685608,   29.69572258,    1.        ]])



however this is the matrix that actually works:

array([[   1.        ,    0.        ,    0.        ,    0.        ],

       [   0.        ,   -1.        ,    0.        ,    0.        ],

       [   0.        ,    0.        ,   -1.        ,    0.        ],

       [-112.32082367,  112.13685608,   29.69572258,    1.        ]])



Is there a more correct way of creating the second matrix other than setting 
the on diagonal elements to (+1 or-1)? How do I do if the value should be +1 or 
-1?



Thanks for the help,

Alex
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to