Skip to content

Commit

Permalink
STYLE: Remove initial << insertion from itkDebugMacro(<< " calls
Browse files Browse the repository at this point in the history
Follow-up to pull request #4057
commit 89beb04
"STYLE: Remove initial `<<` insertion from `itkExceptionMacro(<< "` calls"

Aims to shorten the code a little bit, and improve consistency. The code base
already had more than 500 `itkDebugMacro` calls that passed a literal string as
first argument directly, without having `<<` at its left side.
  • Loading branch information
N-Dekker authored and dzenanz committed Jun 2, 2023
1 parent 1d0d43c commit b52f423
Show file tree
Hide file tree
Showing 112 changed files with 530 additions and 526 deletions.
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkExtractImageFilter.hxx
Expand Up @@ -295,7 +295,7 @@ void
ExtractImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerateData(
const OutputImageRegionType & outputRegionForThread)
{
itkDebugMacro(<< "Actually executing");
itkDebugMacro("Actually executing");

const InputImageType * inputPtr = this->GetInput();
OutputImageType * outputPtr = this->GetOutput();
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkGaussianOperator.hxx
Expand Up @@ -52,8 +52,8 @@ GaussianOperator<TPixel, VDimension, TAllocator>::GenerateCoefficients() -> Coef
}
if (coeff.size() > m_MaximumKernelWidth)
{
itkDebugMacro(<< "Kernel size has exceeded the specified maximum width of " << m_MaximumKernelWidth
<< " and has been truncated to " << coeff.size()
itkDebugMacro("Kernel size has exceeded the specified maximum width of "
<< m_MaximumKernelWidth << " and has been truncated to " << coeff.size()
<< " elements. You can raise the maximum width using the SetMaximumKernelWidth method.");
break;
}
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkMacro.h
Expand Up @@ -470,7 +470,7 @@ OutputWindowDisplayDebugText(const char *);
/** This macro is used to print debug (or other information). They are
* also used to catch errors, etc. Requires that the caller implements
* the GetDebug() method (see itk::Object). Example usage looks like:
* itkDebugMacro(<< "this is debug info" << this->SomeVariable); */
* itkDebugMacro("this is debug info" << this->SomeVariable); */
#if defined(NDEBUG)
# define itkDebugMacro(x) ITK_NOOP_STATEMENT
# define itkDebugStatement(x) ITK_NOOP_STATEMENT
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkPointSetToImageFilter.hxx
Expand Up @@ -109,7 +109,7 @@ PointSetToImageFilter<TInputPointSet, TOutputImage>::GenerateData()
{
unsigned int i;

itkDebugMacro(<< "PointSetToImageFilter::Update() called");
itkDebugMacro("PointSetToImageFilter::Update() called");

// Get the input and output pointers
const InputPointSetType * InputPointSet = this->GetInput();
Expand Down Expand Up @@ -220,7 +220,7 @@ PointSetToImageFilter<TInputPointSet, TOutputImage>::GenerateData()
++pointItr;
}

itkDebugMacro(<< "PointSetToImageFilter::Update() finished");
itkDebugMacro("PointSetToImageFilter::Update() finished");
} // end update function

template <typename TInputPointSet, typename TOutputImage>
Expand Down
8 changes: 4 additions & 4 deletions Modules/Core/Common/src/itkObject.cxx
Expand Up @@ -361,7 +361,7 @@ Object::Modified() const
void
Object::Register() const
{
itkDebugMacro(<< "Registered, "
itkDebugMacro("Registered, "
<< "ReferenceCount = " << (m_ReferenceCount + 1));

// call the parent
Expand All @@ -375,7 +375,7 @@ void
Object::UnRegister() const noexcept
{
// call the parent
itkDebugMacro(<< "UnRegistered, "
itkDebugMacro("UnRegistered, "
<< "ReferenceCount = " << (m_ReferenceCount - 1));

if ((m_ReferenceCount - 1) <= 0)
Expand Down Expand Up @@ -415,7 +415,7 @@ Object::UnRegister() const noexcept
void
Object::SetReferenceCount(int ref)
{
itkDebugMacro(<< "Reference Count set to " << ref);
itkDebugMacro("Reference Count set to " << ref);

// ReferenceCount in now unlocked. We may have a race condition to
// to delete the object.
Expand Down Expand Up @@ -561,7 +561,7 @@ Object::Object()

Object::~Object()
{
itkDebugMacro(<< "Destructing!");
itkDebugMacro("Destructing!");
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/GPUCommon/include/itkGPUImageDataManager.hxx
Expand Up @@ -78,7 +78,7 @@ GPUImageDataManager<ImageType>::MakeCPUBufferUpToDate()
if ((m_IsCPUBufferDirty || (gpu_time > cpu_time)) && m_GPUBuffer != nullptr && m_CPUBuffer != nullptr)
{
cl_int errid;
itkDebugMacro(<< "GPU->CPU data copy");
itkDebugMacro("GPU->CPU data copy");
errid = clEnqueueReadBuffer(m_ContextManager->GetCommandQueue(m_CommandQueueId),
m_GPUBuffer,
CL_TRUE,
Expand Down Expand Up @@ -120,7 +120,7 @@ GPUImageDataManager<ImageType>::MakeGPUBufferUpToDate()
if ((m_IsGPUBufferDirty || (gpu_time < cpu_time)) && m_CPUBuffer != nullptr && m_GPUBuffer != nullptr)
{
cl_int errid;
itkDebugMacro(<< "CPU->GPU data copy");
itkDebugMacro("CPU->GPU data copy");
errid = clEnqueueWriteBuffer(m_ContextManager->GetCommandQueue(m_CommandQueueId),
m_GPUBuffer,
CL_TRUE,
Expand Down
10 changes: 5 additions & 5 deletions Modules/Core/Mesh/include/itkConnectedRegionsMeshFilter.hxx
Expand Up @@ -145,14 +145,14 @@ ConnectedRegionsMeshFilter<TInputMesh, TOutputMesh>::GenerateData()
InputMeshCellsContainerConstPointer inCells = input->GetCells();
InputMeshCellDataContainerConstPointer inCellData = input->GetCellData();

itkDebugMacro(<< "Executing connectivity");
itkDebugMacro("Executing connectivity");

// Check input/allocate storage
IdentifierType numCells = input->GetNumberOfCells();
IdentifierType numPts = input->GetNumberOfPoints();
if (numPts < 1 || numCells < 1)
{
itkDebugMacro(<< "No data to connect!");
itkDebugMacro("No data to connect!");
return;
}

Expand Down Expand Up @@ -273,7 +273,7 @@ ConnectedRegionsMeshFilter<TInputMesh, TOutputMesh>::GenerateData()
delete m_Wave2;
m_Wave = m_Wave2 = nullptr;

itkDebugMacro(<< "Extracted " << m_RegionNumber << " region(s)");
itkDebugMacro("Extracted " << m_RegionNumber << " region(s)");

// Pass the point and point data through
this->CopyInputMeshToOutputMeshPoints();
Expand Down Expand Up @@ -392,8 +392,8 @@ ConnectedRegionsMeshFilter<TInputMesh, TOutputMesh>::GenerateData()
{
count += regionSize;
}
itkDebugMacro(<< "Total #of cells accounted for: " << count);
itkDebugMacro(<< "Extracted " << output->GetNumberOfCells() << " cells");
itkDebugMacro("Total #of cells accounted for: " << count);
itkDebugMacro("Extracted " << output->GetNumberOfCells() << " cells");
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Mesh/include/itkMesh.hxx
Expand Up @@ -1050,7 +1050,7 @@ Mesh<TPixelType, VDimension, TMeshTraits>::ReleaseCellsMemory()
while (cell != end)
{
const CellType * cellToBeDeleted = cell->Value();
itkDebugMacro(<< "Mesh destructor deleting cell = " << cellToBeDeleted);
itkDebugMacro("Mesh destructor deleting cell = " << cellToBeDeleted);
delete cellToBeDeleted;
++cell;
}
Expand Down
Expand Up @@ -135,7 +135,7 @@ template <typename TInputMesh, typename TOutputImage>
void
TriangleMeshToBinaryImageFilter<TInputMesh, TOutputImage>::GenerateData()
{
itkDebugMacro(<< "TriangleMeshToBinaryImageFilter::Update() called");
itkDebugMacro("TriangleMeshToBinaryImageFilter::Update() called");

// Get the input and output pointers
OutputImagePointer OutputImage = this->GetOutput();
Expand All @@ -155,7 +155,7 @@ TriangleMeshToBinaryImageFilter<TInputMesh, TOutputImage>::GenerateData()
}
else
{
itkDebugMacro(<< "Using info image");
itkDebugMacro("Using info image");
m_InfoImage->Update();
OutputImage->CopyInformation(m_InfoImage);
OutputImage->SetRegions(m_InfoImage->GetLargestPossibleRegion());
Expand All @@ -170,7 +170,7 @@ TriangleMeshToBinaryImageFilter<TInputMesh, TOutputImage>::GenerateData()

RasterizeTriangles();

itkDebugMacro(<< "TriangleMeshToBinaryImageFilter::Update() finished");
itkDebugMacro("TriangleMeshToBinaryImageFilter::Update() finished");
}

template <typename TInputMesh, typename TOutputImage>
Expand Down
Expand Up @@ -265,7 +265,7 @@ SpatialObjectToImageFilter<TInputSpatialObject, TOutputImage>::GenerateData()
{
unsigned int i;

itkDebugMacro(<< "SpatialObjectToImageFilter::Update() called");
itkDebugMacro("SpatialObjectToImageFilter::Update() called");

// Get the input and output pointers
const InputSpatialObjectType * InputObject = this->GetInput();
Expand Down Expand Up @@ -363,7 +363,7 @@ SpatialObjectToImageFilter<TInputSpatialObject, TOutputImage>::GenerateData()
progress.CompletedPixel();
}

itkDebugMacro(<< "SpatialObjectToImageFilter::Update() finished");
itkDebugMacro("SpatialObjectToImageFilter::Update() finished");
} // end update function

template <typename TInputSpatialObject, typename TOutputImage>
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/TestKernel/include/itkRandomImageSource.hxx
Expand Up @@ -213,7 +213,7 @@ template <typename TOutputImage>
void
RandomImageSource<TOutputImage>::DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread)
{
itkDebugMacro(<< "Generating a random image of scalars");
itkDebugMacro("Generating a random image of scalars");


using scalarType = typename TOutputImage::PixelType;
Expand Down
Expand Up @@ -246,7 +246,7 @@ ExtractSliceImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerateData(
const OutputImageRegionType & outputRegionForThread)
{

itkDebugMacro(<< "Actually executing");
itkDebugMacro("Actually executing");

// Get the input and output pointers
const TInputImage * inputPtr = this->GetInput();
Expand Down
Expand Up @@ -53,7 +53,7 @@ template <typename TParametersValueType>
void
CenteredEuler3DTransform<TParametersValueType>::SetParameters(const ParametersType & parameters)
{
itkDebugMacro(<< "Setting parameters " << parameters);
itkDebugMacro("Setting parameters " << parameters);

// Save parameters
if (&parameters != &(this->m_Parameters))
Expand Down Expand Up @@ -84,7 +84,7 @@ CenteredEuler3DTransform<TParametersValueType>::SetParameters(const ParametersTy
// parameters and cannot know if the parameters have changed.
this->Modified();

itkDebugMacro(<< "After setting parameters ");
itkDebugMacro("After setting parameters ");
}

//
Expand Down
Expand Up @@ -39,7 +39,7 @@ template <typename TParametersValueType>
void
CenteredRigid2DTransform<TParametersValueType>::SetParameters(const ParametersType & parameters)
{
itkDebugMacro(<< "Setting parameters " << parameters);
itkDebugMacro("Setting parameters " << parameters);
// Parameters are ordered as:
//
// p[0] = angle
Expand Down Expand Up @@ -81,15 +81,15 @@ CenteredRigid2DTransform<TParametersValueType>::SetParameters(const ParametersTy
// parameters and cannot know if the parameters have changed.
this->Modified();

itkDebugMacro(<< "After setting parameters ");
itkDebugMacro("After setting parameters ");
}


template <typename TParametersValueType>
auto
CenteredRigid2DTransform<TParametersValueType>::GetParameters() const -> const ParametersType &
{
itkDebugMacro(<< "Getting parameters ");
itkDebugMacro("Getting parameters ");
// Parameters are ordered as:
//
// p[0] = angle
Expand All @@ -110,7 +110,7 @@ CenteredRigid2DTransform<TParametersValueType>::GetParameters() const -> const P
this->m_Parameters[j + 1 + SpaceDimension] = this->GetTranslation()[j];
}

itkDebugMacro(<< "After getting parameters " << this->m_Parameters);
itkDebugMacro("After getting parameters " << this->m_Parameters);

return this->m_Parameters;
}
Expand Down
Expand Up @@ -39,7 +39,7 @@ template <typename TParametersValueType>
void
CenteredSimilarity2DTransform<TParametersValueType>::SetParameters(const ParametersType & parameters)
{
itkDebugMacro(<< "Setting parameters " << parameters);
itkDebugMacro("Setting parameters " << parameters);

// Save parameters. Needed for proper operation of TransformUpdateParameters.
if (&parameters != &(this->m_Parameters))
Expand Down Expand Up @@ -78,15 +78,15 @@ CenteredSimilarity2DTransform<TParametersValueType>::SetParameters(const Paramet
// parameters and cannot know if the parameters have changed.
this->Modified();

itkDebugMacro(<< "After setting parameters ");
itkDebugMacro("After setting parameters ");
}


template <typename TParametersValueType>
auto
CenteredSimilarity2DTransform<TParametersValueType>::GetParameters() const -> const ParametersType &
{
itkDebugMacro(<< "Getting parameters ");
itkDebugMacro("Getting parameters ");

this->m_Parameters[0] = this->GetScale();
this->m_Parameters[1] = this->GetAngle();
Expand All @@ -103,7 +103,7 @@ CenteredSimilarity2DTransform<TParametersValueType>::GetParameters() const -> co
this->m_Parameters[i + 4] = translation[i];
}

itkDebugMacro(<< "After getting parameters " << this->m_Parameters);
itkDebugMacro("After getting parameters " << this->m_Parameters);

return this->m_Parameters;
}
Expand Down
Expand Up @@ -78,7 +78,7 @@ template <typename TParametersValueType>
void
ComposeScaleSkewVersor3DTransform<TParametersValueType>::SetParameters(const ParametersType & parameters)
{
itkDebugMacro(<< "Setting parameters " << parameters);
itkDebugMacro("Setting parameters " << parameters);

// Save parameters. Needed for proper operation of TransformUpdateParameters.
if (&parameters != &(this->m_Parameters))
Expand Down Expand Up @@ -110,7 +110,7 @@ ComposeScaleSkewVersor3DTransform<TParametersValueType>::SetParameters(const Par
newVersor.Set(axis);
this->SetVarVersor(newVersor);

itkDebugMacro(<< "Versor is now " << newVersor);
itkDebugMacro("Versor is now " << newVersor);

// Matrix must be defined before translation so that offset can be computed
// from translation
Expand All @@ -136,7 +136,7 @@ ComposeScaleSkewVersor3DTransform<TParametersValueType>::SetParameters(const Par
// parameters and cannot know if the parameters have changed.
this->Modified();

itkDebugMacro(<< "After setting parameters ");
itkDebugMacro("After setting parameters ");
}

//
Expand All @@ -154,7 +154,7 @@ template <typename TParametersValueType>
auto
ComposeScaleSkewVersor3DTransform<TParametersValueType>::GetParameters() const -> const ParametersType &
{
itkDebugMacro(<< "Getting parameters ");
itkDebugMacro("Getting parameters ");

this->m_Parameters[0] = this->GetVersor().GetX();
this->m_Parameters[1] = this->GetVersor().GetY();
Expand All @@ -172,7 +172,7 @@ ComposeScaleSkewVersor3DTransform<TParametersValueType>::GetParameters() const -
this->m_Parameters[10] = this->GetSkew()[1];
this->m_Parameters[11] = this->GetSkew()[2];

itkDebugMacro(<< "After getting parameters " << this->m_Parameters);
itkDebugMacro("After getting parameters " << this->m_Parameters);

return this->m_Parameters;
}
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Transform/include/itkEuler3DTransform.hxx
Expand Up @@ -70,7 +70,7 @@ template <typename TParametersValueType>
void
Euler3DTransform<TParametersValueType>::SetParameters(const ParametersType & parameters)
{
itkDebugMacro(<< "Setting parameters " << parameters);
itkDebugMacro("Setting parameters " << parameters);

// Save parameters. Needed for proper operation of TransformUpdateParameters.
if (&parameters != &(this->m_Parameters))
Expand All @@ -96,7 +96,7 @@ Euler3DTransform<TParametersValueType>::SetParameters(const ParametersType & par
// parameters and cannot know if the parameters have changed.
this->Modified();

itkDebugMacro(<< "After setting parameters ");
itkDebugMacro("After setting parameters ");
}

template <typename TParametersValueType>
Expand Down
8 changes: 4 additions & 4 deletions Modules/Core/Transform/include/itkRigid2DTransform.hxx
Expand Up @@ -223,7 +223,7 @@ template <typename TParametersValueType>
void
Rigid2DTransform<TParametersValueType>::SetParameters(const ParametersType & parameters)
{
itkDebugMacro(<< "Setting parameters " << parameters);
itkDebugMacro("Setting parameters " << parameters);

// Save parameters. Needed for proper operation of TransformUpdateParameters.
if (&parameters != &(this->m_Parameters))
Expand Down Expand Up @@ -251,15 +251,15 @@ Rigid2DTransform<TParametersValueType>::SetParameters(const ParametersType & par
// parameters and cannot know if the parameters have changed.
this->Modified();

itkDebugMacro(<< "After setting parameters ");
itkDebugMacro("After setting parameters ");
}


template <typename TParametersValueType>
auto
Rigid2DTransform<TParametersValueType>::GetParameters() const -> const ParametersType &
{
itkDebugMacro(<< "Getting parameters ");
itkDebugMacro("Getting parameters ");

// Get the angle
this->m_Parameters[0] = this->GetAngle();
Expand All @@ -269,7 +269,7 @@ Rigid2DTransform<TParametersValueType>::GetParameters() const -> const Parameter
this->m_Parameters[i + 1] = this->GetTranslation()[i];
}

itkDebugMacro(<< "After getting parameters " << this->m_Parameters);
itkDebugMacro("After getting parameters " << this->m_Parameters);

return this->m_Parameters;
}
Expand Down

0 comments on commit b52f423

Please sign in to comment.