[Insight-users] Question regarding BSplineScatteredDataPointSetToImageFilter

Kerstin Müller kerstin.mueller612 at googlemail.com
Tue Jan 3 03:24:14 EST 2012


Hi Nicholas,

thanks a lot for answering my question. I'm still not sure how to set the
parametric location of my points inside my domain correctly.
Do you mean like voxel indices inside the volume?


Thanks a lot!

Kerstin

2011/12/23 Nicholas Tustison <ntustison at gmail.com>

> Hi Kerstin,
>
> You're not setting your point locations in the parametric domain.
> Inside your loop where you're setting the point data, you also need
> to store the parametric location of your points inside your domain,i.e.
>
> *pointSet->SetPointData(num, v)*
> *
> *
> *PointSetType::PointType point;*
> *
> *
> *point[0] = x;*
> *point[1] = y;*
> *point[2] = z; *
> *point[3] = t;*
> *
> *
> *pointSet->SetPoint( num, point );*
> *num++*
>
> where x, y, z, and t describes the parametric location of your data
> point.
>
> A couple other things you might want to consider.
>
> 1. The BSpline filter has been in ITK proper for some time
> now and I know I've made several changes (including a
> thorough parallelization for significant speed-up) since then.
> You might want to consider using the class that's in ITK
> already.
>
> 2. 67 control points is quite a bit.  That, coupled with 5 levels,
> would mean you would end up with a control point lattice of
> (6-3) * 2^(5-1) x (6-3) * 2^(5-1) x (6-3) * 2^(5-1) x (67-3) * 2^(5-1) =
> 48x48x48x1024.  A large lattice size in the temporal dimension
> might not be necessary.
>
> Nick
>
>
> On Dec 23, 2011, at 4:19 AM, Kerstin Müller wrote:
>
> Hi,
>
> I'm using the *BSplineScatteredDataPointSetToImageFilter *from the
> Insight Journal. However,
> I cannot find the correct parameter in order to make the filter work and
> does not crash during the evaluation.
> I'll have scattered 3-D points over time and I want to fit a 4-D Bspline
> field to that points. Afterwards I want to evaluate the Bspline on a dense
> volume grid to one time step.
>
> Here you can find the code, unfortunately it crashes (either due to memory
> problems or without any error output)
>
>
> const unsigned int ParametricDimension = 4;
>     const unsigned int DataDimension = 3;
>
>     typedef double RealType;
>     typedef itk ::Vector <RealType , DataDimension > VectorType;
>     typedef itk ::Image <VectorType , ParametricDimension > ImageType;
>
>     typedef itk :: PointSet <VectorType , ParametricDimension >
> PointSetType ;
>     PointSetType :: Pointer pointSet = PointSetType :: New ();
>
>     // Set the sample points
>     for ( int img_num = 0; img_num < m_configuration.num_projections ;
> img_num++ )
>     {
>         int num = 0;
>         for( int idx = 0; idx <= points.at(img_num).size()-3; idx+=3 )
>         {
>
>             VectorType v;
>             v[0] = points.at(img_num)[idx];
>             v[1] = points.at(img_num)[idx+1];
>             v[2] = points.at(img_num)[idx+2];
>             pointSet->SetPointData(num, v);
>
>             num++;
>
>         }
>     }
>     // Instantiate the filter and set the parameters
>     typedef itk::myBSplineScatteredDataPointSetToImageFilter<PointSetType
> , ImageType > FilterType;
>     FilterType :: Pointer filter = FilterType :: New ();
>
>     // Define the parametric domain
>     ImageType :: SpacingType spacing;
>     spacing[0] = 42.0f;
>     spacing[1] = 42.0f;
>     spacing[2] = 42.0f;
>     spacing[3] = 2.0f;
>     ImageType :: SizeType size;
>     size[0] = 6;
>     size[1] = 6;
>     size[2] = 6;
>     size[3] = 67;
>     ImageType :: PointType origin;
>     origin.Fill( 0.0 );
>
>     filter ->SetSize( size );
>     filter ->SetOrigin( origin );
>     filter ->SetSpacing( spacing );
>     filter ->SetInput( pointSet );
>
>     filter -> SetSplineOrder ( 3 );
>     FilterType :: ArrayType ncps;
>     ncps.SetElement(0,6);
>     ncps.SetElement(1,6);
>     ncps.SetElement(2,6);
>     ncps.SetElement(3,67);
>
>     filter -> SetNumberOfControlPoints ( ncps );
>     filter -> SetNumberOfLevels ( 5 );
>     filter -> SetGenerateOutputImage ( false );
>
>     try
>     {
>         filter ->Update ();
>     }
>     catch ( itk::ExceptionObject & excp )
>     {
>         std :: cerr << "Test 2: itkBSplineScatteredDataImageFilter
> exception thrown" << std:: endl;
>         std::cerr<< excp <<std::endl;
>     }
>
> Thank you for your help!
>
> Best,
>
> Kerstin
> _____________________________________
> 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
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120103/5b2668ab/attachment.htm>


More information about the Insight-users mailing list