[Insight-users] coordinate conversion
Petr Jilkine
petr.jilkine at cimtec-canada.ca
Tue Sep 10 11:27:27 EDT 2013
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130910/9cb93dd7/attachment.htm>
More information about the Insight-users
mailing list