Significant changes to the RNiftyReg package are laid out below for each release.

=================================================================================

VERSION 2.8.5

- Calling saveTransform() with one argument now returns the serialised transform
  object, as intended, rather than producing an error.
- Comparisons between floating-point and enumeration types are now avoided when
  using the C++20 or later standard for compilation, since this now leads to a
  warning. (Reported by BDR.)
- The "Upgrading to RNiftyReg 2.x" section of the README has been removed, since
  the 2.x line of releases is now over 10 years old(!).

=================================================================================

VERSION 2.8.4

- The logic for reading FSL-FLIRT transforms from file previously overlooked a
  quirk whereby FLIRT flips images whose xforms have positive determinant (see,
  for example, https://neurostars.org/t/understanding-fsl-flirt-transformation-matrices/26406).
  This could result in a spurious flip when these transforms were applied, if the
  originally registered images were in, say, LAS and RAS orientations. This
  detail is now handled when FLIRT transforms are imported. (Reported by Martin
  Wilson.)
- Affine initialisation matrices for linear registration would previously be
  replaced by a default internally. This has been corrected.
- Default affine initialisation matrices now take the pixel/voxel dimensions into
  account when image "sform" and "qform" codes are both zero.
- The package's dependency on the "ore" package has been removed, with base R
  regular expression functions being used instead.

=================================================================================

VERSION 2.8.3

- A NiftyReg class method referencing a nonexistent data member has been removed.
  (Picked up by LLVM pre-19, reported by BDR.)

=================================================================================

VERSION 2.8.2

- Objects of class "niftyregRDS" gain a simple asAffine() method for convenience.
- The code should now ensure that an affine result from loadTransform() has the
  "affine" class.
- An incorrect internal assignment has been corrected.

=================================================================================

VERSION 2.8.1

- Package tests now write files to the R session's temporary directory to avoid
  problems on CRAN.

=================================================================================

VERSION 2.8.0

- The saveTransform() and loadTransform() functions now also work with nonlinear
  transforms, and saveTransform() can return the serialised transform rather than
  writing it to file.
- asAffine() is now generic, with methods for various classes including
  "niftiImage". This method now exposes, for the first time, the affine
  transforms that NiftyReg stores as NIfTI extensions within nonlinear
  transforms.
- Affine matrix elements are now rounded to six decimal places for printing.
- The package now uses tinytest rather than testthat for unit testing.

=================================================================================

VERSION 2.7.1

- A note is now emitted when converting a "niftyreg" object resulting from a
  nonlinear registration to an array or "niftiImage" (implicitly or explicitly).
  This clarifies that the transformed image, not the control point image, will be
  converted, as there is some ambiguity in this case. (Raised by issue #22.)
- A number of warnings from modern compilers have been addressed.

=================================================================================

VERSION 2.7.0

- New functions saveTransform() and loadTransform() allow a linear transform to
  be serialised, complete with source and target image metadata, into a single
  compact RDS file. This does not yet work with nonlinear transforms, because
  of their more complex metadata. (Suggested by Yves Rozenholc and Christine
  Keribin.)
- There is now an asNifti() method for "niftyreg" objects, for use with RNifti
  version 1.2.0 and above. This allows, for example, writeNifti() to be called
  directly on the result of a registration. (Suggested by @charleswg, issue
  #10.)

=================================================================================

VERSION 2.6.8

- Mask images without a valid "qform" would lead to inaccurate resampling and
  hence spurious errors. This has been corrected. (Reported by @christmanjc,
  issue #9.)

=================================================================================

VERSION 2.6.7

- It is once again possible to interrupt linear registrations. The relevant code
  had been accidentally removed during an upstream update. (Reported by Mark
  Padgham, issue #8.)
- A C++ bug picked up valgrind has been fixed. This could lead to erroneous
  initialisation (or possibly even a crash) when searching a deformation field,
  if "nearest=TRUE" had been specified.

=================================================================================

VERSION 2.6.6

- This update makes a minor change to the package directory structure to satisfy
  current CRAN requirements.

=================================================================================

VERSION 2.6.5

- The core registration functions gain an argument to control the maximum number
  of OpenMP threads to use, where applicable. The default is determined by the
  "RNiftyReg.threads" option, which is now set during testing to comply with
  CRAN's multithreading requirements.

=================================================================================

VERSION 2.6.4

- The algorithm for searching a deformation field is now more careful to avoid a
  potentially infinite loop.

=================================================================================

VERSION 2.6.3

- The package now checks at load time whether it was built against a version of
  the RNifti package which is compatible with the currently installed one, and
  raises a warning prompting reinstallation if not.

=================================================================================

VERSION 2.6.2

- Searching a deformation field is now done with gradient descent, rather than
  exhaustively. This makes applyTransform() substantially faster when applying a
  nonlinear transform to points.

=================================================================================

VERSION 2.6.1

- The target image for a half transform now has its xform modified to better
  represent a half-way space between the original source and target.
- The package now uses a configure script to more robustly detect OpenMP support.

=================================================================================

VERSION 2.6.0

- New convenience functions translate(), rescale(), skew() and rotate() can be
  used to apply simple transformations to images easily.
- The niftyreg() group of functions gain a "precision" argument, which controls
  the working precision of the optimisation.
- A single angle supplied to buildAffine() with a 2D source file will now be
  interpreted in the way that would usually be expected (i.e., equivalent to a
  yaw angle).
- Compositions of two affine transformations appear to have been happening in the
  wrong order. This has been corrected.
- ANALYZE-format files, whose orientation is intrinsically ambiguous, are now
  assumed to be use LAS storage order (with a warning).
- The registration functions will no longer modify the low-level C structures
  attributed to their arguments.
- The "loder" package is now used in preference to "png".

=================================================================================

VERSION 2.5.0

- RNiftyReg can now register 2D multichannel (RGB or RGBA) images. The red, green
  and blue channels are averaged internally before applying the algorithm.
  Previously such images would produce an error or segfault. (Reported by John
  Muschelli, issue #4.)
- The decomposeAffine() function now uses a Cholesky decomposition internally.
  (Hat-tip to Tim Tierney.)
- The "nBins" argument to niftyreg.nonlinear() was not previously passed to the
  NiftyReg library. This has been corrected.
- Applying a scale transform to a new image with applyTransform() should no
  longer produce a warning. (Reported by Tim Tierney.)
- The NiftyReg library has been updated.

=================================================================================

VERSION 2.4.1

- The package has been updated for compatibility with "RNifti" version 0.3.0.

=================================================================================

VERSION 2.4.0

- The package's functions for working with NIfTI-1 files and associated image
  data structures have been moved into the new "RNifti" package, since they are
  useful more broadly. RNiftyReg is therefore more focussed on registration.
- The "internal" argument to niftyreg(), and its linear and nonlinear variants,
  can now be set to avoid creating any internal images in the result. This should
  only be necessary in exceptional circumstances, and the default behaviour
  remains as before.

=================================================================================

VERSION 2.3.0

- The new similarity() function can be used to calculate a metric of similarity
  between two images (currently only normalised mutual information). This should
  not decrease after registration!
- The composeTransforms() function now accepts more than two arguments, and
  handles NULL arguments (corresponding to no transform).
- The package can now work with "MriImage" objects (from package "tractor.base").
- It is now possible to interrupt the main registration functions.
- The pixdim() and pixunits() functions are now (S3) generic.
- The C++ code underlying the updateNifti() function could sometimes produce
  spurious errors about missing strings, when passed a list. This has been
  corrected. (Reported by Tim Tierney.)

=================================================================================

VERSION 2.2.0

- The new asAffine() function can be used to coerce a numeric matrix to the
  "affine" class.
- The updateNifti() function now accepts a named list of header elements, of
  the sort generated by dumpNifti(), as its second argument. This allows
  elements of the image's internal metadata to be updated manually, for
  advanced users.
- It is now possible to disable the comment lines usually produced by
  writeAffine().
- The niftyreg() function, and the two more specialised functions, gain an
  "internal" argument, which results in an internal image as output.
- There is now a replacement method for pixunits().
- The result of calling dumpNifti() now has a class and a print() method.
- Elements of the "scales" argument to buildAffine() may now be negative.
- Setting xforms would not work if the image did not already contain a
  valid internal pointer attribute. This has been corrected.
- An incompatibility with C++11 has been fixed.

=================================================================================

VERSION 2.1.0

- New functions for replacing an image's sform and qform matrices have been
  added. These are for advanced use only.
- Some tests are skipped on Solaris, to avoid failures which have been hard to
  reproduce.

=================================================================================

VERSION 2.0.1

- Fixes for Solaris compilation and UBSAN issues.

=================================================================================

VERSION 2.0.0

- This is a more-or-less complete rewrite of the package, with the goals of
  simplifying both the package's dependencies and its usage. The upstream
  NiftyReg code has also been updated. However, it should still be possible to
  read and use transformations created using RNiftyReg 1.x.
- The oro.nifti package is no longer needed, nor used for reading and writing
  NIfTI files (RNiftyReg now offers readNifti() and writeNifti(), which are much
  faster). However, objects of S4 class "nifti" can still be used with the
  package if desired. Functions return either plain R arrays with attributes, or
  bare-bones "internalImage" objects, which contain only some basic metadata and
  a pointer to a C-level data structure.
- There are new functions for halving a transform (halfTransform), composing two
  transforms (composeTransforms), and building an affine transform from scratch
  (buildAffine).
- Registration is now symmetric by default (for both linear and nonlinear), a
  newer symmetric nonlinear approach is now used, and default cost function
  weights have been tweaked. Therefore, the arguments to the core niftyreg()
  function, and its linear and nonlinear special cases, have changed in both name
  and defaults. See ?niftyreg and related help pages for details.
- It is no longer necessary to use functions specific to transform type to
  perform many operations. For example, the work of the old applyAffine(),
  applyControlPoints(), transformWithAffine() and transformWithControlPoints()
  functions is done by the flexible new applyTransform() function. The forward
  and reverse transforms can always be obtained from a registration using the new
  forward() and reverse() functions, no matter what their type is. However, some
  affine-only functions, such as decomposeAffine(), retain their names.
- The "affineType" attribute has gone, and convertAffine() is no longer a
  user-visible function. All affine matrices are stored using the NiftyReg
  convention. FSL-FLIRT affines can still be read in, but they are converted to
  NiftyReg convention immediately. In addition, source and target image
  information is attached to the transforms in attributes, and so does not need
  to be specified in most function calls.
- Many smaller changes. The newly updated README file should be used as the main
  reference point for usage, supplemented by the R-level function documentation.

=================================================================================

VERSION 1.1.4

- The package was not consistent about how to treat images without NIfTI
  orientation information, and this could lead to erroneous results when
  transforming points between spaces using an affine matrix. This has been
  corrected. (Reported by Jiří Borovec.)

=================================================================================

VERSION 1.1.3

- The C++ code is now more careful to avoid buffer overruns when text fields in
  a "nifti" object are too long.

=================================================================================

VERSION 1.1.2

- Some sample data has been added to the package, along with some code examples.
- Code tweaks have been made for C++11 compatibility.

=================================================================================

VERSION 1.1.1

- Under certain circumstances the NiftyReg C++ code could create a control point
  image corresponding to an invalid "nifti" object, resulting in a spurious
  error when running niftyreg.nonlinear(). This has been corrected. (Reported by
  Andreas Heindl.)

=================================================================================

VERSION 1.1.0

- A set of functions has been added for transforming points between spaces using
  an affine or nonlinear transformation.
- All registration functions gain an "estimateOnly" option, which can be used to
  estimate a transformation without actually resampling the image.
- The new getDeformationField() function can be used to obtain the deformation
  field and/or Jacobian determinant map corresponding to a transformation.
- The invertAffine() function has been added to invert an affine matrix while
  preserving its "affineType" attribute.
- RNiftyReg will now use OpenMP, if supported by the current build of R.
- Image arguments are now coerced automatically to the "nifti" class if they are
  not already of this type.
- Image data is no longer copied between data structure types when not needed,
  saving a bit of time and memory.
- It is no longer an error in readAffine() if the affine type is not specified
  or stored.

=================================================================================

VERSION 1.0.2

- A further compiler-sensitive problem, which was causing the package to fail to
  install using Solaris Studio, has been addressed.

=================================================================================

VERSION 1.0.1

- A Windows-specific compile-time problem has been addressed.

=================================================================================

VERSION 1.0.0

- RNiftyReg now provides an interface to the symmetric version of the NiftyReg
  nonlinear registration algorithm. This allows consistent transformations to be
  obtained in both directions, in one operation.
- The upstream code has been updated to match NiftyReg v1.3.9. Default cost
  function weightings have also been tweaked to match those used in that release.
- The type of an affine matrix is now written to file with it. The type therefore
  does not necessarily need to be specified when reading the matrix back in.
- The "interpolationPrecision" option has been removed where it appeared. The
  code now simply makes an appropriate choice in each case.
- Internal calculation of the final control point spacing from an initial control
  point image was sometimes wrong. This has been corrected.

=================================================================================

VERSION 0.6.2

- Nonlinear registration now works properly for 2D target images.
- Control point spacing is now set from the initial control point image (as it
  should be), if one is supplied.
- Two small bugs in the upstream NiftyReg code have been fixed.
- Attempting to perform 4D-to-2D registration now produces a more specific
  error message.

=================================================================================

VERSION 0.6.1

- The package now redefines standard C print functions to avoid problems with
  output not being captured by R.

=================================================================================

VERSION 0.6.0

- RNiftyReg can now perform nonlinear registration via the niftyreg.nonlinear()
  function. This method optimises over a set of moveable control points arranged
  in a grid over the image. The applyControlPoints() function has also been
  added as the nonlinear equivalent of applyAffine(). See ?niftyreg.nonlinear
  for details on these new functions. The niftyreg() function now serves as a
  common interface to both the linear and nonlinear optimisations.
- The "initAffine" argument to niftyreg() now accepts a list of matrices as well
  as a single affine matrix.
- The upstream NiftyReg code has been updated, thereby taking in a number of
  tweaks added since the last release version.
- A bug in the quaternion-to-matrix conversion in xformToAffine() has been fixed.

=================================================================================

VERSION 0.5.0

- The niftyreg() and applyAffine() functions gain an "interpolationPrecision"
  argument, which affects the data type of the final image. See ?niftyreg for
  details.
- The actual number of algorithm iterations run at each level is now stored in
  the output produced by niftyreg().
- A bug has been addressed whereby niftyreg() returned the affine matrix used
  for initialisation, if specified, rather than the final one. (Reported by
  Brandon Whitcher.)
- The first level of the algorithm is supposed to include both a rigid-body and
  affine optimisation, but the latter was previously omitted due to a bug. This
  has been corrected. In addition, the first level is allowed twice as many
  iterations as subsequent levels, as in the original NiftyReg implementation.
- The "data_type" slot of the "nifti" class is now properly set in the image
  returned by niftyreg().
- The underlying NIfTI reference library files have been updated.
- Spurious parameters have been removed to avoid warnings at compile time.
- Calls to problematic C/C++ functions such as exit() have been avoided
  (although NIfTI and NiftyReg library functions still use printf() and the 
  like).

=================================================================================

VERSION 0.4.1

- The reportr package is now properly imported in the namespace file.

=================================================================================

VERSION 0.4.0

- The applyAffine() function has been added as a convenience wrapper to
  niftyreg(...,nLevels=0), for applying a precomputed affine transformation to
  a new image without further optimisation.
- RNiftyReg now uses the reportr package for message and error reporting.
- The package now has a formal namespace.

=================================================================================

VERSION 0.3.1

- A bug in previous releases affecting the downsampling of images during early
  "levels" of alignment has been fixed. Coregistration of larger images, in
  particular, should be improved as a result.

=================================================================================

VERSION 0.3.0

- 2D-to-2D, 3D-to-2D and 4D-to-3D registration are now supported by niftyreg().
  As a result of this added flexibility, a list of affine matrices, rather than
  a single matrix, is now returned by this function.
- An image of fewer than 4 pixels/voxels in any dimension cannot be registered
  since it cannot accommodate a single matching block. Providing such an image
  as the source or target now produces an error rather than a crash. (Thanks to
  Takeo Katsuki for pointing this out.)
- Further documentation improvements.

=================================================================================

VERSION 0.2.0

- Added an option to niftyreg() to control the type of interpolation that is
  applied to the final coregistered image.
- Performing better type checking of image data before passing it to the C++
  code, to avoid intermittent errors from R.
- Documentation improvements.

=================================================================================

VERSION 0.1.0

- First public release. 3D affine and rigid-body registration are available.

=================================================================================
