<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:14pt"><div>Hi All,<br><br>I have a question about one of functions of itk::BSplineDeformableTransform and I would be thankful if somebody answers:<br><br>I would like to simulate some deformation fields by changing the <span class="yshortcuts" id="lw_1268068804_0">identity transformation</span>
locally. I thought that perhaps BSpline model is a good candidate but I
don't know how to use "SetCoefficientImages" function. It seems that
if I want to know which part of image is perturbed from identity map
this is a good option because using parameter type is very implicit.
Here is how I tried but apparently it is not correct:<br><br>[...]<br>typedef itk::BSplineDeformableTransform<
double,<br> Dimension,<br> 3 > BSplineTransformType;<br><br> BSplineTransformType::Pointer bsplineTransform = BSplineTransformType::New();<br><br><br> typedef BSplineTransformType::RegionType RegionType;<br> RegionType bsplineRegion;<br> RegionType::SizeType gridSizeOnImage;<br> RegionType::SizeType
gridBorderSize;<br> RegionType::SizeType totalGridSize;<br><br> gridSizeOnImage.Fill( 8 );<br> gridBorderSize.Fill( 3 ); <br> totalGridSize = gridSizeOnImage + gridBorderSize;<br><br> bsplineRegion.SetSize( totalGridSize );<br><br> typedef BSplineTransformType::SpacingType SpacingType;<br> SpacingType bsplineSpacing = reader->GetOutput()->GetSpacing();<br><br> typedef BSplineTransformType::OriginType OriginType;<br> OriginType bsplineOrigin = reader->GetOutput()->GetOrigin();;<br><br> InputImageType::SizeType ImageSize = reader->GetOutput()->GetLargestPossibleRegion().GetSize();<br><br> for(unsigned int r=0; r<Dimension; r++)<br> {<br> bsplineSpacing[r] *=
floor( static_cast<double>(ImageSize[r] ) /<br> static_cast<double>(gridSizeOnImage[r] ) );<br> bsplineOrigin[r] -= bsplineSpacing[r];<br> }<br><br> bsplineTransform->SetGridSpacing( bsplineSpacing );<br> bsplineTransform->SetGridOrigin( bsplineOrigin );<br> bsplineTransform->SetGridRegion( bsplineRegion );<br> <br><br> typedef BSplineTransformType::ImageType ParamImageType ;<br><br><br> ParamImageType::Pointer bsplineImageParameters[3] ;<br><br>[...]<br><br>then
I don't know what to do next! should I go ahead and define image
size,origin.direction and then allocate memory for each
bsplineImageParameters[0,1,2] but I have already specified grid size!
how do they relate? I am confused how to use it.<br><br>Any comment is highly appreciated.<br><br>Regards,<br>kaveh</div>
</div><br>
</body></html>