[Insight-users] exception in itk::BSplineScatteredDataPointSetToImageFilter ?
Nicholas Tustison
ntustison at gmail.com
Tue Jun 5 09:23:44 EDT 2012
That's good.
What would you suggest?
On Jun 5, 2012, at 7:49 AM, Arnaud Gelas wrote:
> By slightly increasing the spacing, or by adding 1 to the image size, it works!
>
> Would it be possible either to update the exception message, either add a comment here to know what could be the reasons and possible fixes?
> Would it be possible to detect such an error at an earlier stage?
>
> Thanks,
> Arnaud
>
> On 06/05/2012 01:34 PM, Nicholas Tustison wrote:
>>
>> Yeah, so it's a floating point thing where your last point is ending
>> up on the boundary. Try making the spacing slightly larger.
>>
>>
>> On Jun 5, 2012, at 3:37 AM, Arnaud Gelas wrote:
>>
>>> Hi Nick,
>>>
>>> Here is the print out:
>>>
>>> terminate called after throwing an instance of 'itk::ExceptionObject'
>>> what(): /home/ajg23/DEVEL/ITK/Modules/Core/Common/src/itkMultiThreader.cxx:359:
>>> itk::ERROR: MultiThreader(0xaacf610): Exception occurred during SingleMethodExecute
>>> /home/ajg23/DEVEL/ITK/Modules/Filtering/ImageGrid/include/itkBSplineScatteredDataPointSetToImageFilter.hxx:625:
>>> itk::ERROR: PointSetToImageFilter(0xaab0d40): The reparameterized point component 2.00002 is outside the corresponding parametric domain of [0, 2].
>>>
>>> It seems to work with 1 or 2 level, but start throwing an exception from level 3 onward.
>>>
>>> Arnaud
>>>
>>> On Mon, Jun 4, 2012 at 5:24 PM, Nicholas Tustison <ntustison at gmail.com> wrote:
>>> THat looks right. What is the print out you get
>>> when the exception is thrown?
>>>
>>>
>>> On Jun 4, 2012, at 11:02 AM, Arnaud Gelas wrote:
>>>
>>> > 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
>>> >
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120605/54870dfa/attachment.htm>
More information about the Insight-users
mailing list