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

Tim Bhatnagar tim.bhatnagar at gmail.com
Tue Mar 20 13:57:06 EDT 2012


I think I may have found my issue... the original DeformableRegistration15
code uses MattesMutualInformationImageToImagemetric, whereas the file that
I lifted the mask snippet from used ImageToImageMetric instead, which
supports a number of the metric-functions I called.

Rather than hacking/splicing the code together, would anyone be able to
tell me if it is possible to pass a FixedImageRegion that is a result of a
SpatialObjectMask, while using a MattesMutualInformationImageToImage metric?

Thanks,

Tim

On Tue, Mar 20, 2012 at 10:06 AM, Tim Bhatnagar <tim.bhatnagar at gmail.com>wrote:

> My apologies..
>
> It is a VS window that pops up with the following message:
>
> ///
> Debug Assertion Failed!
>
> Program: Deformable Registration
> File: f:\dd\vctools\crt_bld\self_x86\crt\src\strtol.c
> Line: 94
>
> Expression: nptr != NULL
>
> ///
>
> I am not even sure if this error is specific to VS, or what assignments I
> am making in my modified code that would yield a successful debug-build,
> but yield a runtime assertion error?
>
> Thanks again,
>
> Tim
>
>
>
>
> On Tue, Mar 20, 2012 at 10:00 AM, Bill Lorensen <bill.lorensen at gmail.com>wrote:
>
>> What error message do you see?
>>
>> On Tue, Mar 20, 2012 at 9:28 AM, Tim Bhatnagar <tim.bhatnagar at gmail.com>
>> wrote:
>> > 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
>> >
>> >
>> > _____________________________________
>> > 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.php
>> >
>> > 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
>> >
>>
>>
>>
>> --
>> Unpaid intern in BillsBasement at noware dot com
>>
>
>
>
> --
> 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
>
>


-- 
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/7890e316/attachment.htm>


More information about the Insight-users mailing list