Update: solved other problem,
got a new one (was RE: [Insight-users] Applying a transform? PointSet
registration?)
Atwood, Robert C
r.atwood at imperial.ac.uk
Mon May 23 15:46:24 EDT 2005
I found the doxygen for itkDefaultMeshTraits, and tried using this to ensure that the coordinate representation matched the transform scalar type. However, I then get a problem where the TransformMeshFilter tries to access the GetCellLinks method of the PointSet, which does not exist. (at least that is how I interpret it) Here is the entire new, minimal, example, followed by the error messages I get from it.
------------The Program------------------------------------------------
#include "itkDefaultStaticMeshTraits.h"
#include "itkPointSet.h"
#include "itkEuler3DTransform.h"
#include "itkTransformMeshFilter.h"
#include <iostream>
#include <fstream>
int main(int argc, char * argv[] )
{
const unsigned int Dimension = 3;
typedef float MyScalar;
typedef itk::DefaultStaticMeshTraits<MyScalar,Dimension,Dimension,MyScalar,MyScalar,MyScalar> MyTraits;
typedef itk::PointSet< MyScalar, Dimension,MyTraits > PointSetType;
typedef itk::Euler3DTransform< MyScalar > TransformType;
TransformType::Pointer transform = TransformType::New();
typedef itk::TransformMeshFilter<PointSetType,PointSetType,TransformType> MoverType;
MoverType::Pointer mover = MoverType::New();
return EXIT_SUCCESS;
}
--------------------------------The Errors-----------------------------------------------------------------------------------------
[rcatwood at xe01 itk_examples]$ make
Building dependencies cmake.check_depends...
Building object file IterativeClosestPoint2.o...
/usr/local/encap/ITK_2.0.1.0/include/InsightToolkit/BasicFilters/itkTransformMeshFilter.txx: In
member function `void itk::TransformMeshFilter<TInputMesh, TOutputMesh,
TTransform>::GenerateData() [with TInputMesh = main(int,
char**)::PointSetType, TOutputMesh = main(int, char**)::PointSetType,
TTransform = main(int, char**)::TransformType]':
/usr/local/encap/ITK_2.0.1.0/include/InsightToolkit/Common/itkPointLocator.txx:161: instantiated from here
/usr/local/encap/ITK_2.0.1.0/include/InsightToolkit/BasicFilters/itkTransformMeshFilter.txx:107: no
matching function for call to `itk::PointSet<MyScalar, 3, main(int,
char**)::MyTraits>::GetCellLinks()'
/usr/local/encap/ITK_2.0.1.0/include/InsightToolkit/Common/itkPointLocator.txx:161: instantiated from here
/usr/local/encap/ITK_2.0.1.0/include/InsightToolkit/BasicFilters/itkTransformMeshFilter.txx:109: no
matching function for call to `itk::PointSet<MyScalar, 3, main(int,
char**)::MyTraits>::GetCells()'
/usr/local/encap/ITK_2.0.1.0/include/InsightToolkit/Common/itkPointLocator.txx:161: instantiated from here
/usr/local/encap/ITK_2.0.1.0/include/InsightToolkit/BasicFilters/itkTransformMeshFilter.txx:110: no
matching function for call to `itk::PointSet<MyScalar, 3, main(int,
char**)::MyTraits>::GetCellData()'
/usr/local/encap/ITK_2.0.1.0/include/InsightToolkit/Common/itkPointLocator.txx:161: instantiated from here
/usr/local/encap/ITK_2.0.1.0/include/InsightToolkit/BasicFilters/itkTransformMeshFilter.txx:113: `
MaxTopologicalDimension' is not a member of type `main(int,
char**)::PointSetType'
/usr/local/encap/ITK_2.0.1.0/include/InsightToolkit/Common/itkPointLocator.txx:161: instantiated from here
/usr/local/encap/ITK_2.0.1.0/include/InsightToolkit/BasicFilters/itkTransformMeshFilter.txx:117: no
matching function for call to `itk::PointSet<MyScalar, 3, main(int,
char**)::MyTraits>::GetBoundaryAssignments(unsigned int&)'
make[1]: *** [IterativeClosestPoint2.o] Error 1
make: *** [default_target] Error 2
[rcatwood at xe01 itk_examples]$
________________________________
From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
Sent: Thu 19/05/2005 03:51
To: Atwood, Robert C
Cc: ITK Users
Subject: Re: [Insight-users] Applying a transform? PointSet registration?
Hi Robert,
1) You are right, the current name of the TransformMeshFilter is
misleading. It should probably be called TransformPointSetFilter.
2) You can transform a single point. Just call the TransformPoint()
method of any Transform. There is no need for creating a Point
Set of a single point.
3) The reason why you are being asked for a MultipleValued optimizer
is that you took code from a point set optimization where the
cost function is multivalue. E.g. the cost function "value" is
an array of N values. (N= number of points in the point set).
You can simply change the PointSet metric for another one that
computes things like the sum of square distances between the points.
4) Yeap,... in principle, the registration framework lets you
mix any type of opmizer. However in practice, not all combinations
make sense. For example, As you just found. It doesn't makes sense
to use a SingleValued optimizer for optimizing a MultipleValues
cost function.
Some optimizers are quite tailored to particular cases. For example,
the VersorRigid3DOptimizer is intended to be used *ONLY* with the
VersorRigid3DTransform.
Regards,
Luis
------------------------
Atwood, Robert C wrote:
> Thanks Luis! I thought was something like that ,but for some reason it
> was not clear to me that a PointSet is able to be used where a 'mesh
> type' is asked for. I had looked at this doxygen page but assumed it had
> to be a mesh (with polygons, edges etc) I guess you meant
> TransformMeshFilter when you typed TransformMeshImageFilter.
>
> Can a transform be applied to a single point, or would you create a
> pointset with one point in it ? More generally , how do I know what
> types of class can go in TInputMesh?
>
> itk::TransformMeshFilter< TInputMesh, TOutputMesh, TTransform > Class
> Template Reference
>
> Next question: Since I successfully used VersorRigid3dTransform for
> registering 3D image files I thought I could use this transform for
> registring point sets that may be offset and rotated. However, if I try
> to plug the special Versor optimizer into the registration method, it
> comlains that it requires a MultipleValuedNonLinearOptimizer. I don't
> know exactly what that means in this context, but follwing the example
> in the Software Guide I used Euler3dTransform instead. So far so good...
>
> But, when looking in the Doxygen pages for
> PointSetToPOintSetRegistrationMethod it says:
>
> "The registration method also support a generic optimizer that can be
> selected at run-time. The only restriction for the optimizer is that it
> should be able to operate in single-valued cost functions given that the
> metrics used to compare PointSet with PointSets provide a single value
> as output."
>
> Then, when I look at the optimizer used in the example
> LevenbergMarquardtOptimizer , and go to its parent class,
> MultipleValuedNonLinearVnlOptimizer, it says:
>
> "This class is a base for the Optimization methods that optimize a
> single valued function."
>
> Its parent class says:
>
> MultipleValuedNonLinearOptimizer
> "This class is a base for the Optimization methods that optimize a
> multiple valued function."
>
> So I am confused about when it is, or just what is, "single" or
> "multiple" valued and then how to decide which optimizer will work with
> which registration method?
>
> I am thinking about future uses as I think the Levenberg-Marquardt with
> Euler3d will work for this purpose. For example we might wish to
> register images and/or point-scans of the prosthsis to various medical
> images of the patient , then I would need to use other registration
> methods and figure out which optimizer works with it!
>
>
> Thanks again.
> Robert
>
>
>
> -----Original Message-----
> From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
> Sent: Fri 5/13/2005 1:48 PM
> To: Atwood, Robert C
> Cc: ITK Users
> Subject: Re: [Insight-users] Applying a transform? PointSet registration?
>
>
> Hi Robert,
>
>
> The class that you are looking for is the:
>
> TransformMeshImageFilter:
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1TransformMeshFilter.html
>
> Simply instantiate this filter using your PointSet<> as template
> parameter. Then connect as inputs your Transform and your input
> PointSet.
>
> The filter will apply the Transform to all the Points in your PointSet.
>
>
> Regards,
>
>
> Luis
>
>
>
> --------------------------------------------------------------------------------
> Atwood, Robert C wrote:
> > I have been poring through the software guide and the Doxygen for hours,
> > and I cannot see how to apply a transform to a point or a PointSet? I
> > know how to apply to an image, you create a resample image filter and
> > set the transform , is there a similar filter for PointSets (and what is
> > it called) or is the process different?
> >
> >
> > The immediate goal is to register two point sets, then somehow quantify
> > the difference between them. I believe that this would be enabled by
> > transforming one of the point set into the space of the other according
> > to the result of the registration.
> >
> > The overall goal is to quantify (and eventually minimize) the misfit of
> > certain prostheses introduced at certain stages during the manufacturing
> > process, by scanning 'before' and 'after' examples. The scan method
> > produces a point set. The point set is not necessarily any sort of
> > regular grid. (The points are in 3-d by the way) The 2 sets should
> > generally be reasonably close to each other to start with (by placing
> > the example in the same location and orientation)
> >
> >
> >
> > Thanks,
> > Robert
> >
> >
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org
> > http://www.itk.org/mailman/listinfo/insight-users
>
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20050523/41e7d2fd/attachment.html
More information about the Insight-users
mailing list