[Insight-users] BSpline Transformation and binary images

Serena Fabbri fabbri at u.washington.edu
Thu Oct 22 13:12:27 EDT 2009



Hi Luise,

I am glad that my suggestions were useful for you.
When the MMI code will be fixed, do you write an email?

Yes, I get output from  
optimizer->GetCachedValue() 
This instruction is inside the observer code. The registration runs but it is very slow, my computer is 
new......so what could it be wrong in my Registration task?
I am using (13;13;13) nodes Bspline grid.

I have read the the Amoeba optimizer documentation again and I have not found a function to obtain 
the number of iteration. Am I wrong?


Thank again for your help.


Serena.





On Tue, 20 Oct 2009, Luis Ibanez wrote:

> Hi Serena,
>
> Thanks a lot for tracking this down.
>
> Your findings are quite interesting.
>
> The three lines of code that you have indicated are indeed performing
> incorrect computations, in the case where of number of bins is == 2.
>
> I'm preparing a patch for this class,
>
> Insight/Code/Algorithms/
> itkMattesMutualInformationImageToImageMetric.txx
>
> and its multi-threaded version:
>
> Insight/Code/Review/
> itkOptMattesMutualInformationImageToImageMetric.txx
>
> that will cast properly the variable m_NumberOfHistogramBins
> to the type OffsetValueType (which is signed).
>
> We need to run this in a couple of experimental builds first,
> and then we should put together a test that exercises this
> metric on a binary image.
>
>
> Again, Thanks for tracking this issue,
> and pointing to the location of the problem in the code.
>
>
> About your second question:
>
> A typical registration process with images that are of size 100^3
> pixels,  should take more than 30 minutes in a modern computer.
>
> Are you seeing any output from the Command observer ?
> Something is certainly wrong with the process.
>
> Also, please not that the call
>
>       get_num_evaluations()
>
> is not quite equivalent, to number of Iterations.
>
> In the case of the Amoeba optimizer, what
> happens is that the Metric may be computed multiple
> times in the process of computing a single Iteration
> of the optimizer.  The method get_num_evaluations
> tells you how many times the metric was evaluated
> in the last iteration of the optimizer, not how many
> iterations have been used by the optimizer.
>
>
>      Regards,
>
>
>             Luis
>
>
> -------------------------------------------------------------------
> On Thu, Oct 15, 2009 at 2:49 PM, Serena Fabbri <fabbri at u.washington.edu> wrote:
>>
>> Hi Luis,
>>
>> I have taken a look to itkMattesMutualInformationImageToImageMetric, and the
>> problems seem to be:
>> -line 241 (Initialize):  m_NumberOfHistogramBins is unsigned long and the
>> value of brackets expression is (-2). It can not be assigned.
>> -line 677 (ComputeFixedImageParzenWindowIndices): same problem and besides
>> pindex is unsigned int and it can not be (-1) the correct value.
>> -line 758 (GetValue): same problem and again movingImageParzenWindowindex is
>> unsigned int and it can not be (-1).
>>
>> I am not sure that to do a cast is ok because after the cast (line 682
>> ComputeFixedImageParzenWindowIndices),  (*iter).FixedimageParzenWindowIndex
>> will be 1 and 2 and they (at least 2) can not be indexes  for
>> m_FixedImageMarginalPDF (line 767 GetValue) because the dimension of this
>> array is the number of the bin (=2).
>>
>> Do you agree with me?
>>
>>
>> Now I am running Cardinality Metric with Amoeba optmizer and BSpline
>>  Transformation.
>> My image are (80;80;101) pixelsize and (4;4;1)mm spacing.
>>
>> I have set
>>        simplexDelta.Fill( 5.0 );
>>        optimizer->AutomaticInitialSimplexOff();
>>        optimizer->SetInitialSimplexDelta( simplexDelta );
>>        optimizer->SetParametersConvergenceTolerance( 2 );
>>        optimizer->SetFunctionConvergenceTolerance(1);
>>        optimizer->SetMaximumNumberOfIterations( 200 );
>>
>> I'd like to ask you how long the registration task can be, because it
>> started 2 days ago and it is still running.
>> Besides I have put optimizer->GetOptimizer()->get_num_evaluations() in
>> observer code but it doesn't work. How can I do to visualize the number of
>> iteration during the process?
>>
>>
>> Thank you for any info.
>>
>> Serena.
>>
>>
>>
>>
>>
>> On Mon, 12 Oct 2009, Luis Ibanez wrote:
>>
>>> Hi Serena,
>>>
>>> I believe Hans Johnson reported a while ago that this
>>> metric implementation had a bug that make it unsuitable
>>> for registering binary images.
>>>
>>> (My mistake for suggesting to use this metric for this
>>> case without having tried).
>>>
>>> Your options at this point are:
>>>
>>>
>>>           A) Help us debug the metric   :-)
>>>
>>>
>>>           B) Use the Cardinality Metric instead.
>>>                itkMatchCardinalityImageToImageMetric.h
>>>
>>>
>>> Please let us know what would be your preference,
>>>
>>>
>>>    Thanks
>>>
>>>
>>>           Luis
>>>
>>>
>>> -----------------------------------------------------------------
>>> On Mon, Oct 12, 2009 at 7:23 PM, Serena Fabbri <fabbri at u.washington.edu>
>>> wrote:
>>>>
>>>> Hi All,
>>>>
>>>> I am trying to register binary images of the head using Non Rigid
>>>> Registration. They are (80;80;101) pixelsize and (4;4;1)mm spacing.
>>>>
>>>> I use Mattes-MI, LBFGSB, NearestNeighbor interpolator and BSpline
>>>> Transformation.
>>>> After reading the email
>>>> http://www.itk.org/pipermail/insight-users/2007-November/024178.html
>>>>
>>>> I set 2 bin and 10% of statistic for MI and I have got this message:
>>>>
>>>> Starting Registration
>>>> ExceptionObject caught !
>>>>
>>>> itk::ExceptionObject (0x1900fb0)
>>>> Location: "void
>>>> itk::MattesMutualInformationImageToImageMetric<TFixedImage,
>>>> TMovingImage>::GetValueAndDerivative(typename
>>>> itk::ImageToImageMetric<TFixedImage, TMovingImage>::ParametersType&,
>>>> typename itk::ImageToImageMetric<TFixedImage,
>>>> TMovingImage>::MeasureType&,
>>>> typename itk::ImageToImageMetric<TFixedImage,
>>>> TMovingImage>::DerivativeType&) const [with TFixedImage = main(int,
>>>> char**)::FixedImageType, TMovingImage = main(int,
>>>> char**)::MovingImageType]"
>>>> File: /Users/InsightToolkit-
>>>> 3.10.0/Code/Algorithms/itkMattesMutualInformationImageToImageMetric.txx
>>>> Line: 1160
>>>> Description: itk::ERROR:
>>>> MattesMutualInformationImageToImageMetric(0x1900260): Fixed image
>>>> marginal
>>>> PDF summed to zero
>>>>
>>>> I have increased the statistic until 30% and I get the same error.
>>>> Is it possible that BSpline Transformation is not suitable for binary
>>>> images
>>>> registration?
>>>>
>>>> Any suggestion will be appreciate.
>>>>
>>>> Thanks.
>>>>
>>>> Serena.
>>>>
>>>>
>>>>
>>>>
>>>> _____________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.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