[Insight-users] Problem Using the itkBSplineScatteredDataPointSetToImageFilter on Win32

Otmane Lahlou otmane.lahlou at c-s.fr
Fri Nov 26 11:48:44 EST 2010


Hi,

Thank you for this answer.
It really helps.

Otmane


Nicholas Tustison a écrit :
> Yeah, that could certainly do it.  The algorithm uses a coarse-to-fine approach to fitting the data which is governed by the initial grid of control points and the number of fitting levels.  Suppose, for example, you have a 2-D domain defined over  the domain [0,512] x [0,512] and you want to fit a cubic B-spline object over that domain.  You, as the user, would presumably specify an initial coarse grid with a low number of mesh elements, the number of mesh elements related to the number of control points by the formula
>
> number of mesh elements = number of control points - spline order
>
> So, getting back to your example, if you wanted to start with a mesh of size 2x2 over your domain, you would specify a control point grid of 5x5 with actual code looking something like:
>
> BSplineFilterType::ArrayType numberOfControlPoints;
> numberOfControlPoints.Fill( 5 );
> bsplineFilter->SetNumberOfControlPoints( numberOfControlPoints );
>
> As regards number of levels---for each level you specify, the mesh size doubles.  So, suppose you specify 5 levels, the algorithm will first fit to the data using a mesh size of 2x2.  The solution at the previous level is propagated to the next level where additional fitting occurs with a mesh size of 4x4, followed by an 8x8 mesh, which continues to a final mesh of 32x32 at the 5th level.  You can imagine that with 10 levels, the resulting mesh size would be 1024x1024 over the domain which would probably be overkill for image data of size 512x512.
>
> As far as advice goes---it's really hard to say as both the initial mesh size and the number of levels go into determining the type of fitting you want which is really application specific.  For example, I use the BSpline filter as the fitting routine in itkN4MRIBiasFieldCorrectionImageFilter.  For that application, you typically want to start with a low number of mesh elements and perform fitting for only 3-4 (at the most) fitting levels.  However, I also use it for B-spline based image registration where, at each level, I typically use a relatively larger number of mesh elements and only 1 level.  
>
> Nick
>
> On Nov 25, 2010, at 6:50 AM, Otmane Lahlou wrote:
>
>   
>> Hi Nick,
>>
>> Thanks you for your feedbacks,
>>
>> Can those precision values issues be related to the parameter m_NumberOfLevels ?
>> In the test i sent  m_NumberOfLevels  is equal to 10,  and for this value the exception is thrown.
>>
>> In general, the exception is thrown also for  m_NumberOfLevels values  > 5.
>> But it runs well for m_NumberOfLevels <=5.
>>
>> Can you give me a brief explication about that, and the way to choose the right NumberOfLevels  value ?
>>
>> Thank you
>>
>> Otmane
>>
>>
>> Nicholas Tustison a écrit :
>>     
>>> Hi Otmane,
>>>
>>> The problem is that a B-spline object has an open boundary in it's parametric domain, specifically your domain is defined over [0,512).  You're querying a point right on that open boundary.  Although I tried to accommodate calls on the open boundary, due to precision differences, you're getting that error on Win32 vs your Linus distribution.  What you want to do is ensure your query of the B-spline object value is inside the B-spline domain, e.g. 511.9999 instead of 512.
>>>
>>> Nick   
>>>
>>> On Nov 24, 2010, at 1:08 PM, Otmane Lahlou wrote:
>>>
>>>  
>>>       
>>>> Hi List;
>>>>
>>>> I have a problem when i use the  itkBSplineScatteredDataPointSetToImageFilter filter on Win32.
>>>> Actually, On _Linux distributions it runs well_, but on Win32, the following exception is thrown:
>>>> Line 1012
>>>> "Description: itk::ERROR: PointSetToImageFilter(01716750): The collapse point
>>>> component 512 is outside the corresponding parametric domain of [0, 512]. "
>>>>
>>>> I used ITK 3.20, compiled using a Visual C++ 2008 Express.
>>>> in release mode.
>>>>
>>>> You can find a cmake configurable project attached to this mail that shows the problem.
>>>> If someone can have a look and give me a feedback to confirm the problem
>>>> or to explain what i missed,  it will be really helpfull.
>>>>
>>>> Thanks for help.
>>>>
>>>> Otmane
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> <testITKSpline.tar>_____________________________________
>>>> 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.html
>>>>
>>>> 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://www.itk.org/mailman/listinfo/insight-users
>>>>    
>>>>         
>>>  
>>>       
>
>
>   



More information about the Insight-users mailing list