[Insight-users] VS 2010 assertion error after modifying DeformableRegistration15

Tim Bhatnagar tim.bhatnagar at gmail.com
Tue Mar 20 12:28:27 EDT 2012


Hello all,

I am trying to modify the deformable registration metric to take a
mask-file as an input region:

// begin code snippet

typedef itk::ImageMaskSpatialObject< Dimension >   MaskType;

  MaskType::Pointer  spatialObjectMask = MaskType::New();

  typedef itk::Image< unsigned char, Dimension >   ImageMaskType;

  typedef itk::ImageFileReader< ImageMaskType >    MaskReaderType;

  MaskReaderType::Pointer  maskReader = MaskReaderType::New();

  maskReader->SetFileName( argv[3] );

  try
    {
    maskReader->Update();
    }
  catch( itk::ExceptionObject & err )
    {
    std::cerr << "ExceptionObject caught !" << std::endl;
    std::cerr << err << std::endl;
    return EXIT_FAILURE;
    }

  spatialObjectMask->SetImage( maskReader->GetOutput() );

  metric->SetFixedImageMask( spatialObjectMask );

// end code snippet

In the original deformableregistration15 code, these are the only following
references to 'metric'

/////////
MetricType::Pointer         metric        = MetricType::New();

registration->SetMetric(        metric        );

metric->SetNumberOfHistogramBins( 50 );

metric->ReinitializeSeed( 76926294 );

metric->SetNumberOfSpatialSamples( 10000L ); /// for rigid registration

metric->SetNumberOfSpatialSamples( 50000L ); /// for affine registration

metric->SetNumberOfSpatialSamples( numberOfBSplineParameters * 100 ); ///
for coarse b-spline reg.

const unsigned long numberOfSamples =
     static_cast<unsigned long>(
       vcl_sqrt( static_cast<double>( numberOfBSplineParameters ) *
                 static_cast<double>( numberOfPixels ) ) );
  metric->SetNumberOfSpatialSamples( numberOfSamples ); /// for fine
b-spline reg.

////////

I hope this clearly outlines the problem.. I'm a relatively new ITK users
and I'm still grappling with making small-ish changes to the pre-assembled
algorithms.

Any help is much appreciated,



-- 
Tim Bhatnagar
PhD Candidate
Orthopaedic Injury Biomechanics Group
Department of Mechanical Engineering
University of British Columbia

Rm 5000 - 818 West 10th Ave.
Vancouver, BC
Canada
V5Z 1M9

Ph: (604) 675-8845
Fax: (604) 675-8820
Web: oibg.mech.ubc.ca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120320/19babe62/attachment.htm>


More information about the Insight-users mailing list