[Insight-users] B-Spline deformable transform grid origin

Lydia Ng lydiang at gmail.com
Fri Jul 29 13:13:56 EDT 2005


Hi Richard,

To evaluate a 3-order BSpline at any point requires one grid point to
the left (lower) side and two grid points on the right (upper) side.

In the DeformableRegistration4.cxx the idea was make sure you can
evaluate the BSpline on every point on the fixed image - hence the
origin of Bspline grid is set to (fixed_image_origin - spacing).

HTH,
Lydia

On 7/23/05, Richard Johnson <rcjohnson33 at gmail.com> wrote:
> Hi everyone,
> 
> Could someone please clarify the code below from DeformableRegistration4.cxx.
> 
> I understand why spacing[r] is set as it is, but what about the
> origin?  Why isn't the grid origin set at the origin of the fixed
> image?  Why would the grid spacing be subtracted from the fixed
> image's origin?
> 
> Thanks a lot
> ---------------------
>  gridSizeOnImage.Fill( 5 );
>  gridBorderSize.Fill( 3 );    // Border for spline order = 3 ( 1
> lower, 2 upper )
>  totalGridSize = gridSizeOnImage + gridBorderSize;
> 
>  bsplineRegion.SetSize( totalGridSize );
> 
>  typedef TransformType::SpacingType SpacingType;
>  SpacingType spacing = fixedImage->GetSpacing();
> 
>  typedef TransformType::OriginType OriginType;
>  OriginType origin = fixedImage->GetOrigin();;
> 
>  FixedImageType::SizeType fixedImageSize = fixedRegion.GetSize();
> 
>  for(unsigned int r=0; r<ImageDimension; r++)
>   {
>   spacing[r] *= floor( static_cast<double>(fixedImageSize[r] - 1)  /
>                 static_cast<double>(gridSizeOnImage[r] - 1) );
>   origin[r]  -=  spacing[r];
>   }
> 
>  transform->SetGridSpacing( spacing );
>  transform->SetGridOrigin( origin );
>  transform->SetGridRegion( bsplineRegion );
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list