Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: SuperElastix/elastix
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 57ecbb64e30815295101cfd5c0a110b8f5ccaf6f
Choose a base ref
..
head repository: SuperElastix/elastix
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 67315677772fae348c8be21d347069a534ce94ad
Choose a head ref
Showing with 27 additions and 32 deletions.
  1. +26 −27 Core/ComponentBaseClasses/elxTransformBase.hxx
  2. +1 −5 Core/Main/GTesting/elxCoreMainGTestUtilities.h
53 changes: 26 additions & 27 deletions Core/ComponentBaseClasses/elxTransformBase.hxx
Original file line number Diff line number Diff line change
@@ -348,43 +348,42 @@ TransformBase<TElastix>::ReadFromFile()
} // end if this->m_ReadWriteTransformParameters

/** Task 2 - Get the InitialTransform. */

/** Get the InitialTransformName. */
std::string fileName = "NoInitialTransform";
configuration.ReadParameter(fileName, "InitialTransformParametersFileName", 0);

const ElastixBase & elastixBase = Deref(Superclass::GetElastix());

/** Call the function ReadInitialTransformFromFile. */
if (fileName == "NoInitialTransform")
if (elastixBase.GetNumberOfTransformConfigurations() > 1)
{
if (elastixBase.GetNumberOfTransformConfigurations() > 1)
{
const Configuration::ConstPointer previousTransformConfiguration =
elastixBase.GetPreviousTransformConfiguration(configuration);
const Configuration::ConstPointer previousTransformConfiguration =
elastixBase.GetPreviousTransformConfiguration(configuration);

if (previousTransformConfiguration)
{
this->ReadInitialTransformFromConfiguration(previousTransformConfiguration);
}
if (previousTransformConfiguration)
{
this->ReadInitialTransformFromConfiguration(previousTransformConfiguration);
}
}
else
{
/** Check if the initial transform of this transform parameter file
* is not the same as this transform parameter file. Otherwise,
* we will have an infinite loop.
*/
std::string fullFileName1 = itksys::SystemTools::CollapseFullPath(fileName);
std::string fullFileName2 = itksys::SystemTools::CollapseFullPath(configuration.GetParameterFileName());
if (fullFileName1 == fullFileName2)
/** Get the InitialTransformName. */
std::string fileName = "NoInitialTransform";
configuration.ReadParameter(fileName, "InitialTransformParametersFileName", 0);

/** Call the function ReadInitialTransformFromFile. */
if (fileName != "NoInitialTransform")
{
itkExceptionMacro(<< "ERROR: The InitialTransformParametersFileName is identical to the current "
"TransformParameters filename! An infinite loop is not allowed.");
}
/** Check if the initial transform of this transform parameter file
* is not the same as this transform parameter file. Otherwise,
* we will have an infinite loop.
*/
std::string fullFileName1 = itksys::SystemTools::CollapseFullPath(fileName);
std::string fullFileName2 = itksys::SystemTools::CollapseFullPath(configuration.GetParameterFileName());
if (fullFileName1 == fullFileName2)
{
itkExceptionMacro(<< "ERROR: The InitialTransformParametersFileName is identical to the current "
"TransformParameters filename! An infinite loop is not allowed.");
}

/** We can safely read the initial transform. */
this->ReadInitialTransformFromFile(fileName.c_str());
/** We can safely read the initial transform. */
this->ReadInitialTransformFromFile(fileName.c_str());
}
}

/** Task 3 - Read from the configuration file how to combine the
6 changes: 1 addition & 5 deletions Core/Main/GTesting/elxCoreMainGTestUtilities.h
Original file line number Diff line number Diff line change
@@ -51,17 +51,13 @@ namespace elastix
namespace CoreMainGTestUtilities
{

/// Eases passing a type as argument to a generic lambda.
template <typename TNested>
struct TypeHolder
{
using Type = TNested;
};

// NestedType<THolder> typically retrieves the nested type of a TypeHolder<TNested>
template <typename THolder>
using NestedType = typename THolder::Type;


/// Simple exception class, to be used by unit tests.
class Exception : public std::exception
{