[Insight-users] trouble using the bulktransform

Luis Ibanez luis.ibanez at kitware.com
Sun Feb 28 16:51:08 EST 2010


Hi Erik,


You will find source code examples that use
the Bulk transform at:

     Insight/Examples/Registration/
               DeformableRegistration14.cxx
               DeformableRegistration15.cxx
               DeformableRegistration8.cxx


Theses examples are run as Nightly tests:

           DeformableRegistration8Test1
           DeformableRegistration8Test2
           DeformableRegistration8Test3
           DeformableRegistration8Test4
           DeformableRegistration8Test5
           DeformableRegistration8Test6
           DeformableRegistration8Test7
           DeformableRegistration8Test8
           DeformableRegistration8Test9
           DeformableRegistration8Test10
           DeformableRegistration8Test11
           DeformableRegistration8Test12

           DeformableRegistration14Test1
           DeformableRegistration14Test2
           DeformableRegistration14Test3
           DeformableRegistration14Test4

           DeformableRegistration15Test1
           DeformableRegistration15Test2


     Regards,


           Luis


----------------------------------------------------------
On Sat, Feb 27, 2010 at 9:24 AM, Erik Türke <tuerke at cbs.mpg.de> wrote:
> 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.
> _____________________________________
> 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