<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Presumably your points over all time exist within a bounding<br>box. Do you know what that bounding box is?<br><font class="Apple-style-span" color="#0163c1"><br></font>If not, you might want to look at the itk::PointSet class and<br>it has a bounding box <br><font class="Apple-style-span" color="#0163c1"><br></font>On Jan 10, 2012, at 5:49 AM, Kerstin Müller wrote:<br><font class="Apple-style-span" color="#0163c1"><br><br></font><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><blockquote type="cite"></blockquote>Hi,<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote>than may be I set my origin wrong. Here the sample code with comments.<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote> typedef float RealType;<br><blockquote type="cite"></blockquote> <br><blockquote type="cite"></blockquote>// It's a volume<br><blockquote type="cite"></blockquote> typedef itk::Vector<RealType, 3> VectorType;<br><blockquote type="cite"></blockquote>// The deformation is over time<br><blockquote type="cite"></blockquote> typedef itk ::Image <VectorType , 4 > TimeVaryingDeformationFieldType;<br><blockquote type="cite"></blockquote> typedef itk ::PointSet <VectorType , 4 > TimeVaryingDeformationFieldPointSetType;<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote> TimeVaryingDeformationFieldPointSetType::Pointer fieldPoints = TimeVaryingDeformationFieldPointSetType:: New ();<br><blockquote type="cite"></blockquote> fieldPoints->Initialize();<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote> TimeVaryingDeformationFieldType::PointType origin;<br><blockquote type="cite"></blockquote> TimeVaryingDeformationFieldType::SpacingType spacing;<br><blockquote type="cite"></blockquote> TimeVaryingDeformationFieldType::SizeType size;<br><blockquote type="cite"></blockquote>// I want to have a sapcing of 10 mm in each dimension except in the temporal there it is 2 <br><blockquote type="cite"></blockquote> // Define the parametric domain of BSpline Field<br><blockquote type="cite"></blockquote> spacing[0] = 10.0f;<br><blockquote type="cite"></blockquote> spacing[1] = 10.0f;<br><blockquote type="cite"></blockquote> spacing[2] = 10.0f;<br><blockquote type="cite"></blockquote> spacing[3] = 2.0f;<br><blockquote type="cite"></blockquote>// Here the size of the BSpline field, I have 133 numberOfTimePoints<br><blockquote type="cite"></blockquote> size[0] = 128;<br><blockquote type="cite"></blockquote> size[1] = 128;<br><blockquote type="cite"></blockquote> size[2] = 128;<br><blockquote type="cite"></blockquote> size[3] = 67;<br><blockquote type="cite"></blockquote> <br><blockquote type="cite"></blockquote> <br><blockquote type="cite"></blockquote>// The origin ( where I'm not sure, I also tried 0,0,0)<br><blockquote type="cite"></blockquote> float O[3] ={0.0f,0.0f,0.0f};<br><blockquote type="cite"></blockquote> for (int i=0; i<3; i++)<br><blockquote type="cite"></blockquote> O[i] = m_configuration.origin[i] - spacing[i] * (size[i] - 1) *0.5f;<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote> origin[0] = O[0];<br><blockquote type="cite"></blockquote> origin[1] = O[1];<br><blockquote type="cite"></blockquote> origin[2] = O[2];<br><blockquote type="cite"></blockquote> origin[3] = 0.0f;<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote> // Set the sample points<br><blockquote type="cite"></blockquote> for ( int t = 0; t < numberOfTimePoints ; t++ ) <br><blockquote type="cite"></blockquote> {<br><blockquote type="cite"></blockquote> int num = 0;<br><blockquote type="cite"></blockquote> for( int idx = 0; idx < <a href="http://endo_points.at/">endo_points.at</a>(t).size()-3; idx+=3 )<br><blockquote type="cite"></blockquote> {<br><blockquote type="cite"></blockquote> <br><blockquote type="cite"></blockquote> VectorType v;<br><blockquote type="cite"></blockquote>// The sampling points range from -70 to +70 for example<br><blockquote type="cite"></blockquote> v[0] = <a href="http://endo_points.at/">endo_points.at</a>(t)[idx] - <a href="http://endo_points.at/">endo_points.at</a>(0)[idx] ;<br><blockquote type="cite"></blockquote> v[1] = <a href="http://endo_points.at/">endo_points.at</a>(t)[idx+1] - <a href="http://endo_points.at/">endo_points.at</a>(0)[idx+1];<br><blockquote type="cite"></blockquote> v[2] = <a href="http://endo_points.at/">endo_points.at</a>(t)[idx+2] - <a href="http://endo_points.at/">endo_points.at</a>(0)[idx+2];<br><blockquote type="cite">
</blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote> <br><blockquote type="cite"></blockquote> TimeVaryingDeformationFieldPointSetType::PointType point;<br><blockquote type="cite"></blockquote> point[0] = <a href="http://endo_points.at/">endo_points.at</a>(0)[idx];<br><blockquote type="cite"></blockquote> point[1] = <a href="http://endo_points.at/">endo_points.at</a>(0)[idx+1];<br><blockquote type="cite"></blockquote> point[2] = <a href="http://endo_points.at/">endo_points.at</a>(0)[idx+2];<br><blockquote type="cite"></blockquote> point[3] = t;<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote> fieldPoints->SetPoint( num, point );<br><blockquote type="cite"></blockquote> fieldPoints->SetPointData(num, v);<br><blockquote type="cite"></blockquote> num++;<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote> }<br><blockquote type="cite"></blockquote> }<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote> <br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote> // Define the filter and set the parameters<br><blockquote type="cite"></blockquote> typedef itk::myBSplineScatteredDataPointSetToImageFilter<TimeVaryingDeformationFieldPointSetType, TimeVaryingDeformationFieldType> BSplineFilterType;<br><blockquote type="cite"></blockquote> BSplineFilterType::Pointer filter = BSplineFilterType::New();<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote> filter ->SetSize( size );<br><blockquote type="cite"></blockquote> filter ->SetOrigin( origin );<br><blockquote type="cite"></blockquote> filter ->SetSpacing( spacing );<br><blockquote type="cite"></blockquote> filter ->SetGenerateOutputImage ( false );<br><blockquote type="cite"></blockquote> filter ->SetNumberOfLevels ( 2 );<br><blockquote type="cite"></blockquote> filter ->SetSplineOrder ( 3 );<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote> BSplineFilterType :: ArrayType ncps;<br><blockquote type="cite"></blockquote> ncps.SetElement(0,8);<br><blockquote type="cite"></blockquote> ncps.SetElement(1,8);<br><blockquote type="cite"></blockquote> ncps.SetElement(2,8);<br><blockquote type="cite"></blockquote> ncps.SetElement(3,5);<br><blockquote type="cite"></blockquote> filter -> SetNumberOfControlPoints ( ncps );<br><blockquote type="cite"></blockquote> <br><blockquote type="cite"></blockquote> filter ->SetInput( fieldPoints );<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote> filter->SetDebug(true);<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote> try<br><blockquote type="cite"></blockquote> {<br><blockquote type="cite"></blockquote> filter ->Update ();<br><blockquote type="cite"></blockquote> }<br><blockquote type="cite"></blockquote> catch ( itk::ExceptionObject & excp )<br><blockquote type="cite"></blockquote> {<br><blockquote type="cite"></blockquote> std :: cerr << "Test 2: itkBSplineScatteredDataImageFilter exception thrown" << std:: endl;<br><blockquote type="cite"></blockquote> std::cerr<< excp <<std::endl;<br><blockquote type="cite"></blockquote> }<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote>That's the Spline definition and afterwards I wanna resample the BSpline at arbitrary positions:<br><blockquote type="cite">
</blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote>float fPoint[3] = {0.0f,0.0f,0.0f};<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote> float sample_O[3] ={0.0f,0.0f,0.0f};<br><blockquote type="cite"></blockquote> for (int i=0; i<3; i++)<br><blockquote type="cite"></blockquote> sample_O[i] = m_configuration.origin[i] - m_configuration.vs * (m_configuration.size[i] - 1) *0.5f;<br><blockquote type="cite">
</blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote> int sample_size[3];<br><blockquote type="cite"></blockquote> sample_size[0] = m_configuration.size[0];<br><blockquote type="cite"></blockquote> sample_size[1] = m_configuration.size[1];<br><blockquote type="cite"></blockquote> sample_size[2] = m_configuration.size[2];<br><blockquote type="cite"></blockquote> <br><blockquote type="cite"></blockquote> for (int iz=0, idx=0; iz<sample_size[2]; iz++)<br><blockquote type="cite"></blockquote> {<br><blockquote type="cite"></blockquote> fPoint[2] = sample_O[2] + iz*m_configuration.vs;<br><blockquote type="cite"></blockquote> for (int iy=0; iy<sample_size[1]; iy++)<br><blockquote type="cite"></blockquote> {<br><blockquote type="cite"></blockquote> fPoint[1] = sample_O[1] + iy*m_configuration.vs;<br><blockquote type="cite"></blockquote> for (int ix=0; ix<sample_size[0]; ix++)<br><blockquote type="cite"></blockquote> {<br><blockquote type="cite"></blockquote> fPoint[0] = sample_O[0] + ix*m_configuration.vs;<br><blockquote type="cite"></blockquote> <br><blockquote type="cite"></blockquote> TimeVaryingDeformationFieldPointSetType :: PointType point;<br><blockquote type="cite"></blockquote> point [0] = fPoint[0];<br><blockquote type="cite"></blockquote> point [1] = fPoint[1];<br><blockquote type="cite"></blockquote> point [2] = fPoint[2];<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote> VectorType V;<br><blockquote type="cite"></blockquote> filter->EvaluateAtPoint(point, V);<br><blockquote type="cite"></blockquote> }<br><blockquote type="cite"></blockquote> //cout << iy << endl;<br><blockquote type="cite"></blockquote> }<br><blockquote type="cite"></blockquote> cout << iz << endl;<br><blockquote type="cite"></blockquote> }<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote>Thans a lot for your help!<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote>Best,<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#007429"><br></font><blockquote type="cite"></blockquote>Kerstin<br>2012/1/10 Nicholas Tustison <span dir="ltr"><<a href="mailto:ntustison@gmail.com">ntustison@gmail.com</a>></span><br><blockquote type="cite"><div class="gmail_quote">
That's fine. I'm assuming, though, that they reside<br>in a bounding box of some sort, correct? Just <br>assign those points to their continuous coordinates<br>inside that bounding box.<br><br><br><br><br>On Jan 10, 2012, at 5:31 AM, Kerstin Müller wrote:<br><br><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">
<div><div class="h5"><div><div><div><div>
<blockquote type="cite"></blockquote>But my sample points are on continous world coordinates between for example -70.0 and 70.0.<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#6c0403"><br></font><blockquote type="cite"></blockquote>Best,<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#6c0403"><br></font><blockquote type="cite"></blockquote>Kerstin<br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#6c0403"><br></font>2012/1/10 Nicholas Tustison <span dir="ltr"><<a href="mailto:ntustison@gmail.com" target="_blank">ntustison@gmail.com</a>></span><br><blockquote type="cite"><div class="gmail_quote">
Since your points reside in an image, an easy<br>parameterization is to assign their location to <br>their x,y,z location in the image. Does that make<br>sense?<br><br><br>On Jan 10, 2012, at 5:19 AM, Kerstin Müller wrote:<br><br><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">
<div><div><div><div><div><div><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote>Hi,<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote>yes I also used your sample code, but still I got a heap corruption error. That's why I just wanted to try if my sample points are the problem.<br><blockquote type="cite"></blockquote>Do I need to scale them to a range between [0 1]?<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote>Best Regards,<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote>Kerstin<br><blockquote type="cite"></blockquote><br>2012/1/10 Nicholas Tustison <span dir="ltr"><<a href="mailto:ntustison@gmail.com" target="_blank">ntustison@gmail.com</a>></span><br><blockquote type="cite"><div class="gmail_quote">Hi Kerstin,<br><br>Please keep the correspondence on the user's list. <br><br>Why are you setting your vector to all zeros? <br><br><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><div><blockquote type="cite"></blockquote> VectorType v;<br><blockquote type="cite"></blockquote> v[0] = 0.0;<br><blockquote type="cite"></blockquote> v[1] = 0.0;<br> v[2] = 0.0;<br></div></div></div></blockquote>and why are you setting the location of your points to <br>(idx,idx,idx,t)?<br><br><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">
<div><div><blockquote type="cite"></blockquote> point[0] = idx;<br><blockquote type="cite"></blockquote> point[1] = idx;<br><blockquote type="cite"></blockquote> point[2] = idx;<br> point[3] = t;<br>
</div></div></div></blockquote>That can't possibly be right. Did you look at the sample<br>code I gave you?<br><br>Nick<br><br><br><br>On Jan 9, 2012, at 2:04 AM, Kerstin Müller wrote:<br><br><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><div><div>
<blockquote type="cite"></blockquote>Hi,<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote>thank you very much!<br><blockquote type="cite"></blockquote>However I'm still struggeling with a heap corruption problem. I'm not sure if I set my parameters correct.<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote> typedef float RealType;<br><blockquote type="cite"></blockquote> <br><blockquote type="cite"></blockquote> typedef itk::Vector<RealType, 3> VectorType;<br><blockquote type="cite"></blockquote> typedef itk ::Image <VectorType , 4 > TimeVaryingDeformationFieldType;<br><blockquote type="cite"></blockquote> typedef itk :: PointSet <VectorType , 4 > TimeVaryingDeformationFieldPointSetType;<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote> TimeVaryingDeformationFieldPointSetType::Pointer fieldPoints = TimeVaryingDeformationFieldPointSetType:: New ();<br><blockquote type="cite"></blockquote> fieldPoints->Initialize();<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote> // Set the sample points just for testing 10 linear points no movement<br><blockquote type="cite"></blockquote> for ( int t = 0; t < m_configuration.num_projections ; t++ ) <br><blockquote type="cite"></blockquote> {<br><blockquote type="cite"></blockquote> int num = 0;<br><blockquote type="cite"></blockquote> for( int idx = 0; idx <= 10; idx++ )<br><blockquote type="cite"></blockquote> {<br><blockquote type="cite"></blockquote> <br><blockquote type="cite"></blockquote> VectorType v;<br><blockquote type="cite"></blockquote> v[0] = 0.0;<br><blockquote type="cite"></blockquote> v[1] = 0.0;<br><blockquote type="cite"></blockquote> v[2] = 0.0;<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote> <br><blockquote type="cite"></blockquote> TimeVaryingDeformationFieldPointSetType::PointType point;<br><blockquote type="cite"></blockquote> point[0] = idx;<br><blockquote type="cite"></blockquote> point[1] = idx;<br><blockquote type="cite"></blockquote> point[2] = idx;<br><blockquote type="cite"></blockquote> point[3] = t;<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote> fieldPoints->SetPoint( num, point );<br><blockquote type="cite"></blockquote> fieldPoints->SetPointData(num, v);<br><blockquote type="cite"></blockquote> num++;<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote> }<br><blockquote type="cite"></blockquote> }<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote> TimeVaryingDeformationFieldType::PointType origin;<br><blockquote type="cite"></blockquote> TimeVaryingDeformationFieldType::SpacingType spacing;<br><blockquote type="cite"></blockquote> TimeVaryingDeformationFieldType::SizeType size;<br><blockquote type="cite">
</blockquote><br><blockquote type="cite"></blockquote> // Define the parametric domain<br><blockquote type="cite"></blockquote> spacing[0] = 1.0f;<br><blockquote type="cite"></blockquote> spacing[1] = 1.0f;<br><blockquote type="cite"></blockquote> spacing[2] = 1.0f;<br><blockquote type="cite"></blockquote> spacing[3] = 2.0f;<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote> size[0] = 128;<br><blockquote type="cite"></blockquote> size[1] = 128;<br><blockquote type="cite"></blockquote> size[2] = 128;<br><blockquote type="cite"></blockquote> size[3] = 66;<br><blockquote type="cite"></blockquote> <br><blockquote type="cite"></blockquote> origin[0] = 0.0f;<br><blockquote type="cite"></blockquote> origin[1] = 0.0f;<br><blockquote type="cite"></blockquote> origin[2] = 0.0f;<br><blockquote type="cite"></blockquote> origin[3] = 0.0f;<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote> // Define the filter and set the parameters<br><blockquote type="cite"></blockquote> typedef itk::myBSplineScatteredDataPointSetToImageFilter<TimeVaryingDeformationFieldPointSetType, TimeVaryingDeformationFieldType> BSplineFilterType;<br><blockquote type="cite"></blockquote> BSplineFilterType::Pointer filter = BSplineFilterType::New();<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote> filter ->SetSize( size );<br><blockquote type="cite"></blockquote> filter ->SetOrigin( origin );<br><blockquote type="cite"></blockquote> filter ->SetSpacing( spacing );<br><blockquote type="cite"></blockquote> filter -> SetGenerateOutputImage ( false );<br><blockquote type="cite"></blockquote> filter -> SetNumberOfLevels ( 2 );<br><blockquote type="cite"></blockquote> filter -> SetSplineOrder ( 3 );<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote> <br><blockquote type="cite"></blockquote> BSplineFilterType :: ArrayType ncps;<br><blockquote type="cite"></blockquote> ncps.SetElement(0,8);<br><blockquote type="cite"></blockquote> ncps.SetElement(1,8);<br><blockquote type="cite"></blockquote> ncps.SetElement(2,8);<br><blockquote type="cite"></blockquote> ncps.SetElement(3,34);<br><blockquote type="cite"></blockquote> filter -> SetNumberOfControlPoints ( ncps );<br><blockquote type="cite"></blockquote> <br><blockquote type="cite"></blockquote> filter ->SetInput( fieldPoints );<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote> filter->SetDebug(true);<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote> try<br><blockquote type="cite"></blockquote> {<br><blockquote type="cite"></blockquote> filter ->Update ();<br><blockquote type="cite"></blockquote> }<br><blockquote type="cite"></blockquote> catch ( itk::ExceptionObject & excp )<br><blockquote type="cite"></blockquote> {<br><blockquote type="cite"></blockquote> std :: cerr << "Test 2: itkBSplineScatteredDataImageFilter exception thrown" << std:: endl;<br><blockquote type="cite"></blockquote> std::cerr<< excp <<std::endl;<br><blockquote type="cite"></blockquote> }<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote>Thank you very much!<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote>Best,<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote>Kerstin<br>2012/1/4 Nicholas Tustison <span dir="ltr"><<a href="mailto:ntustison@gmail.com" target="_blank">ntustison@gmail.com</a>></span><br><blockquote type="cite"><div class="gmail_quote">
Okay, here's some pseudocode which hasn't been tested<br>since you have to provide it the interface to your values <br>but you should get the general idea.<br><br> typedef float RealType;<br> typedef itk::Image<RealType, ImageDimension> RealImageType;<br><br> // Read in your reference image which will define the domain of <br> // your B-spline displacement field. Assume, for simplicity, that it<br> // has identity direction<br><br> typedef itk::ImageFileReader<RealImageType> ImageReaderType;<br> typename ImageReaderType::Pointer reader = ImageReaderType::New();<br> reader->SetFileName( XXXX );<br> reader->Update();<br><br> typedef itk::Vector<RealType, ImageDimension> VectorType;<br> typedef itk::Image<VectorType, ImageDimension+1> TimeVaryingDeformationFieldType;<br><br> typedef itk::PointSet<VectorType, ImageDimension+1> TimeVaryingDeformationFieldPointSetType;<br> typename TimeVaryingDeformationFieldPointSetType::Pointer fieldPoints =<br> TimeVaryingDeformationFieldPointSetType::New();<br> fieldPoints->Initialize();<br> unsigned long count = 0;<br><br> // Assume points are stored in a 2-D matrix called 'mySamplePoints' where the column<br> // is the time point and the row is the point<br><br> for( unsigned int t = 0; t < numberOfTimePoints; t++ )<br> {<br> for( unsigned int n = 0; n < numberOfPointsPerTimePoint; n++ )<br> {<br> VectorType displacement = mySamplePoints[n][t] - mySamplePoints[n][0];<br> <br> TimeVaryingDeformationFieldPointSetType::PointType parametric point;<br> for( unsigned int d = 0; d < ImageDimension; d++ )<br> {<br> point[d] = ( mySamplePoints[n][0] )[d];<br> }<br> point[ImageDimension] = t;<br><br> fieldPoints->SetPoint( count, point );<br> fieldPoints->SetPointData( count, displacement );<br> count++;<br> }<br> } <br><br> TimeVaryingDeformationFieldType::PointType origin;<br> TimeVaryingDeformationFieldType::SpacingType spacing;<br> TimeVaryingDeformationFieldType::SizeType size;<br><br> for( unsigned int d = 0; d < ImageDimension; d++ )<br> {<br> origin[d] = reader->GetOutput()->GetOrigin()[d];<br> size[d] = reader->GetOutput()->GetLargestPossibleRegion().GetSize()[d];<br> spacing[d] = reader->GetOutput()->GetSpacing()[d];<br> }<br> // Now include the temporal information. You can change this to whatever<br> // resolution you like. You just need to make sure that <br> // ( size[ImageDimension] - 1 ) * spacing[ImageDimension] = ( numberOfTimePoints - 1)<br> // <br> origin[ImageDimension] = 0;<br> size[ImageDimension] = numberOfTimePoints - 1;<br> spacing[ImageDimension] = 1;<br><br> typedef itk::BSplineScatteredDataPointSetToImageFilter<br> <TimeVaryingDeformationFieldPointSetType, TimeVaryingDeformationFieldType> BSplineFilterType;<br> typename BSplineFilterType::Pointer bspliner = BSplineFilterType::New();<br> bspliner->SetOrigin( origin );<br> bspliner->SetSpacing( spacing );<br> bspliner->SetSize( size );<br> bspliner->SetGenerateOutputImage( XXXX );<br> bspliner->SetNumberOfLevels( XXXX );<br> bspliner->SetSplineOrder( XXXX );<br> bspliner->SetNumberOfControlPoints( XXXX );<br> bspliner->SetInput( fieldPoints );<br> bspliner->Update();<br><br><br><br><br>On Jan 4, 2012, at 2:52 AM, Kerstin Müller wrote:<br><br><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">
<div><div><div>
<blockquote type="cite"></blockquote>Hi,<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote>yes correctly.<br><blockquote type="cite"></blockquote><br>2012/1/3 Nicholas Tustison <span dir="ltr"><<a href="mailto:ntustison@gmail.com" target="_blank">ntustison@gmail.com</a>></span><br><blockquote type="cite"><div class="gmail_quote">
Okay, I'm assuming that these points correspond in <br>time, correct? For example, point 937 in time point 0<br>corresponds to point 937 in time point 1, 2, 3, ...133,<br>right? <br><br><br><br>On Jan 3, 2012, at 11:55 AM, Kerstin Müller wrote:<br><br><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
<div><div><div><blockquote type="cite"></blockquote>Hi,<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote>the basic problem I wanna solve:<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote>I'll have scattered points in 3D which vary over time, they describe a motion of a surface over time. They are not ordered in x-y-and z-dimension.<br><blockquote type="cite"></blockquote>Now I want to represent that motion by BSplines in order to generate a dense motion vector field defined on specific 3D voxel positions.<br><blockquote type="cite"></blockquote>I'll have 133 timesteps and ~960 sample points in each time step. Now I want to fit the BSpline to it and resample it.<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote>All the best,<br><blockquote type="cite"></blockquote><br><blockquote type="cite"></blockquote>Kerstin<br><blockquote type="cite"></blockquote><br>2012/1/3 Nicholas Tustison <span dir="ltr"><<a href="mailto:ntustison@gmail.com" target="_blank">ntustison@gmail.com</a>></span><br><blockquote type="cite"><div class="gmail_quote">
In that case, let's start with the basic problem set-up.<br>Before, you described your problem as follows:<br><br><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div>
<div><div><blockquote type="cite"><span style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium">I'm using the<span> </span><b>BSplineScatteredDataPointSetToImageFilter<span> </span></b>from the Insight Journal. However,<br>I cannot find the correct parameter in order to make the filter work and does not crash during the evaluation.<br>
<div><div>
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.</div></div></span></blockquote>
</div></div></div></div></div></blockquote><br>What do these scattered 3D+t points represent? <br>Is it a curve, a time-varying scalar field, or something<br>else?<br><div style="word-wrap:break-word"><div><br></div></div></div>
</blockquote><br></div></div></div></div></blockquote></div></blockquote><br></div></div></div></div></blockquote></div></blockquote><br></div></div></div></div></div></blockquote></div></blockquote><br></div></div></div></div></div></div></div></blockquote></div></blockquote><font class="Apple-style-span" color="#6c0403"><br></font></div></div></div></div></div></div></div></blockquote></div></blockquote><font class="Apple-style-span" color="#007429"><br></font></div></div></div></blockquote></div><br></body></html>