[ITK-users] EuclideanDistancePointMetric: Error when comparing Mesh to QuadEdgeMesh
Arnaud Gelas
arnaudgelas at gmail.com
Thu May 21 02:55:34 EDT 2015
Hi Davis,
If you use the ITKv4 version of Metric, it compiles and works fine!
—
Here is the code
#include "itkQuadEdgeMesh.h"
#include "itkRegularSphereMeshSource.h"
#include "itkEuclideanDistancePointSetToPointSetMetricv4.h"
#include "itkIdentityTransform.h"
typedef itk::Mesh< double, 3 > TFMesh; // If you change this to itk::QuadEdgeMesh, it works
typedef itk::QuadEdgeMesh< double, 3 > TMMesh; // Or if you change this to itk::Mesh, it also works
typedef itk::RegularSphereMeshSource< TFMesh > TFSource;
typedef itk::RegularSphereMeshSource< TMMesh > TMSource;
typedef itk::EuclideanDistancePointSetToPointSetMetricv4< TFMesh, TMMesh > TMetric;
typedef itk::IdentityTransform< double, 3 > TIdentity;
int main(int argc, char ** argv)
{
TFSource::Pointer fixed = TFSource::New();
fixed->Update();
TMSource::Pointer moving = TMSource::New();
moving->Update();
TIdentity::Pointer identity = TIdentity::New();
TMetric::Pointer metric = TMetric::New();
metric->SetFixedPointSet( fixed->GetOutput() );
metric->SetMovingPointSet( moving->GetOutput() );
metric->SetTransform( identity );
std::cout << metric->GetValue() << std::endl;
return EXIT_SUCCESS;
}
> On 20 May 2015, at 18:04, DVigneault <davis.vigneault at gmail.com> wrote:
>
> All--
>
> I'm attempting to use itk::EuclideanDistancePointMetric to compare an
> itk::Mesh to an itk::QuadEdgeMesh. This works as expected if templated over
> two meshes of the same type (i.e., itk::Mesh and itk::Mesh or
> itk::QuadEdgeMesh and itk::QuadEdgeMesh). However, if I attempt to mix the
> two, and compare an itk::Mesh and an itk::QuadEdgeMesh, I get a build error,
> copied below, along with a minimal example of the problem.
>
> I'm having some trouble decoding the error, but it looks to me as though the
> filter is having trouble converting between iterator types. Does this have
> something to do with a difference between how itk::Mesh and
> itk::QuadEdgeMesh define their iterators?
>
> Thank you in advance for your help!
>
> Best,
>
> --Davis
>
> #include "itkQuadEdgeMesh.h"
> #include "itkRegularSphereMeshSource.h"
> #include "itkEuclideanDistancePointMetric.h"
> #include "itkIdentityTransform.h"
>
> typedef itk::Mesh< double, 3 > TFMesh; // If you change this to
> itk::QuadEdgeMesh, it works
> typedef itk::QuadEdgeMesh< double, 3 > TMMesh; // Or if you change this to
> itk::Mesh, it also works
> typedef itk::RegularSphereMeshSource< TFMesh > TFSource;
> typedef itk::RegularSphereMeshSource< TMMesh > TMSource;
> typedef itk::EuclideanDistancePointMetric< TFMesh, TMMesh > TMetric;
> typedef itk::IdentityTransform< double, 3 > TIdentity;
>
> int main(int argc, char ** argv)
> {
>
> TFSource::Pointer fixed = TFSource::New();
> fixed->Update();
>
> TMSource::Pointer moving = TMSource::New();
> moving->Update();
>
> TIdentity::Pointer identity = TIdentity::New();
>
> TMetric::Pointer metric = TMetric::New();
> metric->SetFixedPointSet( fixed->GetOutput() );
> metric->SetMovingPointSet( moving->GetOutput() );
> metric->SetTransform( identity );
> std::cout << metric->GetValue(identity->GetParameters()) << std::endl;
>
> return EXIT_SUCCESS;
>
> }
>
>
> $ make
> Scanning dependencies of target AmoebaOptimization
> [100%] Building CXX object
> CMakeFiles/AmoebaOptimization.dir/AmoebaOptimization.cxx.o
> In file included from
> /usr/local/include/ITK-4.7/itkEuclideanDistancePointMetric.h:125:0,
> from
> /home/davis/Developer/oxford/Stebbing_Method/Test/src/AmoebaOptimization.cxx:3:
> /usr/local/include/ITK-4.7/itkEuclideanDistancePointMetric.hxx: In
> instantiation of ‘itk::EuclideanDistancePointMetric<TFixedPointSet,
> TMovingPointSet, TDistanceMap>::MeasureType
> itk::EuclideanDistancePointMetric<TFixedPointSet, TMovingPointSet,
> TDistanceMap>::GetValue(const TransformParametersType&) const [with
> TFixedPointSet = itk::Mesh<double, 3u>; TMovingPointSet =
> itk::QuadEdgeMesh<double, 3u>; TDistanceMap = itk::Image<short unsigned int,
> 3u>; itk::EuclideanDistancePointMetric<TFixedPointSet, TMovingPointSet,
> TDistanceMap>::MeasureType = itk::Array<double>;
> itk::EuclideanDistancePointMetric<TFixedPointSet, TMovingPointSet,
> TDistanceMap>::TransformParametersType = itk::OptimizerParameters<double>]’:
> /home/davis/Developer/oxford/Stebbing_Method/Test/src/AmoebaOptimization.cxx:28:58:
> required from here
> /usr/local/include/ITK-4.7/itkEuclideanDistancePointMetric.hxx:74:63: error:
> conversion from ‘itk::MapContainer<long unsigned int,
> itk::QuadEdgeMeshPoint<float, 3u, itk::GeometricalQuadEdge<long
> unsigned int, long unsigned int, bool, bool, true> > >::ConstIterator’ to
> non-scalar type ‘itk::EuclideanDistancePointMetric<itk::Mesh<double, 3u>,
> itk::QuadEdgeMesh<double, 3u> >::PointIterator {aka
> itk::VectorContainer<long unsigned int, itk::Point<float, 3u>
>> ::ConstIterator}’ requested
> PointIterator pointItr = movingPointSet->GetPoints()->Begin();
> ^
> /usr/local/include/ITK-4.7/itkEuclideanDistancePointMetric.hxx:75:61: error:
> conversion from ‘itk::MapContainer<long unsigned int,
> itk::QuadEdgeMeshPoint<float, 3u, itk::GeometricalQuadEdge<long
> unsigned int, long unsigned int, bool, bool, true> > >::ConstIterator’ to
> non-scalar type ‘itk::EuclideanDistancePointMetric<itk::Mesh<double, 3u>,
> itk::QuadEdgeMesh<double, 3u> >::PointIterator {aka
> itk::VectorContainer<long unsigned int, itk::Point<float, 3u>
>> ::ConstIterator}’ requested
> PointIterator pointEnd = movingPointSet->GetPoints()->End();
> ^
> make[2]: *** [CMakeFiles/AmoebaOptimization.dir/AmoebaOptimization.cxx.o]
> Error 1
> make[1]: *** [CMakeFiles/AmoebaOptimization.dir/all] Error 2
> make: *** [all] Error 2
>
>
>
>
> --
> View this message in context: http://itk-insight-users.2283740.n2.nabble.com/EuclideanDistancePointMetric-Error-when-comparing-Mesh-to-QuadEdgeMesh-tp7587372.html
> Sent from the ITK Insight Users mailing list archive at Nabble.com.
> _____________________________________
> 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://public.kitware.com/mailman/listinfo/insight-users
More information about the Insight-users
mailing list