Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SuperElastix
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirrors
SuperElastix
Commits
f7f7d41d
Commit
f7f7d41d
authored
9 years ago
by
Kasper Marstal
Browse files
Options
Downloads
Patches
Plain Diff
COMP: ELASTIX-1 Remove GoogleTest-based benchmark framework
parent
86b14ab7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Testing/Benchmark/BSplineRegistration.cxx
+0
-137
0 additions, 137 deletions
Testing/Benchmark/BSplineRegistration.cxx
Testing/Benchmark/CMakeLists.txt
+0
-37
0 additions, 37 deletions
Testing/Benchmark/CMakeLists.txt
with
0 additions
and
174 deletions
Testing/Benchmark/BSplineRegistration.cxx
deleted
100644 → 0
+
0
−
137
View file @
86b14ab7
/**
* Benchmarking multi-resolution non-rigid b-spline registration
* with mutual information in ITK, Elastix and ANTs
*/
#include
"itkImage.h"
#include
"itkImageFileReader.h"
#include
"itkImageFileWriter.h"
// DeformableRegistration1
#include
"itkRescaleIntensityImageFilter.h"
#include
"itkHistogramMatchingImageFilter.h"
#include
"itkFEMRegistrationFilter.h"
#include
"gtest/gtest.h"
class
itkExamples
:
public
::
testing
::
Test
{
protected:
virtual
void
SetUp
()
{
const
char
*
fixedImageName
,
*
movingImageName
;
if
(
argc
<
2
)
{
std
::
cout
<<
"Image filenames missing."
<<
std
::
endl
;
std
::
cout
<<
"Usage: "
<<
argv
[
0
]
<<
" fixedImageFilename movingImageFilename"
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
else
{
fixedImageFilename
=
argv
[
1
];
movingImageFilename
=
argv
[
2
];
}
}
};
TEST_F
(
BSplineRegistration
,
ITK
)
{
const
unsigned
int
ImageDimension
=
2
;
typedef
unsigned
char
PixelType
;
typedef
itk
::
Image
<
PixelType
,
ImageDimension
>
ImageType
;
const
unsigned
int
SplineOrder
=
3
;
typedef
double
CoordinateRepType
;
// Transform
typedef
itk
::
BSplineDeformableTransform
<
CoordinateRepType
,
SpaceDimension
,
SplineOrder
>
TransformType
;
typedef
TransformType
::
RegionType
RegionType
;
RegionType
bsplineRegion
;
RegionType
::
SizeType
gridSizeOnImage
;
RegionType
::
SizeType
gridBorderSize
;
RegionType
::
SizeType
totalGridSize
;
gridSizeOnImage
.
Fill
(
5
);
gridBorderSize
.
Fill
(
3
);
// Border for spline order = 3 ( 1 lower, 2 upper )
totalGridSize
=
gridSizeOnImage
+
gridBorderSize
;
bsplineRegion
.
SetSize
(
totalGridSize
);
typedef
TransformType
::
SpacingType
SpacingType
;
SpacingType
spacing
=
fixedImage
->
GetSpacing
();
typedef
TransformType
::
OriginType
OriginType
;
OriginType
origin
=
fixedImage
->
GetOrigin
();
ImageType
::
SizeType
fixedImageSize
=
fixedRegion
.
GetSize
();
for
(
unsigned
int
r
=
0
;
r
<
ImageDimension
;
r
++
)
{
spacing
[
r
]
*=
static_cast
<
double
>
(
fixedImageSize
[
r
]
-
1
)
/
static_cast
<
double
>
(
gridSizeOnImage
[
r
]
-
1
);
}
ImageType
::
DirectionType
gridDirection
=
fixedImage
->
GetDirection
();
SpacingType
gridOriginOffset
=
gridDirection
*
spacing
;
OriginType
gridOrigin
=
origin
-
gridOriginOffset
;
transform
->
SetGridSpacing
(
spacing
);
transform
->
SetGridOrigin
(
gridOrigin
);
transform
->
SetGridRegion
(
bsplineRegion
);
transform
->
SetGridDirection
(
gridDirection
);
typedef
TransformType
::
ParametersType
ParametersType
;
const
unsigned
int
numberOfParameters
=
transform
->
GetNumberOfParameters
();
ParametersType
parameters
(
numberOfParameters
);
parameters
.
Fill
(
0.0
);
transform
->
SetParameters
(
parameters
);
// Optimizer
typedef
itk
::
LBFGSOptimizer
OptimizerType
;
optimizer
->
SetGradientConvergenceTolerance
(
0.05
);
optimizer
->
SetLineSearchAccuracy
(
0.9
);
optimizer
->
SetDefaultStepLength
(
.5
);
optimizer
->
TraceOn
();
optimizer
->
SetMaximumNumberOfFunctionEvaluations
(
1024
);
// Metric
typedef
itk
::
MeanSquaresImageToImageMetric
<
ImageType
,
ImageType
>
MetricType
;
// Interpolator
typedef
itk
::
LinearInterpolateImageFunction
<
ImageType
,
double
>
InterpolatorType
;
// Setup the registration
typedef
itk
::
ImageRegistrationMethod
<
ImageType
,
ImageType
>
RegistrationType
;
RegistrationType
::
Pointer
registration
=
RegistrationType
::
New
();
registration
->
SetNumberOfThreads
(
1
);
registration
->
SetMetric
(
MetricType
::
New
()
);
registration
->
SetOptimizer
(
OptimizerType
::
New
()
);
registration
->
SetInterpolator
(
InterpolatorType
::
New
()
);
TransformType
::
Pointer
transform
=
TransformType
::
New
();
registration
->
SetTransform
(
transform
);
registration
->
SetFixedImage
(
fixedImage
);
registration
->
SetMovingImage
(
movingImage
);
ImageType
::
RegionType
fixedRegion
=
fixedImage
->
GetBufferedRegion
();
registration
->
SetFixedImageRegion
(
fixedRegion
);
registration
->
SetInitialTransformParameters
(
transform
->
GetParameters
()
);
// Execute
EXPECT_NO_THROW
(
registration
->
Update
()
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Testing/Benchmark/CMakeLists.txt
deleted
100644 → 0
+
0
−
37
View file @
86b14ab7
#
set
(
GTEST_OPTIONS
-gtest_output
)
#---------------------------------------------------------------------
# To add a benchmark to the build system, append it to the list below.
# Any GoogleTests in these files are automatically added to CTest.
set
(
ElastixBenchmarkSource
elxExampleBenchmark.cxx
)
#---------------------------------------------------------------------
# To add data to a benchmark, create a list "${filename}Data" (without
# the filename extension) and add data to this list.
set
(
elxExampleBenchmarkData
DATA{Testing/Data/Input/BrainProtonDensitySlice.png}
DATA{Testing/Data/Input/BrainProtonDensitySliceR10X13Y17.png}
)
#---------------------------------------------------------------------
# Build executables
foreach
(
ElastixBenchmarkFilename
${
ElastixBenchmarkSource
}
)
string
(
REPLACE
".cxx"
""
ElastixBenchmark
${
ElastixBenchmarkFilename
}
)
add_executable
(
${
ElastixBenchmark
}
${
ElastixBenchmarkFilename
}
)
target_link_libraries
(
${
ElastixBenchmark
}
${
ELASTIX_LIBRARIES
}
${
ITK_LIBRARIES
}
${
TEST_LIBRARIES
}
)
ExternalData_Add_Test
(
"
${
ElastixBenchmark
}
ExternalDataTarget"
NAME
${
ElastixBenchmark
}
COMMAND
"
${
ElastixBenchmark
}
${${
ElastixBenchmarkTest
}
Data
}
${
GTEST_OPTIONS
}
"
)
ExternalData_Add_Target
(
"
${
ElastixBenchmark
}
ExternalDataTarget"
}
)
endforeach
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment