Skip to content

Commit ec08762

Browse files
committed
BUG: Update path information typedef, method, and member names.
For consistency.
1 parent c596298 commit ec08762

File tree

6 files changed

+60
-58
lines changed

6 files changed

+60
-58
lines changed

examples/example.cxx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,12 @@ end[0] = 100; end[1] = 10;
7373
way1[0] = 10; way1[1] = 10;
7474

7575
// Add path information
76-
PathFilterType::PathInfo info;
77-
info.SetStartPoint( start );
78-
info.SetEndPoint( end );
79-
info.AddWayPoint( way1 );
80-
pathFilter->AddPathInfo( info );
76+
typedef PathFilterType::PathInformationType PathInformationType;
77+
PathInformationType::Pointer info = PathInformationType::New();
78+
info->SetStartPoint( start );
79+
info->SetEndPoint( end );
80+
info->AddWayPoint( way1 );
81+
pathFilter->AddPathInformation( info );
8182

8283
// Compute the path
8384
pathFilter->Update( );
@@ -180,11 +181,12 @@ end[0] = 100; end[1] = 10;
180181
way1[0] = 10; way1[1] = 10;
181182

182183
// Add path information
183-
PathFilterType::PathInfo info;
184-
info.SetStartPoint( start );
185-
info.SetEndPoint( end );
186-
info.AddWayPoint( way1 );
187-
pathFilter->AddPathInfo( info );
184+
typedef PathFilterType::PathInformationType PathInformationType;
185+
PathInformationType::Pointer info = PathInformationType::New();
186+
info->SetStartPoint( start );
187+
info->SetEndPoint( end );
188+
info->AddWayPoint( way1 );
189+
pathFilter->AddPathInformation( info );
188190

189191
// Compute the path
190192
pathFilter->Update( );

include/itkSpeedFunctionPathInformation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class SpeedFunctionPathInformation :
9494
virtual ~SpeedFunctionPathInformation( );
9595
virtual void PrintSelf( std::ostream& os, Indent indent ) const;
9696

97-
std::vector< PointType > m_Info;
97+
std::vector< PointType > m_Information;
9898
SizeValueType m_Front;
9999

100100

include/itkSpeedFunctionPathInformation.hxx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ template <typename TPoint>
4242
void SpeedFunctionPathInformation<TPoint>
4343
::ClearInfo()
4444
{
45-
m_Info.clear();
46-
m_Info.resize(2);
45+
m_Information.clear();
46+
m_Information.resize(2);
4747
m_Front = 1;
4848
}
4949

@@ -52,23 +52,23 @@ template <typename TPoint>
5252
void SpeedFunctionPathInformation<TPoint>
5353
::SetStartPoint( const PointType & start )
5454
{
55-
m_Info[1] = start;
55+
m_Information[1] = start;
5656
}
5757

5858

5959
template <typename TPoint>
6060
void SpeedFunctionPathInformation<TPoint>
6161
::SetEndPoint( const PointType & end )
6262
{
63-
m_Info[0] = end;
63+
m_Information[0] = end;
6464
}
6565

6666

6767
template <typename TPoint>
6868
void SpeedFunctionPathInformation<TPoint>
6969
::AddWayPoint( const PointType & way )
7070
{
71-
m_Info.push_back( way );
71+
m_Information.push_back( way );
7272
m_Front++;
7373
}
7474

@@ -77,7 +77,7 @@ template <typename TPoint>
7777
unsigned int SpeedFunctionPathInformation<TPoint>
7878
::GetNumberOfPoints( ) const
7979
{
80-
return m_Info.size();
80+
return m_Information.size();
8181
}
8282

8383

@@ -86,7 +86,7 @@ const typename SpeedFunctionPathInformation<TPoint>::PointType &
8686
SpeedFunctionPathInformation<TPoint>
8787
::GetStartPoint( ) const
8888
{
89-
return m_Info[1];
89+
return m_Information[1];
9090
}
9191

9292

@@ -95,7 +95,7 @@ const typename SpeedFunctionPathInformation<TPoint>::PointType &
9595
SpeedFunctionPathInformation<TPoint>
9696
::GetEndPoint( ) const
9797
{
98-
return m_Info[0];
98+
return m_Information[0];
9999
}
100100

101101

@@ -104,7 +104,7 @@ const typename SpeedFunctionPathInformation<TPoint>::PointType &
104104
SpeedFunctionPathInformation<TPoint>
105105
::GetWayPoint( SizeValueType i ) const
106106
{
107-
return m_Info[2+i];
107+
return m_Information[2+i];
108108
}
109109

110110

@@ -122,7 +122,7 @@ const typename SpeedFunctionPathInformation<TPoint>::PointType &
122122
SpeedFunctionPathInformation<TPoint>
123123
::GetCurrentFrontAndAdvance( )
124124
{
125-
return m_Info[m_Front--];
125+
return m_Information[m_Front--];
126126
}
127127

128128

@@ -131,7 +131,7 @@ const typename SpeedFunctionPathInformation<TPoint>::PointType &
131131
SpeedFunctionPathInformation<TPoint>
132132
::PeekCurrentFront( ) const
133133
{
134-
return m_Info[m_Front];
134+
return m_Information[m_Front];
135135
}
136136

137137

@@ -142,11 +142,11 @@ SpeedFunctionPathInformation<TPoint>
142142
{
143143
if ( m_Front <= 1 )
144144
{
145-
return m_Info[1];
145+
return m_Information[1];
146146
}
147147
else
148148
{
149-
return m_Info[m_Front-1];
149+
return m_Information[m_Front-1];
150150
}
151151
}
152152

@@ -156,13 +156,13 @@ const typename SpeedFunctionPathInformation<TPoint>::PointType &
156156
SpeedFunctionPathInformation<TPoint>
157157
::PeekPreviousFront( ) const
158158
{
159-
if ( m_Front == m_Info.size()-1 )
159+
if ( m_Front == m_Information.size()-1 )
160160
{
161-
return m_Info[0];
161+
return m_Information[0];
162162
}
163163
else
164164
{
165-
return m_Info[m_Front+1];
165+
return m_Information[m_Front+1];
166166
}
167167
}
168168

include/itkSpeedFunctionToPathFilter.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class ITK_EXPORT SpeedFunctionToPathFilter :
103103
typedef typename Superclass::OptimizerType OptimizerType;
104104

105105
/** Path information typedef. */
106-
typedef SpeedFunctionPathInformation<PointType> PathInformation;
106+
typedef SpeedFunctionPathInformation<PointType> PathInformationType;
107107

108108
/** Override superclass behaviour.
109109
* Warning: SetPathEndPoint() is not valid for this filter.
@@ -134,15 +134,15 @@ class ITK_EXPORT SpeedFunctionToPathFilter :
134134

135135
/** Add a path information object to process.
136136
* At least one PathInfo object must be added before processing. */
137-
void AddPathInfo(PathInformation * info )
137+
void AddPathInformation(PathInformationType * info )
138138
{
139-
m_Info.push_back( info );
139+
m_Information.push_back( info );
140140
}
141141

142142
/** Clear the list of path information objects. */
143-
void ClearPathInfo()
143+
void ClearPathInformation()
144144
{
145-
m_Info.clear( );
145+
m_Information.clear( );
146146
}
147147

148148
/** Handle optimizer iteration events. */
@@ -165,8 +165,8 @@ class ITK_EXPORT SpeedFunctionToPathFilter :
165165
/** Override handling of optimizer iteration events to accomodate way points. */
166166
virtual const PointType & GetNextEndPoint( );
167167

168-
std::vector< typename PathInformation::Pointer > m_Info;
169-
InputImagePointer m_CurrentArrivalFunction;
168+
std::vector< typename PathInformationType::Pointer > m_Information;
169+
InputImagePointer m_CurrentArrivalFunction;
170170

171171
private:
172172
SpeedFunctionToPathFilter( const Self& ); //purposely not implemented

include/itkSpeedFunctionToPathFilter.hxx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ unsigned int
5555
SpeedFunctionToPathFilter<TInputImage,TOutputPath>
5656
::GetNumberOfPathsToExtract() const
5757
{
58-
return m_Info.size();
58+
return m_Information.size();
5959
}
6060

6161

@@ -67,7 +67,7 @@ const typename SpeedFunctionToPathFilter<TInputImage,TOutputPath>::PointType &
6767
SpeedFunctionToPathFilter<TInputImage,TOutputPath>
6868
::GetNextEndPoint()
6969
{
70-
return m_Info[Superclass::m_CurrentOutput]->GetEndPoint();
70+
return m_Information[Superclass::m_CurrentOutput]->GetEndPoint();
7171
}
7272

7373

@@ -101,12 +101,12 @@ SpeedFunctionToPathFilter<TInputImage,TOutputPath>
101101
IndexType indexTargetNext;
102102
speed->TransformPhysicalPointToIndex
103103
(
104-
m_Info[Superclass::m_CurrentOutput]->PeekPreviousFront(),
104+
m_Information[Superclass::m_CurrentOutput]->PeekPreviousFront(),
105105
indexTargetPrevious
106106
);
107107
speed->TransformPhysicalPointToIndex
108108
(
109-
m_Info[Superclass::m_CurrentOutput]->PeekNextFront(),
109+
m_Information[Superclass::m_CurrentOutput]->PeekNextFront(),
110110
indexTargetNext
111111
);
112112
NodeType nodeTargetPrevious;
@@ -125,7 +125,7 @@ SpeedFunctionToPathFilter<TInputImage,TOutputPath>
125125
IndexType indexTrial;
126126
speed->TransformPhysicalPointToIndex
127127
(
128-
m_Info[Superclass::m_CurrentOutput]->GetCurrentFrontAndAdvance(),
128+
m_Information[Superclass::m_CurrentOutput]->GetCurrentFrontAndAdvance(),
129129
indexTrial
130130
);
131131
NodeType nodeTrial;
@@ -161,7 +161,7 @@ SpeedFunctionToPathFilter<TInputImage,TOutputPath>
161161
}
162162

163163
// Ensure the user has added at least one path info object
164-
if ( m_Info.size() == 0 )
164+
if ( m_Information.size() == 0 )
165165
{
166166
itkExceptionMacro( "No PathInfo objects: at least one must be added." );
167167
}
@@ -205,7 +205,7 @@ SpeedFunctionToPathFilter<TInputImage,TOutputPath>
205205

206206
// Check if we have reached the termination value
207207
if ( currentValue < Superclass::m_TerminationValue &&
208-
m_Info[Superclass::m_CurrentOutput]->HasNextFront() )
208+
m_Information[Superclass::m_CurrentOutput]->HasNextFront() )
209209
{
210210
// We have terminated the current path segment,
211211
// but there are more fronts to propagate

test/MinimalPathTest.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*=========================================================================
2-
2+
33
Filter: MinimalPath
44
Program: Insight Segmentation & Registration Toolkit
55
Module: MinimalPathTests.cxx
@@ -84,16 +84,16 @@ int ReadPathFile( const char * PathFilename, typename PathFilterType::Pointer pa
8484
while ( itksys::SystemTools::GetLineFromStream(file, line, &has_newline) )
8585
{
8686
if (has_newline)
87-
{
88-
typename PathInfoType::Pointer info = PathInfoType::New();
87+
{
88+
typename PathInfoType::Pointer info = PathInfoType::New();
8989
itksys::SystemTools::ReplaceString( line, "Path: ", "" );
9090
itksys::SystemTools::ReplaceString( line, " ", "" );
9191
itksys::SystemTools::ReplaceString( line, "[", "" );
9292
std::vector<itksys::String> parts;
9393
parts = itksys::SystemTools::SplitString( line.c_str(), ']' );
9494
unsigned int numNonNullParts = 0;
9595
for (unsigned int i=0; i<parts.size(); i++)
96-
if ( parts[i].length() != 0 ) numNonNullParts++;
96+
if ( parts[i].length() != 0 ) numNonNullParts++;
9797
for (unsigned int i=0; i<numNonNullParts; i++)
9898
{
9999
if ( parts[i].length() != 0 )
@@ -108,7 +108,7 @@ int ReadPathFile( const char * PathFilename, typename PathFilterType::Pointer pa
108108
else info->AddWayPoint( point );
109109
}
110110
}
111-
pathFilter->AddPathInfo( info );
111+
pathFilter->AddPathInformation( info );
112112
}
113113
}
114114

@@ -203,7 +203,7 @@ int Test_SpeedToPath_GradientDescent_ND(int argc, char* argv[])
203203
std::cout << std::setprecision(3) << "Path computed in: " << time.GetMean() << " seconds" << std::endl;
204204

205205
// Allocate output image
206-
typename OutputImageType::Pointer output = OutputImageType::New();
206+
typename OutputImageType::Pointer output = OutputImageType::New();
207207
output->SetRegions( speed->GetLargestPossibleRegion() );
208208
output->SetSpacing( speed->GetSpacing() );
209209
output->SetOrigin( speed->GetOrigin() );
@@ -240,9 +240,9 @@ int Test_SpeedToPath_GradientDescent_ND(int argc, char* argv[])
240240
writer->Update();
241241
}
242242
catch (itk::ExceptionObject & err)
243-
{
244-
std::cerr << "ExceptionObject caught !" << std::endl;
245-
std::cerr << err << std::endl;
243+
{
244+
std::cerr << "ExceptionObject caught !" << std::endl;
245+
std::cerr << err << std::endl;
246246
return EXIT_FAILURE;
247247
}
248248

@@ -351,7 +351,7 @@ int Test_SpeedToPath_RegularStepGradientDescent_ND(int argc, char* argv[])
351351
std::cout << std::setprecision(3) << "Path computed in: " << time.GetMean() << " seconds" << std::endl;
352352

353353
// Allocate output image
354-
typename OutputImageType::Pointer output = OutputImageType::New();
354+
typename OutputImageType::Pointer output = OutputImageType::New();
355355
output->SetRegions( speed->GetLargestPossibleRegion() );
356356
output->SetSpacing( speed->GetSpacing() );
357357
output->SetOrigin( speed->GetOrigin() );
@@ -388,9 +388,9 @@ int Test_SpeedToPath_RegularStepGradientDescent_ND(int argc, char* argv[])
388388
writer->Update();
389389
}
390390
catch (itk::ExceptionObject & err)
391-
{
392-
std::cerr << "ExceptionObject caught !" << std::endl;
393-
std::cerr << err << std::endl;
391+
{
392+
std::cerr << "ExceptionObject caught !" << std::endl;
393+
std::cerr << err << std::endl;
394394
return EXIT_FAILURE;
395395
}
396396

@@ -491,7 +491,7 @@ int Test_SpeedToPath_IterateNeighborhood_ND(int argc, char* argv[])
491491
std::cout << std::setprecision(3) << "Path computed in: " << time.GetMean() << " seconds" << std::endl;
492492

493493
// Allocate output image
494-
typename OutputImageType::Pointer output = OutputImageType::New();
494+
typename OutputImageType::Pointer output = OutputImageType::New();
495495
output->SetRegions( speed->GetLargestPossibleRegion() );
496496
output->SetSpacing( speed->GetSpacing() );
497497
output->SetOrigin( speed->GetOrigin() );
@@ -528,9 +528,9 @@ int Test_SpeedToPath_IterateNeighborhood_ND(int argc, char* argv[])
528528
writer->Update();
529529
}
530530
catch (itk::ExceptionObject & err)
531-
{
532-
std::cerr << "ExceptionObject caught !" << std::endl;
533-
std::cerr << err << std::endl;
531+
{
532+
std::cerr << "ExceptionObject caught !" << std::endl;
533+
std::cerr << err << std::endl;
534534
return EXIT_FAILURE;
535535
}
536536

0 commit comments

Comments
 (0)