typedef itk::MultiModal3DMutualRegistrationHelper
< TransformType, OptimizerType, FixedVolumeType, MovingVolumeType > MultiModal3DMutualRegistrationHelperType;

MultiModal3DMutualRegistrationHelperType::Pointer
appMutualRegistration = MultiModal3DMutualRegistrationHelperType::New();

if(m_FixedBinaryVolume.IsNotNull() )
{
  appMutualRegistration->SetFixedBinaryVolume(m_FixedBinaryVolume);
}
if(m_MovingBinaryVolume.IsNotNull() )
{
  appMutualRegistration->SetMovingBinaryVolume(m_MovingBinaryVolume);
}
appMutualRegistration->SetNumberOfHistogramBins(m_NumberOfHistogramBins);

appMutualRegistration->SetNumberOfIterations( localNumberOfIterations[currentTransformIndex] );

// TODO:  What do the following two lines really accomplish
// debug parameter, suppressed from command line
const bool initialTransformPassThru(false);
appMutualRegistration->SetInitialTransformPassThruFlag( initialTransformPassThru );
appMutualRegistration->SetUseExplicitPDFDerivativesFlag( m_UseExplicitPDFDerivativesMode == "OFF" );
appMutualRegistration->SetPermitParameterVariation( m_PermitParameterVariation );
appMutualRegistration->SetNumberOfSamples( m_NumberOfSamples );
appMutualRegistration->SetRelaxationFactor( m_RelaxationFactor );
appMutualRegistration->SetMaximumStepLength( m_MaximumStepLength );
appMutualRegistration->SetMinimumStepLength( localMinimumStepLength[currentTransformIndex] );
appMutualRegistration->SetTranslationScale( m_TranslationScale );
appMutualRegistration->SetReproportionScale( m_ReproportionScale );
appMutualRegistration->SetSkewScale( m_SkewScale );

appMutualRegistration->SetFixedImage(    m_FixedVolume    );
appMutualRegistration->SetMovingImage(   m_MovingVolume   );
appMutualRegistration->SetBackgroundFillValue(   m_BackgroundFillValue   );

appMutualRegistration->SetInitialTransform( initialITKTransform );
appMutualRegistration->SetDisplayDeformedImage(m_DisplayDeformedImage);
appMutualRegistration->SetPromptUserAfterDisplay(m_PromptUserAfterDisplay);
appMutualRegistration->SetObserveIterations(m_ObserveIterations);
/*
 *  At this point appMutualRegistration should be all set to make
 *  an itk pipeline class templated in TransformType etc.
 *  with all its inputs in place;
 */
// initialize the interconnects between components
appMutualRegistration->Initialize();

TransformType::Pointer finalTransform;
try
{
  appMutualRegistration->Update();
  finalTransform = appMutualRegistration->GetTransform();
  this->m_FinalMetricValue=appMutualRegistration->GetFinalMetricValue();
  this->m_ActualNumberOfIterations = appMutualRegistration->GetActualNumberOfIterations();
  this->m_PermittedNumberOfIterations = localNumberOfIterations[currentTransformIndex];
  //this->m_AccumulatedNumberOfIterationsForAllLevels += appMutualRegistration->GetActualNumberOfIterations();
}
catch( itk::ExceptionObject& err )
{
  // pass exception to caller
  std::cout << "ERROR OCCURED: " << err << std::endl;
  exit(-1);
  throw err;
}

{ //Put the transform on the CurrentTransformList
  //Initialize next level of transformations with previous transform result
  m_CurrentGenericTransform=finalTransform;
  localInitializeTransformMode="Off"; //Now turn of the initiallize code to off
}

