<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Change SYSTEM "http://itk.org/migrationv4/ITKMigration.dtd">

<!--**
**
** BoundaryConditionsHaveOutputImageType.xml
**
** >>>>>>>>>>>>>>>>>>>>>>>>>>>>
** THIS FILE HAS BEEN AUTOMATICALLY GENERATED. EDIT IT BEFORE COMMITING
** <<<<<<<<<<<<<<<<<<<<<<<<<<<
**
** Please, make sure this file validates the following w3c test before committing it: http://validator.w3.org
**-->
<Change>
    <!--**
    ** Title for the online migration page
    **-->
    <Title>
      Boundary Conditions Have Output Image Type
    </Title>

    <!--**
    ** The author of the change
    **-->
    <Author>
      Cory Quammen
    </Author>

    <!--**
    ** Date of creation for the XML document
    **-->
    <Date>
      2011-11-08
    </Date>

    <!--**
    ** Plain text description of the change
    ** Extracted from git commit messages
    **-->
    <Description>
      <![CDATA[
      Added output image template parameter to boundary conditions
      The boundary conditions were templated only over the type of image
      for which they provided values. This change adds a template
      parameter specifying an output image type to which the values
      retrieved from the boundary condition will be stored. The pixel
      accessor methods in the boundary conditions now return the pixel type
      of this output image rather than the pixel type of the input image.
      This solves some compilation problems when the input and output image
      types are different in PadImageFilter and its subclasses.

      Customized subclasses should compile against the new changes without
      problems because the output image type is set to be the input image
      type, so all methods that return pixel values will work. However, it
      is recommended that the output types of overridden methods should be
      renamed to OutputPixelType and the template signature of the subclass
      should be modified to include the output image type.
      ]]>
    </Description>

    <!--**
    ** Sample code snippets
    ** Extracted from git diff of changed files in Examples and Testing
    **-->
    <SampleCode>
      <Old>
        <![CDATA[
template< class TInputImage >
class BoundaryConditionSubclass :
  public ImageBoundaryCondition< TInputImage > {
  ...
  typedef typename Superclass::PixelType        PixelType;
  typedef typename Superclass::PixelPointerType PixelPointerType;

  /** Computes and returns appropriate out-of-bounds values from
   * neighborhood iterator data. */
  virtual PixelType operator()(const OffsetType &,
                               const OffsetType &,
                               const NeighborhoodType *) const;

  /** Computes and returns the appropriate pixel value from
   * neighborhood iterator data, using the functor. */
  virtual PixelType operator()(
    const OffsetType &,
    const OffsetType &,
    const NeighborhoodType *,
    const NeighborhoodAccessorFunctorType &) const;

  /** Returns a value for a given pixel at an index. If the index is inside the
   * bounds of the input image, then the pixel value is obtained from
   * the input image. Otherwise, the constant value is returned.
   *
   * \param index The index of the desired pixel.
   * \param image The image from which pixel values should be determined.
   */
  PixelType GetPixel( const IndexType & index, const TInputImage * image ) const;
  ...
};
        ]]>
      </Old>

      <New>
        <![CDATA[
template< class TInputImage, class TOutputImage = TInputImage >
class BoundaryConditionSubclass :
  public ImageBoundaryCondition< TInputImage, TOutputImage >
  ...
  typedef typename Superclass::PixelType        PixelType;
  typedef typename Superclass::PixelPointerType PixelPointerType;
  typedef typename Superclass::OutputPixelType  OutputPixelType;

  /** Computes and returns appropriate out-of-bounds values from
   * neighborhood iterator data. */
  virtual OutputPixelType operator()(const OffsetType &,
                                     const OffsetType &,
                                     const NeighborhoodType *) const;

  /** Computes and returns the appropriate pixel value from
   * neighborhood iterator data, using the functor. */
  virtual OutputPixelType operator()(
    const OffsetType &,
    const OffsetType &,
    const NeighborhoodType *,
    const NeighborhoodAccessorFunctorType &) const;

  /** Returns a value for a given pixel at an index. If the index is inside the
   * bounds of the input image, then the pixel value is obtained from
   * the input image. Otherwise, the constant value is returned.
   *
   * \param index The index of the desired pixel.
   * \param image The image from which pixel values should be determined.
   */
  OutputPixelType GetPixel( const IndexType & index, const TInputImage * image ) const;
  ...
};
        ]]>
      </New>

    </SampleCode>

    <!--**
    ** The change-ids for all commits in the topic branch
    **-->
    <Gerrit-ChangeId>
      I0192e62cc1677fa5d7158101f440d02d5d7e8137
    </Gerrit-ChangeId>

    <!--**
    ** List of all changed files from the topic branch
    **-->
    <FileList>
      Modules/Core/Common/include/itkConstantBoundaryCondition.h
      Modules/Core/Common/include/itkConstantBoundaryCondition.hxx
      Modules/Core/Common/include/itkImageBoundaryCondition.h
      Modules/Core/Common/include/itkPeriodicBoundaryCondition.h
      Modules/Core/Common/include/itkPeriodicBoundaryCondition.hxx
      Modules/Core/Common/include/itkZeroFluxNeumannBoundaryCondition.h
      Modules/Core/Common/include/itkZeroFluxNeumannBoundaryCondition.hxx
      Modules/Filtering/ImageGrid/include/itkConstantPadImageFilter.h
      Modules/Filtering/ImageGrid/include/itkPadImageFilter.h
      Modules/Filtering/ImageGrid/include/itkWrapPadImageFilter.h
      Modules/Filtering/ImageGrid/include/itkZeroFluxNeumannPadImageFilter.h
      Modules/Filtering/ImageGrid/test/itkConstantPadImageTest.cxx
      Modules/Filtering/ImageGrid/test/itkWrapPadImageTest.cxx
      Modules/Filtering/ImageGrid/test/itkZeroFluxNeumannPadImageFilterTest.cxx
    </FileList>

    <!--**
    ** If the migration can be accomplished by a simple string
    ** substitution, then use the following construct to define
    ** the substitution rule.
    **
    ** <MigrationFix-Automatic>
    **   <Old>
    **     <![CDATA[MipsleledName]]>
    **   </Old>
    **   <New>
    **     <![CDATA[MisspelledName]]>
    **   </New>
    ** </MigrationFix-Automatic>
    **-->

    <!--**
    ** If the migration can NOT be accomplished by a simple string
    ** substitution, but potential problem spots can be identified,
    ** use the following construct to define a migration flag rule.
    **
    ** <MigrationFix-Manual>
    **   OldFunctionName
    ** </MigrationFix-Manual>
    **-->

</Change>
