Skip to content

Commit 3d1019a

Browse files
committed
Merge pull request #12 from thewtex/BuildExampleAgainstITK
Build example against itk
2 parents 419c54b + afd22b6 commit 3d1019a

File tree

11 files changed

+88
-90
lines changed

11 files changed

+88
-90
lines changed

circle.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ dependencies:
66
override:
77
- docker info
88
- docker pull insighttoolkit/minimalpathextraction-test
9+
- ~/ITKMinimalPathExtraction/test/Docker/build.sh
910

1011
test:
1112
override:

examples/CMakeLists.txt

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
1-
# The header files
2-
SET(HEADERS
3-
${CMAKE_SOURCE_DIR}/include/itkImageToPathFilter.h
4-
${CMAKE_SOURCE_DIR}/include/itkSingleImageCostFunction.h
5-
${CMAKE_SOURCE_DIR}/include/itkArrivalFunctionToPathFilter.h
6-
${CMAKE_SOURCE_DIR}/include/itkSpeedFunctionToPathFilter.h
7-
${CMAKE_SOURCE_DIR}/include/itkImageToPathFilter.hxx
8-
${CMAKE_SOURCE_DIR}/include/itkSingleImageCostFunction.hxx
9-
${CMAKE_SOURCE_DIR}/include/itkArrivalFunctionToPathFilter.hxx
10-
${CMAKE_SOURCE_DIR}/include/itkSpeedFunctionToPathFilter.hxx
11-
)
1+
cmake_minimum_required(VERSION 2.8)
2+
project(MinimalPathExtractionExamples)
123

13-
# Add this as include directory
14-
INCLUDE_DIRECTORIES(
15-
${CMAKE_SOURCE_DIR}
16-
)
4+
find_package(ITK REQUIRED
5+
COMPONENTS MinimalPathExtraction
6+
ITKIOImageBase
7+
ITKImageFunction
8+
ITKOptimizers
9+
ITKPath
10+
ITKIOMeta
11+
ITKIOPNG
12+
ITKIOJPEG
13+
)
1714

18-
# Main library
19-
ADD_EXECUTABLE(MinimalPathMain main.cxx ${HEADERS} )
20-
TARGET_LINK_LIBRARIES(MinimalPathMain ${ITK_LIBRARIES})
15+
include(${ITK_USE_FILE})
2116

22-
ADD_EXECUTABLE(MinimalPathExamples example.cxx ${HEADERS} )
23-
TARGET_LINK_LIBRARIES(MinimalPathExamples ${ITK_LIBRARIES})
17+
add_executable(MinimalPathExamples example.cxx)
18+
target_link_libraries(MinimalPathExamples ${ITK_LIBRARIES})

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( );

examples/main.cxx

Lines changed: 0 additions & 10 deletions
This file was deleted.

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/Docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ RUN apt-get update && apt-get install -y \
2121
RUN mkdir -p /usr/src/ITKMinimalPathExtraction-build
2222
WORKDIR /usr/src
2323

24-
# 2015-09-17
25-
ENV ITK_GIT_TAG af1a72fc24ad8e58be0e9af71d791043dcdbca1a
24+
# 2015-10-13
25+
ENV ITK_GIT_TAG 3b9767eeb61ed1e20cd6018a40b5a91868dade04
2626
RUN git clone git://itk.org/ITK.git && \
2727
cd ITK && \
2828
git checkout ${ITK_GIT_TAG} && \

test/Docker/test.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,13 @@ cmake \
1616
-DCMAKE_BUILD_TYPE:STRING=Release \
1717
/usr/src/ITKMinimalPathExtraction || die "CMake configuration failed"
1818
ctest -VV -D Experimental || die "ctest failed"
19+
20+
examples_build_dir=/usr/src/ITKMinimalPathExtraction-build/examples
21+
mkdir -p $examples_build_dir
22+
cd $examples_build_dir
23+
cmake \
24+
-G Ninja \
25+
-DITK_DIR:PATH=/usr/src/ITK-build \
26+
-DCMAKE_BUILD_TYPE:STRING=Release \
27+
/usr/src/ITKMinimalPathExtraction/examples || die "Example CMake configuration failed"
28+
ninja || die "examples build failed"

0 commit comments

Comments
 (0)