[Insight-users] B-Spline deformable transform grid origin
Richard Johnson
rcjohnson33 at gmail.com
Sat Jul 23 19:26:43 EDT 2005
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 );
More information about the Insight-users
mailing list