Skip to content

Commit

Permalink
ENH: Exclude retrieval of filenames of masks from elastix library
Browse files Browse the repository at this point in the history
Avoided confusing log messages saying "-fMask    unspecified, so no fixed mask used" and "-mMask    unspecified, so no moving mask used" for library users (including ITKElastix).

Relates to issue InsightSoftwareConsortium/ITKElastix#127 "registration with mask does not work", reported by jslalu, June 11, 2021.
  • Loading branch information
N-Dekker committed May 24, 2023
1 parent c24eaeb commit 23ef432
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions Core/Kernel/elxElastixBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -180,30 +180,34 @@ ElastixBase::BeforeAllBase()
log::info("ELASTIX version: " ELASTIX_VERSION_STRING "\nCommand line options from ElastixBase:");
std::string check = "";

/** Read the fixed and moving image filenames. These are obliged options,
* so print an error if they are not present.
* Print also some info (second boolean = true).
*/
if (!BaseComponent::IsElastixLibrary())
{
// Note: The filenames of the input images and the masks are only relevant to the elastix executable, not the
// library.

/** Read the fixed and moving image filenames. These are obliged options,
* so print an error if they are not present.
* Print also some info (second boolean = true).
*/
m_FixedImageFileNameContainer = GenerateFileNameContainer(*m_Configuration, "-f", returndummy, true, true);
m_MovingImageFileNameContainer = GenerateFileNameContainer(*m_Configuration, "-m", returndummy, true, true);
}
/** Read the fixed and moving mask filenames. These are not obliged options,
* so do not print any errors if they are not present.
* Do print some info (second boolean = true).
*/
int maskreturndummy = 0;
m_FixedMaskFileNameContainer = GenerateFileNameContainer(*m_Configuration, "-fMask", maskreturndummy, false, true);
if (maskreturndummy != 0)
{
log::info("-fMask unspecified, so no fixed mask used");
}
maskreturndummy = 0;
m_MovingMaskFileNameContainer = GenerateFileNameContainer(*m_Configuration, "-mMask", maskreturndummy, false, true);
if (maskreturndummy != 0)
{
log::info("-mMask unspecified, so no moving mask used");

/** Read the fixed and moving mask filenames. These are not obliged options,
* so do not print any errors if they are not present.
* Do print some info (second boolean = true).
*/
int maskreturndummy = 0;
m_FixedMaskFileNameContainer = GenerateFileNameContainer(*m_Configuration, "-fMask", maskreturndummy, false, true);
if (maskreturndummy != 0)
{
log::info("-fMask unspecified, so no fixed mask used");
}
maskreturndummy = 0;
m_MovingMaskFileNameContainer = GenerateFileNameContainer(*m_Configuration, "-mMask", maskreturndummy, false, true);
if (maskreturndummy != 0)
{
log::info("-mMask unspecified, so no moving mask used");
}
}

/** Check for appearance of "-out".
Expand Down

0 comments on commit 23ef432

Please sign in to comment.