[Insight-users] exception in itk::BSplineScatteredDataPointSetToImageFilter ?

Arnaud Gelas arnaudgelas at gmail.com
Mon Jun 4 11:02:06 EDT 2012


Nick,

Here is the code (see below), I have been using (adapted from the test)

Any idea?

Thanks,
Arnaud

       const unsigned int ParametricDimension = 1;
       typedef itk::PointSet< Vector3DType, ParametricDimension >  
PointSetType;

       int length = m_Lateral - m_AX;

       CoordinateType dt =
           static_cast< CoordinateType >( 1. ) / static_cast< 
CoordinateType >( length );

       CoordinateType t = 0.;

       typename PointSetType::Pointer pointSet = PointSetType::New();

       IndexType idx;
       idx.Fill( 0 );

       int i = 0, k = 0;
       for( int y = m_AX; y <= m_Lateral; y++ )
         {
         if( ( y == ax ) || ( y >= m_Bottom ) )
           {
           typename PointSetType::PointType pt;
           pt[0] = t;

           pointSet->SetPoint( i, pt );

           Vector3DType v;
           v[0] = static_cast< typename 
PointSetType::PointType::CoordRepType >( contour[y] );
           v[1] = static_cast< typename 
PointSetType::PointType::CoordRepType >( y );
           v[2] = 0.;

           pointSet->SetPointData( i, v );

           i++;
           }

         t += dt;
         }

       typedef itk::Image< Vector3DType, ParametricDimension > 
ParametricImageType;

       typename ParametricImageType::SpacingType spacing;
       spacing.Fill( dt );

       typename ParametricImageType::SizeType size;
       size.Fill( length + 1 );

       typename ParametricImageType::PointType origin;
       origin.Fill( 0. );

       typedef itk::BSplineScatteredDataPointSetToImageFilter< 
PointSetType, ParametricImageType > FilterType;
       typename FilterType::Pointer filter = FilterType::New();
       filter->SetInput( pointSet );
       filter->SetSize( size );
       filter->SetOrigin( origin );
       filter->SetSpacing( spacing );
       filter->SetSplineOrder( 3 );
       filter->SetNumberOfLevels( 1 );

       typename FilterType::ArrayType ncps;
       ncps.Fill( 4 );
       filter->SetNumberOfControlPoints( ncps );

       filter->SetNumberOfThreads( 1 );
       filter->SetGenerateOutputImage( true );
       filter->Update();

On 06/04/2012 04:55 PM, Nicholas Tustison wrote:
> Hi Arnaud,
>
> Yes, so that means that one of your data points is outside the
> user-defined parametric domain.  Even if it is right on the edge,
> the parametric domain is open-ended on the right side which
> will cause this exception to be thrown.  How are you setting up
> your parametric domain?  In other words, what does your call
> look like when you're setting up the filter?
>
> Nick
>
>
> On Jun 4, 2012, at 10:45 AM, Arnaud Gelas wrote:
>
>> Hi Nick,
>>
>> When using itk::BSplineScatteredDataPointSetToImageFilter, I get the following exception
>>
>> itkExceptionMacro( "The reparameterized point component "<<  p[i]
>> <<  " is outside the corresponding parametric domain of [0,"
>> <<  totalNumberOfSpans<<  "]." );
>>
>>
>> I could not figure out if I made a mistake when setting my parameters? or anything else?
>>
>> Any idea? or suggestion?
>>
>> Thanks,
>> Arnaud



More information about the Insight-users mailing list