[Insight-users] 3D Demons always reporting random metric values.

lien lee lienlee at gmail.com
Thu Sep 13 17:45:50 EDT 2012


Hi All,

As a newbie, I am running to an issue of how to use Demons registration
correctly.  With ITK4.2, I modified the example
"DeformableRegistration16.cxx" for 3D cases.  However,
CommandIterationUpdate always prints out random metric values like
1.79769e+308. Here is part of my code:
----------------------------------------------------------------------------------------------------------------------------------
    // Histogram matching
    typedef itk::HistogramMatchingImageFilter<ImageType, ImageType>
MatchingFilterType;
    MatchingFilterType::Pointer vMatcher = MatchingFilterType::New();
    vMatcher->SetInput(vMovImage);
    vMatcher->SetReferenceImage(vFixImage);
    vMatcher->SetNumberOfHistogramLevels(1024);
    vMatcher->SetNumberOfMatchPoints(7);
    vMatcher->ThresholdAtMeanIntensityOn();
    vMatcher->Update();

    //- Setup the deformation field and filter
    typedef itk::Vector<float, 3>            VectorPixelType;
    typedef itk::Image<VectorPixelType, 3>    DisplacementFieldType;
    typedef itk::DemonsRegistrationFilter<ImageType, ImageType,
                            DisplacementFieldType>
RegistrationFilterType;
    RegistrationFilterType::Pointer vFilter = RegistrationFilterType::New();
    vFilter->SetStandardDeviations(5.0);

    //- Create the Command observer and register it with the registration
filter.
    CommandIterationUpdate::Pointer observer =
CommandIterationUpdate::New();
    vFilter->AddObserver( itk::IterationEvent(), observer );


    //- Use multiresolution scheme
    typedef itk::MultiResolutionPDEDeformableRegistration<ImageType,
        ImageType, DisplacementFieldType>
MultiResRegistrationFilterType;

    MultiResRegistrationFilterType::Pointer vRegistration =
MultiResRegistrationFilterType::New();

    vRegistration->SetRegistrationFilter(vFilter);
    vRegistration->SetNumberOfLevels(4);
    vRegistration->SetFixedImage(vFixImage);
    vRegistration->SetMovingImage(vMatcher->GetOutput());
    unsigned int nIterations[4] = {40, 40, 32, 32};
    vRegistration->SetNumberOfIterations(nIterations);

    //- Create the Command observer and register it with the registration
filter.
    CommandResolutionLevelUpdate::Pointer vLevelObserver =
CommandResolutionLevelUpdate::New();
    vRegistration->AddObserver(itk::IterationEvent(), vLevelObserver);

    //- Apply the registration filter
    try
    {
        vRegistration->Update();
    }
    catch( itk::ExceptionObject & excp )
    {
        std::cerr << excp << std::endl;
        return false;
    }
----------------------------------------------------------------------------------------------------------------------------------

Am I wrong with anything? Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120913/8bef5152/attachment.htm>


More information about the Insight-users mailing list