[Insight-users] BSplineDeformableTransform + Alternatve way to change coefficients
Luis Ibanez
luis.ibanez at kitware.com
Thu Mar 18 12:50:39 EDT 2010
Hi Kaveh,
Your description of what you want to do wasn't very clear.
Are you trying to initialize a deformation field ?
At first sight it seems that what you are looking for is a
functionality provided by the method:
SetBulkTransform()
that inserts a pre-transform to the deformation produced
by the BSpline.
Regards,
Luis
On Mon, Mar 8, 2010 at 1:21 PM, Kaveh Kohan <kaveh.kohan at yahoo.com> wrote:
> Hi All,
>
> I have a question about one of functions of itk::BSplineDeformableTransform
> and I would be thankful if somebody answers:
>
> I would like to simulate some deformation fields by changing the identity
> transformation 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:
>
> [...]
> typedef itk::BSplineDeformableTransform< double,
> Dimension,
> 3 > BSplineTransformType;
>
> BSplineTransformType::Pointer bsplineTransform =
> BSplineTransformType::New();
>
>
> typedef BSplineTransformType::RegionType RegionType;
> RegionType bsplineRegion;
> RegionType::SizeType gridSizeOnImage;
> RegionType::SizeType gridBorderSize;
> RegionType::SizeType totalGridSize;
>
> gridSizeOnImage.Fill( 8 );
> gridBorderSize.Fill( 3 );
> totalGridSize = gridSizeOnImage + gridBorderSize;
>
> bsplineRegion.SetSize( totalGridSize );
>
> typedef BSplineTransformType::SpacingType SpacingType;
> SpacingType bsplineSpacing = reader->GetOutput()->GetSpacing();
>
> typedef BSplineTransformType::OriginType OriginType;
> OriginType bsplineOrigin = reader->GetOutput()->GetOrigin();;
>
> InputImageType::SizeType ImageSize =
> reader->GetOutput()->GetLargestPossibleRegion().GetSize();
>
> for(unsigned int r=0; r<Dimension; r++)
> {
> bsplineSpacing[r] *= floor( static_cast<double>(ImageSize[r] ) /
> static_cast<double>(gridSizeOnImage[r] ) );
> bsplineOrigin[r] -= bsplineSpacing[r];
> }
>
> bsplineTransform->SetGridSpacing( bsplineSpacing );
> bsplineTransform->SetGridOrigin( bsplineOrigin );
> bsplineTransform->SetGridRegion( bsplineRegion );
>
>
> typedef BSplineTransformType::ImageType ParamImageType ;
>
>
> ParamImageType::Pointer bsplineImageParameters[3] ;
>
> [...]
>
> 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.
>
> Any comment is highly appreciated.
>
> Regards,
> kaveh
>
> _____________________________________
> 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
>
>
More information about the Insight-users
mailing list