Skip to content

Commit

Permalink
STYLE: Prefer double forward slashes for within-method body comments
Browse files Browse the repository at this point in the history
Prefer double forward slashes for within-method body comment blocks
following the ITK SWG coding style guidelines.

Reword the comments as appropriate to improve grammar.

Follow-up to commit be6b447.
  • Loading branch information
jhlegarreta committed Sep 6, 2023
1 parent 309a053 commit 8d3df52
Showing 1 changed file with 27 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ template <typename TInputImage, typename TClassifiedImage>
void
RGBGibbsPriorFilter<TInputImage, TClassifiedImage>::Allocate()
{
/* Get the image width/height and depth. */
// Get the image width/height and depth.
InputImageSizeType inputImageSize = m_InputImage->GetBufferedRegion().GetSize();

m_ImageWidth = inputImageSize[0];
Expand Down Expand Up @@ -119,7 +119,7 @@ RGBGibbsPriorFilter<TInputImage, TClassifiedImage>::GreyScalarBoundary(LabelledI
sign = 0;
}

/* Compute the minimum points of piecewise smoothness */
// Compute the minimum points of piecewise smoothness.
m_LowPoint[rgb] = origin;
change = 1;
x = origin;
Expand Down Expand Up @@ -361,7 +361,7 @@ RGBGibbsPriorFilter<TInputImage, TClassifiedImage>::GibbsEnergy(unsigned int i,
f[neighborcount++] = static_cast<LabelType>(m_LabelledImage->GetPixel(offsetIndex3D));
}

/* Pixels at the edge of image will be dropped. */
// Pixels at the edge of image will be dropped.
if (neighborcount != 8)
{
return 0.0;
Expand All @@ -378,8 +378,7 @@ RGBGibbsPriorFilter<TInputImage, TClassifiedImage>::GibbsEnergy(unsigned int i,

changeflag = (f[0] == labelledPixel);

/* Assuming we are segmenting objects with smooth boundaries, we give
* weight to local characteristics */
// Assuming we are segmenting objects with smooth boundaries, we give weight to local characteristics.
for (j = 0; j < 8; ++j)
{
if ((f[j] == labelledPixel) != changeflag)
Expand Down Expand Up @@ -424,31 +423,30 @@ template <typename TInputImage, typename TClassifiedImage>
void
RGBGibbsPriorFilter<TInputImage, TClassifiedImage>::GenerateData()
{
/* First run the Gaussian classifier calculator and
* generate the Gaussian model for the different classes.
* Then generate the initial labelled dataset.*/
// First run the Gaussian classifier calculator and generate the Gaussian model for the different classes. Then
// generate the initial labelled dataset.

m_InputImage = this->GetInput();
m_VecDim = InputPixelType::GetVectorDimension();

GenerateMediumImage();

/* Pass the input image and training image set to the
* classifier. For the first iteration, use the original image.
* In the following loops, you can use the result provided by a segmentation
* method such as the deformable model. */
// Pass the input image and training image set to the classifier. For the first iteration, use the original image.
// In the following loops, you can use the result provided by a segmentation method such as the deformable model.
m_ClassifierPtr->SetInputImage(m_InputImage);
/* Create the training image using the original image or the output
* of a segmentation method such as the deformable model. */
// m_ClassifierPtr->SetTrainingImage( m_TrainingImage );

/* Run the Gaussian classifier algorithm. */
// Create the training image using the original image or the output of a segmentation method such as the deformable
// model
// m_ClassifierPtr->SetTrainingImage( m_TrainingImage );

// Run the Gaussian classifier algorithm.
m_ClassifierPtr->Update();

SetLabelledImage(m_ClassifierPtr->GetClassifiedImage());

ApplyGPImageFilter();
/* Set the output labelled image and allocate the memory. */

// Set the output labelled image and allocate the memory.
LabelledImageType outputPtr = this->GetOutput();

if (m_RecursiveNumber == 0)
Expand All @@ -457,14 +455,13 @@ RGBGibbsPriorFilter<TInputImage, TClassifiedImage>::GenerateData()
outputPtr->SetBufferedRegion(m_InputImage->GetLargestPossibleRegion());
}

/* Allocate the output buffer memory. */
// Allocate the output buffer memory.
outputPtr->Allocate();

/* Copy labelled result to the Output buffer and set the iterators of
* the processed image. */
// Copy labelled result to the output buffer and set the iterators of the processed image.
LabelledImageRegionIterator labelledImageIt(m_LabelledImage, m_LabelledImage->GetBufferedRegion());

/* Set the iterators of the output image buffer. */
// Set the iterators of the output image buffer.
LabelledImageRegionIterator outImageIt(outputPtr, outputPtr->GetBufferedRegion());

while (!outImageIt.IsAtEnd())
Expand All @@ -482,15 +479,15 @@ template <typename TInputImage, typename TClassifiedImage>
void
RGBGibbsPriorFilter<TInputImage, TClassifiedImage>::ApplyGPImageFilter()
{
/* Minimize f_1 and f_3. */
// Minimize f_1 and f_3.
MinimizeFunctional();
}

template <typename TInputImage, typename TClassifiedImage>
void
RGBGibbsPriorFilter<TInputImage, TClassifiedImage>::MinimizeFunctional()
{
/* This implementation uses the SA algorithm. */
// This implementation uses the SA algorithm.

ApplyGibbsLabeller();

Expand All @@ -509,7 +506,7 @@ RGBGibbsPriorFilter<TInputImage, TClassifiedImage>::MinimizeFunctional()
if ((randomPixel > (rowsize - 1)) && (randomPixel < (size - rowsize)) && (randomPixel % rowsize != 0) &&
(randomPixel % rowsize != rowsize - 1))
{
GibbsTotalEnergy(randomPixel); // minimized f_2;
GibbsTotalEnergy(randomPixel); // minimize f_2
}
++m_Temp;
}
Expand All @@ -520,23 +517,22 @@ template <typename TInputImage, typename TClassifiedImage>
void
RGBGibbsPriorFilter<TInputImage, TClassifiedImage>::ApplyGibbsLabeller()
{
/* Set the iterators and the pixel type definition for the input image. */
// Set the iterators and the pixel type definition for the input image.
InputImageRegionConstIterator inputImageIt(m_InputImage, m_InputImage->GetBufferedRegion());

InputImageRegionIterator mediumImageIt(m_MediumImage, m_MediumImage->GetBufferedRegion());

/* Set the iterators and the pixel type definition for the classified image.
*/
// Set the iterators and the pixel type definition for the classified image.
LabelledImageRegionIterator labelledImageIt(m_LabelledImage, m_LabelledImage->GetBufferedRegion());

/* Variable to store the origin pixel vector value. */
// Variable to store the origin pixel vector value.
InputImagePixelType originPixelVec;

/* Variable to store the modified pixel vector value. */
// Variable to store the modified pixel vector value.
InputImagePixelType changedPixelVec;
changedPixelVec.Fill(NumericTraits<typename InputImagePixelType::ValueType>::ZeroValue());

/* Set a variable to store the offset index. */
// Set a variable to store the offset index.
LabelledImageIndexType offsetIndex3D;
offsetIndex3D.Fill(0);

Expand All @@ -563,7 +559,7 @@ RGBGibbsPriorFilter<TInputImage, TClassifiedImage>::ApplyGibbsLabeller()
{
changedPixelVec[rgb] = m_LowPoint[rgb];
}
/* mediumImageIt.Set(changedPixelVec); */
// mediumImageIt.Set(changedPixelVec);
}
else
{
Expand Down

0 comments on commit 8d3df52

Please sign in to comment.