-
Notifications
You must be signed in to change notification settings - Fork 119
/
Copy pathelxMovingImagePyramidBase.hxx
121 lines (98 loc) · 3.46 KB
/
elxMovingImagePyramidBase.hxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#ifndef __elxMovingImagePyramidBase_hxx
#define __elxMovingImagePyramidBase_hxx
#include "elxMovingImagePyramidBase.h"
namespace elastix
{
using namespace itk;
/**
* ******************* BeforeRegistrationBase *******************
*/
template <class TElastix>
void MovingImagePyramidBase<TElastix>
::BeforeRegistrationBase(void)
{
/** Call SetFixedSchedule.*/
this->SetMovingSchedule();
} // end BeforeRegistrationBase
/**
* ********************** SetMovingSchedule *********************
*/
template <class TElastix>
void MovingImagePyramidBase<TElastix>
::SetMovingSchedule(void)
{
/** Get the ImageDimension.*/
unsigned int MovingImageDimension = InputImageType::ImageDimension;
unsigned int FixedImageDimension = FixedImageType::ImageDimension;
/** Read numberOfResolutions.*/
unsigned int numberOfResolutions = 0;
m_Configuration->ReadParameter( numberOfResolutions, "NumberOfResolutions", 0, true );
if ( numberOfResolutions == 0 )
{
xl::xout["error"] << "ERROR: NumberOfResolutions not specified!" << std::endl;
}
// TO DO: quit program?
/** Create a movingSchedule.*/
ScheduleType movingSchedule( numberOfResolutions, MovingImageDimension );
movingSchedule.Fill( 0 );
/** Are FixedPyramidSchedule and/or MovingPyramidSchedule available
* in the parameter-file?
*/
unsigned int temp_fix = 0;
unsigned int temp_mov = 0;
m_Configuration->ReadParameter( temp_fix, "FixedPyramidSchedule", 0, true );
m_Configuration->ReadParameter( temp_mov, "MovingPyramidSchedule", 0, true );
/** If the MovingPyramidSchedule exists:*/
if ( temp_mov != 0 )
{
/** In this case set the movingPyramidSchedule to the
* MovingPyramidSchedule given in the parameter-file.
*/
for ( unsigned int i = 0; i < numberOfResolutions; i++ )
{
for ( unsigned int j = 0; j < MovingImageDimension; j++ )
{
m_Configuration->ReadParameter(
movingSchedule[ j ][ i ],
"MovingPyramidSchedule",
i * numberOfResolutions + j );
} // end for MovingImageDimension
} // end for numberOfResolutions
/** Set the schedule into this class.*/
this->GetAsITKBaseType()->SetSchedule( movingSchedule );
}
/** If only the FixedPyramidSchedule exists:*/
else if ( temp_fix != 0 && temp_mov == 0 && FixedImageDimension == MovingImageDimension )
{
/** In this case set the movingPyramidSchedule to the
* FixedPyramidSchedule given in the parameter-file.
*/
for ( unsigned int i = 0; i < numberOfResolutions; i++ )
{
for ( unsigned int j = 0; j < MovingImageDimension; j++ )
{
m_Configuration->ReadParameter(
movingSchedule[ j ][ i ],
"FixedPyramidSchedule",
i * numberOfResolutions + j );
} // end for MovingImageDimension
} // end for numberOfResolutions
/** Set the schedule into this class.*/
this->GetAsITKBaseType()->SetSchedule( movingSchedule );
}
else if ( temp_fix != 0 && temp_mov == 0 && FixedImageDimension != MovingImageDimension )
{
xl::xout["warning"] << "WARNING: MovingImagePyramidSchedule is not specified!" << std::endl;
xl::xout["warning"] << "A default schedule is assumed. " << std::endl;
}
/** If both PyramidSchedule's don't exist:*/
else
{
/** In this case set the movingPyramidSchedule to the
* default schedule.
*/
this->GetAsITKBaseType()->SetNumberOfLevels( numberOfResolutions );
} // end if
} // end SetMovingSchedule
} // end namespace elastix
#endif // end #ifndef __elxMovingImagePyramidBase_hxx