[Insight-users] coordinate conversion
Matt McCormick
matt.mccormick at kitware.com
Wed Sep 11 11:11:03 EDT 2013
Hi Petr,
To keep things clear and consistent, point locations are generally
kept in world physical space in ITK.
I there is a desire to keep the relative locations, then you may want
to try using the SpatialObject system, which supports hierarchies of
objects related by transforms.
Hope this helps,
Matt
On Tue, Sep 10, 2013 at 4:04 PM, Petr Jilkine
<petr.jilkine at cimtec-canada.ca> wrote:
> yes it is
>
> # vtk DataFile Version 3.0
> vtk output
> ASCII
> DATASET POLYDATA
> POINTS 2402 float
> -0.808409 1.14813 17.7883 -0.817523 1.32669 17.7764 -2.34968 1.10108 17.9052
>
>
>
> On Tue, Sep 10, 2013 at 11:45 AM, Siavash Khallaghi <siavashk at ece.ubc.ca>
> wrote:
>>
>> What is the format of your point set? Is it vtkPolyData?
>>
>> Siavash
>>
>> Petr Jilkine <petr.jilkine at cimtec-canada.ca> wrote:
>>>
>>> Hello,
>>>
>>> I have 2 images fixed and moving. I apply some linear transform to moving
>>> image
>>> to bring it to physical space of fixed image using ResampleImageFilter
>>> (see metacode)
>>>
>>> typedef typename itk::ResampleImageFilter< InputImageType,
>>> OutputImageType > ResampleFilterType;
>>> ResampleFilterType::Pointer resample = ResampleFilterType::New();
>>>
>>> resample->SetInput( moving );
>>> resample->SetTransform( transform );
>>> resample->SetSize( fixed->GetLargestPossibleRegion().GetSize() );
>>> resample->SetOutputOrigin( fixed->GetOrigin() );
>>> resample->SetOutputSpacing( fixed->GetSpacing() );
>>> resample->SetOutputDirection( fixed->GetDirection() );
>>> resample->SetDefaultPixelValue( zeroValue );
>>>
>>> I also have 2 point sets, one in fixed, another in moving image.
>>> I would like to resample moving point set in a similar way.
>>> For this I use (metacode)
>>>
>>> typedef itk::TransformMeshFilter< MeshType, MeshType, TransformType >
>>> TransformMeshType;
>>>
>>> TransformMeshType::Pointer movingTransformMesh =
>>> TransformMeshType::New();
>>> movingTransformMesh->SetInput(movingMesh);
>>> movingTransformMesh->SetTransform(transform);
>>> movingTransformMesh->Update();
>>>
>>> Probably I need to use an inverse transform instead.
>>> I guess if the points in point sets had world coordinates if would work.
>>> But coordinates of the points are wrt the center of corresponding image.
>>> Now I need to convert these local coordinates to world coordinates taking
>>> into account origin, spacing and direction matrix of the corresponding
>>> image.
>>> TransformMeshFilter seems a good candidate to do the job, but it is not
>>> clear
>>> how to pass origin, spacing and direction matrix to the filter.
>>>
>>> Coordinates conversion like this seems a standard problem and
>>> I guess there is a standard way to do it in ITK. However, so far
>>> I couldn’t find an appropriate ITK class/function.
>>>
>>> Any advice on this matter is really appreciated.
>>>
>>> Thanks,
>>> Peter Jilkine
>>>
>>> ________________________________
>>>
>>>
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>>
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://www.kitware.com/products/protraining.php
>>>
>>> Please keep messages on-topic and check the ITK FAQ at:
>>>
>>> http://www.itk.org/Wiki/ITK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.itk.org/mailman/listinfo/insight-users
>>>
>>
>> --
>> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
More information about the Insight-users
mailing list