<commit_before>/*=========================================================================
 *
 *  Copyright Insight Software 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 itkImportImageFilter_hxx
#define itkImportImageFilter_hxx

#include "itkImportImageFilter.h"
#include "itkObjectFactory.h"
#include "itkMath.h"

namespace itk
{
/**
 *
 */
template< typename TPixel, unsigned int VImageDimension >
ImportImageFilter< TPixel, VImageDimension >
::ImportImageFilter()
{
  unsigned int idx;

  for ( idx = 0; idx < VImageDimension; ++idx )
    {
    m_Spacing[idx] = 1.0;
    m_Origin[idx] = 0.0;
    }
  m_Direction.SetIdentity();

  m_Size = 0;
}

/**
 *
 */
template< typename TPixel, unsigned int VImageDimension >
ImportImageFilter< TPixel, VImageDimension >
::~ImportImageFilter()
{
}

/**
 *
 */
template< typename TPixel, unsigned int VImageDimension >
void
ImportImageFilter< TPixel, VImageDimension >
::PrintSelf(std::ostream & os, Indent indent) const
{
  int i;

  Superclass::PrintSelf(os, indent);

  if( m_ImportImageContainer )
    {
      os << indent << "ImportImageContainer pointer: (" << m_ImportImageContainer << ")" << std::endl;
    }
  else
    {
    os << indent << "ImportImageContainer pointer: (None)" << std::endl;
    }
  os << indent << "Import buffer size: " << m_Size << std::endl;
  os << indent << "Import buffer size: " << m_Size << std::endl;
  if( m_ImportImageContainer )
    {
    os << indent << "ImageContainer manages memory: " << ( m_ImportImageContainer->GetContainerManageMemory() ? "true" : "false" ) << std::endl;
    }

  os << indent << "Spacing: [";
  for ( i = 0; i < static_cast< int >( VImageDimension ) - 1; i++ )
    {
    os << m_Spacing[i] << ", ";
    }
  os << m_Spacing[i] << "]" << std::endl;

  os << indent << "Origin: [";
  for ( i = 0; i < static_cast< int >( VImageDimension ) - 1; i++ )
    {
    os << m_Origin[i] << ", ";
    }
  os << m_Origin[i] << "]" << std::endl;
  os << indent << "Direction: " << std::endl << this->GetDirection() << std::endl;
}

/**
 *
 */
template< typename TPixel, unsigned int VImageDimension >
void
ImportImageFilter< TPixel, VImageDimension >
::SetImportPointer(TPixel *ptr, SizeValueType num, bool LetImageContainerManageMemory)
{
  if (!m_ImportImageContainer || ptr != m_ImportImageContainer->GetImportPointer())
    {
    m_ImportImageContainer = ImportImageContainerType::New();
    m_ImportImageContainer->SetImportPointer(ptr,
        m_Size, LetImageContainerManageMemory);
    this->Modified();
    }
  m_Size = num;
}

/**
 *
 */
template< typename TPixel, unsigned int VImageDimension >
TPixel *
ImportImageFilter< TPixel, VImageDimension >
::GetImportPointer()
{
  return m_ImportImageContainer->GetImportPointer();
}

/**
 *<commit_msg>BUG: Correct size specification in ImportImageFilter::SetImportPointer<commit_after>/*=========================================================================
 *
 *  Copyright Insight Software 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 itkImportImageFilter_hxx
#define itkImportImageFilter_hxx

#include "itkImportImageFilter.h"
#include "itkObjectFactory.h"
#include "itkMath.h"

namespace itk
{
/**
 *
 */
template< typename TPixel, unsigned int VImageDimension >
ImportImageFilter< TPixel, VImageDimension >
::ImportImageFilter()
{
  unsigned int idx;

  for ( idx = 0; idx < VImageDimension; ++idx )
    {
    m_Spacing[idx] = 1.0;
    m_Origin[idx] = 0.0;
    }
  m_Direction.SetIdentity();

  m_Size = 0;
}

/**
 *
 */
template< typename TPixel, unsigned int VImageDimension >
ImportImageFilter< TPixel, VImageDimension >
::~ImportImageFilter()
{
}

/**
 *
 */
template< typename TPixel, unsigned int VImageDimension >
void
ImportImageFilter< TPixel, VImageDimension >
::PrintSelf(std::ostream & os, Indent indent) const
{
  int i;

  Superclass::PrintSelf(os, indent);

  if( m_ImportImageContainer )
    {
      os << indent << "ImportImageContainer pointer: (" << m_ImportImageContainer << ")" << std::endl;
    }
  else
    {
    os << indent << "ImportImageContainer pointer: (None)" << std::endl;
    }
  os << indent << "Import buffer size: " << m_Size << std::endl;
  os << indent << "Import buffer size: " << m_Size << std::endl;
  if( m_ImportImageContainer )
    {
    os << indent << "ImageContainer manages memory: " << ( m_ImportImageContainer->GetContainerManageMemory() ? "true" : "false" ) << std::endl;
    }

  os << indent << "Spacing: [";
  for ( i = 0; i < static_cast< int >( VImageDimension ) - 1; i++ )
    {
    os << m_Spacing[i] << ", ";
    }
  os << m_Spacing[i] << "]" << std::endl;

  os << indent << "Origin: [";
  for ( i = 0; i < static_cast< int >( VImageDimension ) - 1; i++ )
    {
    os << m_Origin[i] << ", ";
    }
  os << m_Origin[i] << "]" << std::endl;
  os << indent << "Direction: " << std::endl << this->GetDirection() << std::endl;
}

/**
 *
 */
template< typename TPixel, unsigned int VImageDimension >
void
ImportImageFilter< TPixel, VImageDimension >
::SetImportPointer(TPixel *ptr, SizeValueType num, bool LetImageContainerManageMemory)
{
  if (!m_ImportImageContainer || ptr != m_ImportImageContainer->GetImportPointer() || m_Size != num)
    {
    m_Size = num;
    m_ImportImageContainer = ImportImageContainerType::New();
    m_ImportImageContainer->SetImportPointer(ptr,
        m_Size, LetImageContainerManageMemory);
    this->Modified();
    }
}

/**
 *
 */
template< typename TPixel, unsigned int VImageDimension >
TPixel *
ImportImageFilter< TPixel, VImageDimension >
::GetImportPointer()
{
  return m_ImportImageContainer->GetImportPointer();
}

/**
 *
{'fraction_non_alphanumeric': 0.1766686182669789, 'fraction_numerical': 0.004098360655737705, 'mean_word_length': 4.061481481481482, 'pattern_counts': {'":': 0, '<': 189, '<?xml version=': 0, '>': 39, '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': '6981879', 'n_tokens_mistral': 2122, 'n_tokens_neox': 2089, 'n_words': 549}