<commit_before>/*=========================================================================

Program:   Medical Imaging & Interaction Toolkit
Module:    $RCSfile$
Language:  C++
Date:      $Date: 2007-09-26 18:50:26 +0200 (Mi, 26 Sep 2007) $
Version:   $Revision: 9585 $

Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.

This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the above copyright notices for more information.

=========================================================================*/

#include "itkTotalVariationDenoisingImageFilter.h"
#include "itkTotalVariationSingleIterationImageFilter.h"
#include "itkLocalVariationImageFilter.h"
#include "itkImageRegionIterator.h"

// image typedefs
typedef itk::Image<float, 3> 
ImageType;
typedef itk::ImageRegionIterator<ImageType> 
IteratorType;

// vector image typedefs
typedef itk::Vector<float,2> 
VectorPixelType;
typedef itk::Image<VectorPixelType, 3>
VectorImageType;
typedef itk::ImageRegionIterator<VectorImageType> 
VectorIteratorType;

/**
* 3x3x3 test image
*/
ImageType::Pointer GenerateTestImage()
{
  // init
  ImageType::Pointer image = ImageType::New();;

  // spacing
  ImageType::SpacingType spacing;
  spacing[0] = 1;
  spacing[0] = 1;
  spacing[0] = 1;
  image->SetSpacing(spacing);

  // extent
  ImageType::RegionType largestPossibleRegion;
  ImageType::SizeType size = {{3,3,1}};
  largestPossibleRegion.SetSize( size );
  ImageType::IndexType index = {{0,0,0}};
  largestPossibleRegion.SetIndex( index );
  image->SetLargestPossibleRegion( largestPossibleRegion );
  image->SetBufferedRegion( largestPossibleRegion );

  // allocate memory
  image->Allocate();

  int i=0;
  IteratorType it(image, largestPossibleRegion);
  it.GoToBegin();
  while(!it.IsAtEnd())
  {
    it.Set((float)i++);
    ++it;
  }

  return image;
}

VectorImageType::Pointer GenerateVectorTestImage()
{
  // init
  VectorImageType::Pointer image = VectorImageType::New();;

  // spacing
  VectorImageType::SpacingType spacing;
  spacing[0] = 1;
  spacing[0] = 1;
  spacing[0] = 1;
  image->SetSpacing(spacing);

  // extent
  VectorImageType::RegionType largestPossibleRegion;
  VectorImageType::SizeType size = {{3,3,1}};
  largestPossibleRegion.SetSize( size );
  VectorImageType::IndexType index = {{0,0,0}};<commit_msg>COMP (#2849): Fixed itkTotalVariationDenoisingImageFilterTest.cpp spacing errors<commit_after>/*=========================================================================

Program:   Medical Imaging & Interaction Toolkit
Module:    $RCSfile$
Language:  C++
Date:      $Date: 2007-09-26 18:50:26 +0200 (Mi, 26 Sep 2007) $
Version:   $Revision: 9585 $

Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.

This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the above copyright notices for more information.

=========================================================================*/

#include "itkTotalVariationDenoisingImageFilter.h"
#include "itkTotalVariationSingleIterationImageFilter.h"
#include "itkLocalVariationImageFilter.h"
#include "itkImageRegionIterator.h"

// image typedefs
typedef itk::Image<float, 3> 
ImageType;
typedef itk::ImageRegionIterator<ImageType> 
IteratorType;

// vector image typedefs
typedef itk::Vector<float,2> 
VectorPixelType;
typedef itk::Image<VectorPixelType, 3>
VectorImageType;
typedef itk::ImageRegionIterator<VectorImageType> 
VectorIteratorType;

/**
* 3x3x3 test image
*/
ImageType::Pointer GenerateTestImage()
{
  // init
  ImageType::Pointer image = ImageType::New();;

  // spacing
  ImageType::SpacingType spacing;
  spacing[0] = 1;
  spacing[1] = 1;
  spacing[2] = 1;
  image->SetSpacing(spacing);

  // extent
  ImageType::RegionType largestPossibleRegion;
  ImageType::SizeType size = {{3,3,1}};
  largestPossibleRegion.SetSize( size );
  ImageType::IndexType index = {{0,0,0}};
  largestPossibleRegion.SetIndex( index );
  image->SetLargestPossibleRegion( largestPossibleRegion );
  image->SetBufferedRegion( largestPossibleRegion );

  // allocate memory
  image->Allocate();

  int i=0;
  IteratorType it(image, largestPossibleRegion);
  it.GoToBegin();
  while(!it.IsAtEnd())
  {
    it.Set((float)i++);
    ++it;
  }

  return image;
}

VectorImageType::Pointer GenerateVectorTestImage()
{
  // init
  VectorImageType::Pointer image = VectorImageType::New();;

  // spacing
  VectorImageType::SpacingType spacing;
  spacing[0] = 1;
  spacing[1] = 1;
  spacing[2] = 1;
  image->SetSpacing(spacing);

  // extent
  VectorImageType::RegionType largestPossibleRegion;
  VectorImageType::SizeType size = {{3,3,1}};
  largestPossibleRegion.SetSize( size );
  VectorImageType::IndexType index = {{0,0,0}};
{'fraction_non_alphanumeric': 0.17127722189523248, 'fraction_numerical': 0.023935648420639593, 'mean_word_length': 5.578064516129032, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5830726', 'n_tokens_mistral': 1702, 'n_tokens_neox': 1529, 'n_words': 360}