[Insight-users] SetSpacing() in itk::SpatialObject

Corinne Mattmann mattmaco at ee.ethz.ch
Fri, 23 Jan 2004 15:13:03 -0700


Hi,

I've just noticed a discontinuity in itk:
If I have image->GetSpacing() I will get an output of the type
"SpacingType" (i.e. itk::Vector<double, 3>). Therefore I wanted to set
the spacing of a spatial object in the following way:

  ImageType::SpacingType spacing;
    spacing[0] = 0.1;
    spacing[1] = 0.1;
    spacing[2] = 0.1;
  typedef itk::EllipseSpatialObject<3> EllipseType;
    EllipseType::Pointer sphere = EllipseType::New();
    sphere->SetSpacing(spacing);
    sphere->SetRadius(3.0);

But I got the following error:
error C2664: 'SetSpacing' : cannot convert parameter 1 from 'class
itk::Vector<double,3>' to 'const double []'
        No user-defined-conversion operator available that can perform
this conversion, or the operator cannot be called

Shouldn't there be another function in itkSpatialObject which takes an
itkVector as an input?


Thanks,
Corinne