[Insight-users] BSplineDeformableTransform + Alternatve way to change coefficients

Kaveh Kohan kaveh.kohan at yahoo.com
Mon Mar 8 12:21:19 EST 2010


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


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100308/6526c7c2/attachment.htm>


More information about the Insight-users mailing list