<commit_before>/*=========================================================================
 *
 *  Copyright RTK Consortium
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0.txt
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 *=========================================================================*/

#ifndef rtkDenoisingBPDQImageFilter_h
#define rtkDenoisingBPDQImageFilter_h

#include "rtkForwardDifferenceGradientImageFilter.h"
#include "rtkBackwardDifferenceDivergenceImageFilter.h"

#include <itkCastImageFilter.h>
#include <itkSubtractImageFilter.h>
#include <itkMultiplyImageFilter.h>
#include <itkInPlaceImageFilter.h>

namespace rtk
{
/** \class DenoisingBPDQImageFilter
 * \brief Base class for Basis Pursuit DeQuantization denoising filters
 *
 * \author <NAME>
 *
 * \ingroup IntensityImageFilters
 */

template< typename TOutputImage, typename TGradientImage>
class DenoisingBPDQImageFilter :
        public itk::InPlaceImageFilter< TOutputImage, TOutputImage >
{
public:

  /** Standard class typedefs. */
  typedef DenoisingBPDQImageFilter                              Self;
  typedef itk::InPlaceImageFilter< TOutputImage, TOutputImage>  Superclass;
  typedef itk::SmartPointer<Self>                               Pointer;
  typedef itk::SmartPointer<const Self>                         ConstPointer;

  /** Method for creation through the object factory. */
  itkNewMacro(Self)

  /** Run-time type information (and related methods). */
  itkTypeMacro(DenoisingBPDQImageFilter, ImageToImageFilter)

  /** Sub filter type definitions */
  typedef ForwardDifferenceGradientImageFilter
            <TOutputImage,
             typename TOutputImage::ValueType,
             typename TOutputImage::ValueType,
             TGradientImage>                                                      GradientFilterType;
  typedef itk::MultiplyImageFilter<TOutputImage>                                  MultiplyFilterType;
  typedef itk::SubtractImageFilter<TOutputImage>                                  SubtractImageFilterType;
  typedef itk::SubtractImageFilter<TGradientImage>                                SubtractGradientFilterType;
  typedef itk::InPlaceImageFilter<TGradientImage>                                 ThresholdFilterType;
  typedef BackwardDifferenceDivergenceImageFilter<TGradientImage, TOutputImage>   DivergenceFilterType;

  itkGetMacro(NumberOfIterations, int)
  itkSetMacro(NumberOfIterations, int)

  itkSetMacro(Gamma, double)
  itkGetMacro(Gamma, double)

protected:
  DenoisingBPDQImageFilter();
  ~DenoisingBPDQImageFilter() ITK_OVERRIDE {}

  void GenerateData() ITK_OVERRIDE;

  void GenerateOutputInformation() ITK_OVERRIDE;

  virtual ThresholdFilterType* GetThresholdFilter(){}

  /** Sub filter pointers */
  typename GradientFilterType::Pointer                  m_GradientFilter;
  typename MultiplyFilterType::Pointer                  m_MultiplyFilter;
  typename SubtractImageFilterType::Pointer             m_SubtractFilter;
  typename SubtractGradientFilterType::Pointer          m_SubtractGradientFilter;
  typename DivergenceFilterType::Pointer                m_DivergenceFilter;

  double m_Gamma;
  double m_Beta;
  double m_MinSpacing;
  int    m_NumberOfIterations;
  bool   m_DimensionsProcessed[TOutputImage::ImageDimension];

private:
  DenoisingBPDQImageFilter(const Self&); //purposely not implemented
  void operator=(const Self&); //purposely not implemented

  virtual void SetPipelineForFirstIteration();
  virtual void SetPipelineAfterFirstIteration();<commit_msg>Fixed warning<commit_after>/*=========================================================================
 *
 *  Copyright RTK Consortium
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0.txt
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 *=========================================================================*/

#ifndef rtkDenoisingBPDQImageFilter_h
#define rtkDenoisingBPDQImageFilter_h

#include "rtkForwardDifferenceGradientImageFilter.h"
#include "rtkBackwardDifferenceDivergenceImageFilter.h"

#include <itkCastImageFilter.h>
#include <itkSubtractImageFilter.h>
#include <itkMultiplyImageFilter.h>
#include <itkInPlaceImageFilter.h>

namespace rtk
{
/** \class DenoisingBPDQImageFilter
 * \brief Base class for Basis Pursuit DeQuantization denoising filters
 *
 * \author <NAME>
 *
 * \ingroup IntensityImageFilters
 */

template< typename TOutputImage, typename TGradientImage>
class DenoisingBPDQImageFilter :
        public itk::InPlaceImageFilter< TOutputImage, TOutputImage >
{
public:

  /** Standard class typedefs. */
  typedef DenoisingBPDQImageFilter                              Self;
  typedef itk::InPlaceImageFilter< TOutputImage, TOutputImage>  Superclass;
  typedef itk::SmartPointer<Self>                               Pointer;
  typedef itk::SmartPointer<const Self>                         ConstPointer;

  /** Method for creation through the object factory. */
  itkNewMacro(Self)

  /** Run-time type information (and related methods). */
  itkTypeMacro(DenoisingBPDQImageFilter, ImageToImageFilter)

  /** Sub filter type definitions */
  typedef ForwardDifferenceGradientImageFilter
            <TOutputImage,
             typename TOutputImage::ValueType,
             typename TOutputImage::ValueType,
             TGradientImage>                                                      GradientFilterType;
  typedef itk::MultiplyImageFilter<TOutputImage>                                  MultiplyFilterType;
  typedef itk::SubtractImageFilter<TOutputImage>                                  SubtractImageFilterType;
  typedef itk::SubtractImageFilter<TGradientImage>                                SubtractGradientFilterType;
  typedef itk::InPlaceImageFilter<TGradientImage>                                 ThresholdFilterType;
  typedef BackwardDifferenceDivergenceImageFilter<TGradientImage, TOutputImage>   DivergenceFilterType;

  itkGetMacro(NumberOfIterations, int)
  itkSetMacro(NumberOfIterations, int)

  itkSetMacro(Gamma, double)
  itkGetMacro(Gamma, double)

protected:
  DenoisingBPDQImageFilter();
  ~DenoisingBPDQImageFilter() ITK_OVERRIDE {}

  void GenerateData() ITK_OVERRIDE;

  void GenerateOutputInformation() ITK_OVERRIDE;

  virtual ThresholdFilterType* GetThresholdFilter(){return ITK_NULLPTR;}

  /** Sub filter pointers */
  typename GradientFilterType::Pointer                  m_GradientFilter;
  typename MultiplyFilterType::Pointer                  m_MultiplyFilter;
  typename SubtractImageFilterType::Pointer             m_SubtractFilter;
  typename SubtractGradientFilterType::Pointer          m_SubtractGradientFilter;
  typename DivergenceFilterType::Pointer                m_DivergenceFilter;

  double m_Gamma;
  double m_Beta;
  double m_MinSpacing;
  int    m_NumberOfIterations;
  bool   m_DimensionsProcessed[TOutputImage::ImageDimension];

private:
  DenoisingBPDQImageFilter(const Self&); //purposely not implemented
  void operator=(const Self&); //purposely not implemented

  virtual void SetPipelineForFirstIteration();
  virtual void SetPipelineAfterFirstIteration();
{'fraction_non_alphanumeric': 0.10255451713395639, 'fraction_numerical': 0.0009968847352024922, 'mean_word_length': 3.5576377058489497, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6418852', 'n_tokens_mistral': 2204, 'n_tokens_neox': 2081, 'n_words': 515}