[Insight-users] Inconsistent registration result.

Seth Gilchrist seth at mech.ubc.ca
Tue Mar 12 11:31:02 EDT 2013


Hi Lien,
Sorry for the confusion, by resampling I was thinking of the sampling that
happens between your runs in which you are checking for consistency.  It
appears you are doing this with your redefinition of
SampleFixedImageRegion(). It seems that it must be a thread issue.

Seth


On Tue, Mar 12, 2013 at 7:00 AM, lien lee <lienlee at gmail.com> wrote:

>  Hi Seth,
>
>  Thanks for your input. I want to make sure I understand you correctly. I
> assume that you are suggesting to call
> vMetric->SetUseFixedImageIndexes(true); and then manage to create and use
> an index list of the sample points, so that I can avoid the random sampling
> process.  But, I am not so sure I understand your term "re-sampling". I
> looked into itk source code carefully. I found that the sampling process
> (for creating the list of samples) was called in
> itk::ImageToImageMetric::MultiThreadingInitialize(), which is called in
> itk::MultiResolutionImageRegistrationMethod::Initialize().  That is to say,
> the sample list is created only once for one image resolution level, but it
> must be re-created for a new image resolution level since it is actually a
> new image object.  Therefore, looks to me, there is no redundant repeated
> sampling process to avoid.
>
>  In the sense of avoiding the random sampling procedure, I created a
> sub-class of MattesMetric, and rewrote the SampleFixedImageRegion()
> function, where I gave up the random sampling strategy and just used all
> the odd indices of the points in my fixed image mask. Unfortunately, the
> results are still inconsistent, which makes me prone to believe that this
> is the problem of thread safety when two masks are applied as I mentioned
> after I tried Bradley's suggestion.
>
>
>
> 2013/3/11 Seth Gilchrist <seth at mech.ubc.ca>
>
>> Hi Lien,
>> Could you use create a sub class of the MattesMetric and define a new
>> function GetFixedImageIndexes() to give you the indexes? You could then use
>> SetFixedImageIndexes( <your index list> ) and that would
>> prevent re-sampling. Maybe put in a request to have GetFixedImgeIndexes()
>> added at some point.
>>
>>  Seth
>>
>>
>>  On Mon, Mar 11, 2013 at 10:29 AM, lien lee <lienlee at gmail.com> wrote:
>>
>>>  Hi Bradley,
>>>
>>>  Sorry for the late response.
>>>
>>>  Just now, I tried what you have suggested, and I do see consistent
>>> results among different runs on the two computers I have. So, the problem
>>> should be that it is not thread safe when applying the two masks. I am
>>> wondering what I should do next, since the single-threaded program runs
>>> slowly. Is there any solution that I can use faster multi-threading
>>> technique and still keep the results consistent? Does ITK v4 do a better
>>> job in this regards?
>>>
>>>  BTW, another trial was done before I set ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS
>>> to 1.
>>> I called vMetric->SetNumberOfThreads(1), and I noticed that most of the
>>> time only one thread was working through starring at the CPU usage in
>>> Windows Task Manager.  But still, the results were inconsistent in
>>> different runs. I could not explain this. I mention it just because it
>>> might mean something to itk-developers.
>>>
>>> Thanks!
>>>
>>>
>>> 2013/3/1 Bradley Lowekamp <blowekamp at mail.nih.gov>
>>>
>>>>  Hello,
>>>>
>>>>  How many threads are you running? Have you tried setting the
>>>> environment variable ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS to 1, to see of
>>>> the results then become consistent?
>>>>
>>>>  Brad
>>>>
>>>>    On Feb 28, 2013, at 5:52 PM, lien lee <lienlee at gmail.com> wrote:
>>>>
>>>>     Hi itk-users,
>>>>
>>>>  I took a further step today.  I derived a class
>>>> from MattesMutualInformationImageToImageMetric, and made it being the
>>>> metric, so that, I could sneak into itk and visit the protected
>>>> member ImageToImageMetric< TFixedImage, TMovingImage
>>>> >::m_FixedImageSamples. I printed out a couple of sample points (their
>>>> coordinates and image values), and I also printed out the seed value of the
>>>> random number generator, which I set as ReinitializeSeed(76926294).  I get
>>>> the seed value by
>>>> calling Statistics::MersenneTwisterRandomVariateGenerator::GetInstance()->GetSeed();
>>>> In different runs, I do see same seed were used, but I also do see
>>>> different sample points.  I tried this on two different computers, at both
>>>> of which I saw the inconsistent results. Seems to be the random number
>>>> generator is non-deterministic even with same seed.  However, the weird
>>>> thing is if I do not use the image mask, it would be consistent.
>>>>
>>>>  Any thoughts?
>>>>
>>>>
>>>> 2013/2/26 lien lee <lienlee at gmail.com>
>>>>
>>>>>  Hi Seth,
>>>>>
>>>>>  By clicking the link you provided, the code I saw there is as partly
>>>>> attached, which is different from what I have with ITK 4.2 on my computer.
>>>>>
>>>>>  I do not have experience with this code, and I am not exactly sure
>>>>> how it works.  But, looks to me, optimizer would call the function during
>>>>> each iteration, and the function would rebuild all the sample points again
>>>>> and again for all the iterations.  If my understanding were correct, this
>>>>> would be quite different from what I have with ITK 4.2 on my computer,
>>>>> where all the samples were created
>>>>> in MattesMutualInformationImageToImageMetric::Initialize() as *a one
>>>>> time thing*, and the counted points would be determined for each
>>>>> iteration using the current transform by checking whether the mapped points
>>>>> were inside the moving image mask. Therefore, for the code I am working on,
>>>>> to my understanding, if I called ReinitializeSeed(76926294) before
>>>>> generating all the sample points
>>>>> in MattesMutualInformationImageToImageMetric::Initialize(), the results
>>>>> should be deterministic, no matter whether I applied the image masks or
>>>>> not. But, the testing results with image mask applied does NOT support my
>>>>> understanding.
>>>>>
>>>>>  BTW, to your question, my moving image mask may not be "restrictive"
>>>>> because it occupied pretty much about 80% of the whole moving image.
>>>>>
>>>>>  Thanks again for your inputs.
>>>>>
>>>>>
>>>>>    106<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l106>template <class TFixedImage,
>>>>> class TMovingImage>
>>>>> 107<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l107>void
>>>>> 108<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l108>MutualInformationImageToImageMetric<TFixedImage, TMovingImage>
>>>>> 109<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l109>::SampleFixedImageDomain(
>>>>> 110<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l110>  SpatialSampleContainer & samples) const
>>>>> 111<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l111>{
>>>>> 112<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l112>  typedef ImageRandomConstIteratorWithIndex<FixedImageType> RandomIterator;
>>>>> 113<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l113>  RandomIterator randIter( this->m_FixedImage, this->GetFixedImageRegion() );
>>>>> 114<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l114>
>>>>> 115<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l115>  randIter.SetNumberOfSamples(m_NumberOfSpatialSamples);
>>>>> 116<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l116>  randIter.GoToBegin();
>>>>> 117<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l117>
>>>>> 118<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l118>  typename SpatialSampleContainer::iterator iter;
>>>>> 119<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l119>  typename SpatialSampleContainer::const_iterator end = samples.end();
>>>>> 120<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l120>
>>>>> 121<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l121>  bool allOutside = true;
>>>>> 122<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l122>
>>>>> 123<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l123>  this->m_NumberOfPixelsCounted = 0;    // Number of pixels that map into the
>>>>> 124<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l124>                                        // fixed and moving image mask, if
>>>>> 125<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l125>                                        // specified
>>>>> 126<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l126>                                        // and the resampled fixed grid after
>>>>> 127<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l127>                                        // transformation.
>>>>> 128<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l128>
>>>>> 129<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l129>  // Number of random picks made from the portion of fixed image within the
>>>>> 130<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l130>  // fixed mask
>>>>> 131<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l131>  SizeValueType numberOfFixedImagePixelsVisited = 0;
>>>>> 132<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l132>  SizeValueType dryRunTolerance = this->GetFixedImageRegion().GetNumberOfPixels();
>>>>> 133<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l133>  for( iter = samples.begin(); iter != end; ++iter )
>>>>> 134<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l134>    {
>>>>> 135<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l135>    // Get sampled index
>>>>> 136<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l136>    FixedImageIndexType index = randIter.GetIndex();
>>>>> 137<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l137>    // Get sampled fixed image value
>>>>> 138<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l138>    ( *iter ).FixedImageValue = randIter.Get();
>>>>> 139<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l139>    // Translate index to point
>>>>> 140<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l140>    this->m_FixedImage->TransformIndexToPhysicalPoint(index,
>>>>> 141<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l141>                                                      ( *iter ).FixedImagePointValue);
>>>>> 142<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l142>
>>>>> 143<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l143>    // If not inside the fixed mask, ignore the point
>>>>> 144<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l144>    if( this->m_FixedImageMask
>>>>> 145<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l145>        && !this->m_FixedImageMask->IsInside( ( *iter ).FixedImagePointValue ) )
>>>>> 146<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l146>      {
>>>>> 147<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l147>      ++randIter; // jump to another random position
>>>>> 148<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l148>      continue;
>>>>> 149<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l149>      }
>>>>> 150<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l150>
>>>>> 151<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l151>    if( allOutside )
>>>>> 152<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l152>      {
>>>>> 153<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l153>      ++numberOfFixedImagePixelsVisited;
>>>>> 154<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l154>      if( numberOfFixedImagePixelsVisited > dryRunTolerance )
>>>>> 155<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l155>        {
>>>>> 156<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l156>        // We randomly visited as many points as is the size of the fixed image
>>>>> 157<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l157>        // region.. Too may samples mapped ouside.. go change your transform
>>>>> 158<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l158>        itkExceptionMacro(<< "Too many samples mapped outside the moving buffer");
>>>>> 159<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l159>        }
>>>>> 160<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l160>      }
>>>>> 161<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l161>
>>>>> 162<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l162>    MovingImagePointType mappedPoint =
>>>>> 163<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l163>      this->m_Transform->TransformPoint( ( *iter ).FixedImagePointValue );
>>>>> 164<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l164>
>>>>> 165<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l165>    // If the transformed point after transformation does not lie within the
>>>>> 166<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l166>    // MovingImageMask, skip it.
>>>>> 167<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l167>    if( this->m_MovingImageMask
>>>>> 168<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l168>        && !this->m_MovingImageMask->IsInside(mappedPoint) )
>>>>> 169<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l169>      {
>>>>> 170<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l170>      ++randIter;
>>>>> 171<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l171>      continue;
>>>>> 172<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l172>      }
>>>>> 173<http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l173>
>>>>> <http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l174>
>>>>>
>>>>>   2013/2/26 Seth Gilchrist <seth at mech.ubc.ca>
>>>>>
>>>>>> Hi Lien,
>>>>>>  Unfortunately I have not used masks when performing registrations,
>>>>>> so can't help you with this specific problem.
>>>>>>
>>>>>>  I took a look at the git blob for the MattesMutual...Metric and was
>>>>>> examining how the decision to keep or reject a give point is handled. If
>>>>>> you are setting a mask on both the fixed and moving images, this will
>>>>>> change what points are used because a check is done to see if a point is in
>>>>>> the fixed mask and if it is in the moving mask after applying the current
>>>>>> transform. Could your moving image mask be too restrictive for the early
>>>>>> stages of the registration?
>>>>>>
>>>>>>  You can read the code at:
>>>>>>
>>>>>> http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD
>>>>>>
>>>>>>  Starting on line 108, specifically on line 162.
>>>>>>
>>>>>>  Cheers,
>>>>>> Seth
>>>>>>
>>>>>> *Seth Gilchrist, MASc, PhD Candidate
>>>>>> +---------------------------------------+
>>>>>> Orthopaedic and Injury Biomechanics Group
>>>>>> UBC Department of Mechanical Engineering
>>>>>> 6th Floor-2635 Laurel Street
>>>>>> Vancouver, BC V5Z-1M9
>>>>>> +---------------------------------------+
>>>>>> seth at mech.ubc.ca
>>>>>> Fax 604-675-2576*
>>>>>>
>>>>>>
>>>>>
>>>>   _____________________________________
>>>> 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
>>>>
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130312/e4d71f32/attachment.htm>


More information about the Insight-users mailing list