hammer_faq > An example of using HAMMER in ITK
Showing 1-2 of 2 posts
Display:
Results per page:
Nov 11, 2011  03:11 PM | Guorong Wu
An example of using HAMMER in ITK
Here we demonstrate how to use HAMMER registration filter in ITK for deformable registration of the two T1 MR brains. The source code can be found in source code package (/src/test/HammerRegistrationTest.cxx).

First of all, we need to initialize the HAMMER registration filter instance as follows:
typedef itk::HammerDeformableRegistrationImageFilter RegistrationFilterType;
RegistrationFilterType::Pointer hammer = RegistrationFilterType::New();

Then, the fixed and the moving images should be specified:
hammer->SetFixedImage( fImg0 );
hammer->SetMovingImage( mImg0 );

Next, we need to specify the parameters used in HAMMER:
hammer->SetIterations( iterations[0], iterations[1], iterations[2] );
hammer->SetDeformRate(0.05);
hammer->SetPointMatchingThreshold(0.8);
hammer->SetSubvolumeSimilarityThreshold(0.6);
hammer->SetSearchRadius(12);

Finally, by calling hammer->Update(), it will return a dense deformation field that points from the fixed image to the moving image. The following lines of code are used to warp the subject image with itk::WarpImageFilter:
typedef itk::WarpImageFilter  WarperType;
typedef itk::NearestNeighborInterpolateImageFunction  InterpolatorType;
WarperType::Pointer warper = WarperType::New();
InterpolatorType::Pointer interpolator = InterpolatorType::New();
warper->SetInput( mImg0 );
warper->SetInterpolator( interpolator );
warper->SetOutputDirection( fImg0->GetDirection() );
warper->SetOutputSpacing( fImg0->GetSpacing() );
warper->SetOutputOrigin( fImg0->GetOrigin() );
warper->SetDeformationField(hammer->GetOutput());
WriterType::Pointer writer =  WriterType::New();
writer->SetFileName( resampledFilename.c_str() );
writer->SetInput( warper->GetOutput() );
writer->Update();
Nov 16, 2011  03:11 PM | Guorong Wu
RE: An example of using HAMMER in ITK
3D slicer encourages to reuse the existing modules as much as possible. Therefore our HAMMER registration module performs the deformable registration which only estimate the local deformations. Usually linear registration is needed to remove the global difference before running the deformable registration. Please see the complete data processing pipeline at (http://www.nitrc.org/forum/forum.php?thr...).