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
393060f9
Commit
393060f9
authored
9 years ago
by
Floris Berendsen
Browse files
Options
Downloads
Patches
Plain Diff
WIP:
parent
99bda6d5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Modules/Core/Install/src/itkFactory.cxx
+0
-129
0 additions, 129 deletions
Modules/Core/Install/src/itkFactory.cxx
Testing/Unit/elxComponentFactoryTest.cxx
+2
-2
2 additions, 2 deletions
Testing/Unit/elxComponentFactoryTest.cxx
with
2 additions
and
131 deletions
Modules/Core/Install/src/itkFactory.cxx
deleted
100644 → 0
+
0
−
129
View file @
99bda6d5
/*=========================================================================
*
* 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.
*
*=========================================================================*/
//#include "itkComponentFactoryRegisterManager.h"
#include
"itkImageFileReader.h"
#include
"itkImageFileWriter.h"
#include
"itkDisplacementFieldTransform.h"
#include
"itkComposeDisplacementFieldsImageFilter.h"
#include
"itkCompositeTransform.h"
#include
"itkVector.h"
#include
"itkPoint.h"
#include
"itkTransformFileReader.h"
#include
"itkTransformFactoryBase.h"
#include
"itkTransformFactory.h"
#include
"itkMatrixOffsetTransformBase.h"
//Floris: The module factory is based on the ImageIO factory.
// We manually register 2 dummy modules: itkTransformComponent1 and itkMetricComponent1.
// in ITK CMake\UseITK.cmake sets up the IOFactory_Register_Manager for transforms and images
// Elastix (by Denis) uses (simpleITK's) Typelists to register all GPU filters
//#include "itkComponentFactoryBase.h"
//#include "itkComponentFactory.h"
#include
"itkComponentBase.h"
//#include "itkComponentFactory.h"
#include
<map>
#include
<string>
#include
"itkTransformComponent1.h"
#include
"itkTransformComponent1Factory.h"
#include
"itkMetricComponent1.h"
#include
"itkMetricComponent1Factory.h"
int
main
(
int
argc
,
char
*
argv
[])
{
typedef
float
ScalarType
;
typedef
std
::
list
<
itk
::
LightObject
::
Pointer
>
RegisteredObjectsContainerType
;
RegisteredObjectsContainerType
registeredComponents
=
itk
::
ObjectFactoryBase
::
CreateAllInstance
(
"itkComponentBase"
);
std
::
cout
<<
"When CMake is not used to register the Component classes, there are
\n
"
<<
registeredComponents
.
size
()
<<
" Component objects available to the Overlord.
\n
"
<<
std
::
endl
;
itk
::
TransformComponent1Factory
::
RegisterOneFactory
();
itk
::
MetricComponent1Factory
::
RegisterOneFactory
();
std
::
cout
<<
"After registering the TransformComponent1 and MetricComponent1object, "
;
std
::
cout
<<
"there are
\n
"
;
registeredComponents
=
itk
::
ObjectFactoryBase
::
CreateAllInstance
(
"itkComponentBase"
);
std
::
cout
<<
registeredComponents
.
size
()
<<
" Component objects available to the Overlord.
\n
"
<<
std
::
endl
;
typedef
itk
::
ComponentBase
ComponentType
;
typedef
std
::
map
<
std
::
string
,
std
::
string
>
CriteriaType
;
typedef
std
::
pair
<
std
::
string
,
std
::
string
>
CriteriumType
;
CriteriaType
criteria1
;
//criteria1.insert(CriteriumType("ComponentOutput","Metric"));
criteria1
[
"ComponentOutput"
]
=
"Transform"
;
CriteriaType
criteria2
;
criteria2
[
"ComponentInput"
]
=
"Transform"
;
//criteria1.insert(CriteriumType("ComponentInput", "Metric"));
CriteriaType
emptyCriteria
;
typedef
itk
::
ComponentFactory
::
Pointer
NodePointer
;
NodePointer
Node1
=
itk
::
ComponentFactory
::
New
();
Node1
->
SetCriteria
(
emptyCriteria
);
ComponentType
::
Pointer
Node1Component
=
Node1
->
GetComponent
();
if
(
Node1Component
.
IsNull
())
{
std
::
cout
<<
"Too few criteria means no Component could be selected."
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"FAILED"
<<
std
::
endl
;
}
// Narrow down the selection criteria
Node1
->
AddCriteria
(
criteria1
);
Node1Component
=
Node1
->
GetComponent
();
if
(
Node1Component
.
IsNull
())
{
std
::
cout
<<
"FAILED"
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"Based on criteria, Node1 selected: "
<<
Node1Component
->
GetNameOfClass
()
<<
std
::
endl
;
}
NodePointer
Node2
=
itk
::
ComponentFactory
::
New
();
Node2
->
SetCriteria
(
criteria2
);
ComponentType
::
Pointer
Node2Component
=
Node2
->
GetComponent
();
if
(
Node2Component
.
IsNull
())
{
std
::
cout
<<
"FAILED"
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"Based on criteria, Node2 selected: "
<<
Node2Component
->
GetNameOfClass
()
<<
std
::
endl
;
}
return
EXIT_SUCCESS
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Testing/Unit/elxComponentFactoryTest.cxx
+
2
−
2
View file @
393060f9
...
...
@@ -28,8 +28,8 @@ public:
TEST_F
(
ComponentFactoryTest
,
EmptyObjectFactoryBase
)
{
// The Component factory is inspired on the ImageIO factory.
// In ITK Components (transform
s
IO and imageIO) can be preregistered: CMake\UseITK.cmake sets up the IOFactory_Register_Manager
// The Component factory is inspired
/based
on the ImageIO factory.
// In ITK Components (transformIO and imageIO) can be preregistered: CMake\UseITK.cmake sets up the IOFactory_Register_Manager
// In Elastix (by Denis) GPU filters are preregistered using (simpleITK's) Typelists and Cmake
// In this test we manually register 2 dummy modules: itkTransformComponent1 and itkMetricComponent1.
...
...
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