[Insight-users] trouble using the bulktransform

Erik Türke tuerke at cbs.mpg.de
Sat Feb 27 09:24:36 EST 2010


Erik Türke wrote:
> Hi!
>
> I am trying to use the SetBulkTransform method of the 
> BSplineDeformableTransform.
>
> The two images which i want to register are totally shifted, so i want 
> to use a simple translation as the bulk transform.
>
> So what  i am doing is:
>
> m_BSplineTransform->SetBulkTransform(static_cast<VersorRigid3DTransformType*> 
> (initialTransform));
>
> If i print out the parameters of the initialTransform with:
>
> std::cout << static_cast<VersorRigid3DTransformType*> 
> (initialTransform)->GetParameters() << std::endl;
>
> the output is: [0, 0, 0, 96.2941, 92.5804, 38.6559], what is totally 
> right.
>
> Now i setup the BSplineTransform:
>
>                typedef typename BSplineTransformType::RegionType 
> BSplineRegionType;
>                typedef typename BSplineTransformType::SpacingType 
> BSplineSpacingType;
>                typedef typename BSplineTransformType::OriginType 
> BSplineOriginType;
>                typedef typename BSplineTransformType::DirectionType 
> BSplineDirectionType;
>
>                BSplineRegionType bsplineRegion;
>                typename BSplineRegionType::SizeType gridSizeOnImage;
>                typename BSplineRegionType::SizeType gridBorderSize;
>                typename BSplineRegionType::SizeType totalGridSize;
>
>                gridSizeOnImage.Fill(UserOptions.BSplineGridSize);
>                gridBorderSize.Fill(3); //Border for spline order = 3 
> (1 lower, 2 upper)
>                totalGridSize = gridSizeOnImage + gridBorderSize;
>
>                bsplineRegion.SetSize(totalGridSize);
>                BSplineSpacingType bsplineSpacing = 
> m_FixedImage->GetSpacing();
>
>                BSplineOriginType bsplineOrigin = 
> m_FixedImage->GetOrigin();
>
>                typename FixedImageType::SizeType fixedImageSize = 
> m_FixedImage->GetBufferedRegion().GetSize();
>
>                for (unsigned int r = 0; r < FixedImageDimension; r++) {
>                    bsplineSpacing[r] *= static_cast<double> 
> (fixedImageSize[r] - 1) / static_cast<double> (gridSizeOnImage[r]
>                            - 1);
>                }
>
>                BSplineDirectionType bsplineDirection = 
> m_FixedImage->GetDirection();
>                BSplineSpacingType gridOriginOffset = bsplineDirection 
> * bsplineSpacing;
>
>                bsplineOrigin = bsplineOrigin - gridOriginOffset;
>
>                m_BSplineTransform->SetGridSpacing(bsplineSpacing);
>                m_BSplineTransform->SetGridOrigin(bsplineOrigin);
>                m_BSplineTransform->SetGridRegion(bsplineRegion);
>                m_BSplineTransform->SetGridDirection(bsplineDirection);
>
>                typedef typename BSplineTransformType::ParametersType 
> BSplineParametersType;
>
>                m_NumberOfParameters = 
> m_BSplineTransform->GetNumberOfParameters();
>
>                BSplineParametersType 
> bsplineParameters(m_NumberOfParameters);
>                bsplineParameters.Fill(0.0);
>                                            
> m_BSplineTransform->SetParameters(bsplineParameters);
>                
> m_RegistrationObject->SetInitialTransformParameters(m_BSplineTransform->GetParameters()); 
>
>        If i now start the registration with 1 iteration, the result is 
> totally shifted again.
> I am sure, the initial transform is right, because i got those values 
> by using the itk initializer class and tested the values as the 
> initial parameters of a VersorRigid3DTransform with iterations= 0 as 
> well.
> With the VersorRigid3DTransform, the images are aligned.
> Why is the bulktransform not working here?
>
> I becoming a little desperate now :-( . Can somebody give me a hint?
>
> Thanks!
>
>
> _____________________________________
> 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
Hi!

Or can somebody who successfully used the bulk transform can show me 
his/her source code...maybe i am just a blockhead ;-)

Thanks.


More information about the Insight-users mailing list