Skip to content

Commit

Permalink
BUG: Move convergence monitoring outside verbose loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
ntustison committed May 10, 2023
1 parent 6121db6 commit 9df124a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions R/landmarkTransforms.R
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,11 @@ fitTransformToPairedPoints <- function(
updatedMovingPoints <- applyAntsrTransformToPoint( totalFieldMovingToMiddleXfrm, movingPoints )
}

error <- mean( sqrt( rowSums( ( updatedFixedPoints - updatedMovingPoints )^2 ) ) )
errorValues <- append( errorValues, error )
convergenceValue <- convergenceMonitoring( errorValues )
if( verbose )
{
error <- mean( sqrt( rowSums( ( updatedFixedPoints - updatedMovingPoints )^2 ) ) )
errorValues <- append( errorValues, error )
convergenceValue <- convergenceMonitoring( errorValues )
endTime <- Sys.time()
diffTime <- endTime - startTime
cat( "Composition ", i, ": error = ", error, " (convergence = ", convergenceValue, ", elapsed time = ", diffTime, ")\n", sep = "" )
Expand Down Expand Up @@ -521,11 +521,11 @@ fitTransformToPairedPoints <- function(
spacing = antsGetSpacing( velocityField ), direction = antsGetDirection( velocityField ),
components = TRUE )

error <- mean( sqrt( rowSums( ( updatedFixedPoints - updatedMovingPoints )^2 ) ) )
errorValues <- append( errorValues, error )
convergenceValue <- convergenceMonitoring( errorValues )
if( verbose )
{
error <- mean( sqrt( rowSums( ( updatedFixedPoints - updatedMovingPoints )^2 ) ) )
errorValues <- append( errorValues, error )
convergenceValue <- convergenceMonitoring( errorValues )
endTime <- Sys.time()
diffTime <- endTime - startTime
cat( "Composition ", i, ": error = ", error, " (convergence = ", convergenceValue, ", elapsed time = ", diffTime, ")\n", sep = "" )
Expand Down Expand Up @@ -844,11 +844,11 @@ fitTimeVaryingTransformToPointSets <- function(
spacing = antsGetSpacing( velocityField ), direction = antsGetDirection( velocityField ),
components = TRUE )

error <- mean( sqrt( rowSums( ( updatedFixedPoints - updatedMovingPoints )^2 ) ) )
errorValues <- append( errorValues, error )
convergenceValue <- convergenceMonitoring( errorValues )
if( verbose )
{
error <- mean( sqrt( rowSums( ( updatedFixedPoints - updatedMovingPoints )^2 ) ) )
errorValues <- append( errorValues, error )
convergenceValue <- convergenceMonitoring( errorValues )
endTime <- Sys.time()
diffTime <- endTime - startTime
cat( "Composition ", i, ": error = ", error, " (convergence = ", convergenceValue, ", elapsed time = ", diffTime, ")\n", sep = "" )
Expand Down

0 comments on commit 9df124a

Please sign in to comment.