diff --git a/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkRGBGibbsPriorFilter.hxx b/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkRGBGibbsPriorFilter.hxx index da5fbb513d1..eefca35d0c5 100644 --- a/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkRGBGibbsPriorFilter.hxx +++ b/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkRGBGibbsPriorFilter.hxx @@ -68,7 +68,7 @@ template void RGBGibbsPriorFilter::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]; @@ -119,7 +119,7 @@ RGBGibbsPriorFilter::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; @@ -361,7 +361,7 @@ RGBGibbsPriorFilter::GibbsEnergy(unsigned int i, f[neighborcount++] = static_cast(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; @@ -378,8 +378,7 @@ RGBGibbsPriorFilter::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) @@ -424,31 +423,30 @@ template void RGBGibbsPriorFilter::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) @@ -457,14 +455,13 @@ RGBGibbsPriorFilter::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()) @@ -482,7 +479,7 @@ template void RGBGibbsPriorFilter::ApplyGPImageFilter() { - /* Minimize f_1 and f_3. */ + // Minimize f_1 and f_3. MinimizeFunctional(); } @@ -490,7 +487,7 @@ template void RGBGibbsPriorFilter::MinimizeFunctional() { - /* This implementation uses the SA algorithm. */ + // This implementation uses the SA algorithm. ApplyGibbsLabeller(); @@ -509,7 +506,7 @@ RGBGibbsPriorFilter::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; } @@ -520,23 +517,22 @@ template void RGBGibbsPriorFilter::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::ZeroValue()); - /* Set a variable to store the offset index. */ + // Set a variable to store the offset index. LabelledImageIndexType offsetIndex3D; offsetIndex3D.Fill(0); @@ -563,7 +559,7 @@ RGBGibbsPriorFilter::ApplyGibbsLabeller() { changedPixelVec[rgb] = m_LowPoint[rgb]; } - /* mediumImageIt.Set(changedPixelVec); */ + // mediumImageIt.Set(changedPixelVec); } else {