Skip to content

Commit 16de3b8

Browse files
Merge pull request #88 from KrisThielemans/GTMexcep
GTM: handle exceptions
2 parents 90a3150 + f26a784 commit 16de3b8

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ endif()
2828

2929
SET(VERSION_MAJOR 1)
3030
SET(VERSION_MINOR 2)
31-
SET(VERSION_PATCH 10)
31+
SET(VERSION_PATCH 11)
3232

3333
MAKE_DIRECTORY(${PROJECT_BINARY_DIR}/config)
3434

azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
vmImage: 'Ubuntu-20.04'
1313
steps:
1414
- script: |
15+
sudo apt-get update
1516
sudo apt-get install -y ninja-build libinsighttoolkit4-dev
1617
displayName: Apt install dependencies
1718
- script: |

src/GTM.cxx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ int main(int argc, char *argv[])
129129
maskReader->Update();
130130
} catch (itk::ExceptionObject & err) {
131131
std::cerr << "[Error]\tCannot read mask input file: " << sMaskFileName
132-
<< std::endl;
132+
<< err << std::endl;
133133
return EXIT_FAILURE;
134134
}
135135

@@ -142,7 +142,7 @@ int main(int argc, char *argv[])
142142
petReader->Update();
143143
} catch (itk::ExceptionObject & err) {
144144
std::cerr << "[Error]\tCannot read PET input file: " << sPETFileName
145-
<< std::endl;
145+
<< err << std::endl;
146146
return EXIT_FAILURE;
147147
}
148148

@@ -151,7 +151,14 @@ int main(int argc, char *argv[])
151151
vVariance = vFWHM / (2.0 * sqrt(2.0 * log(2.0)));
152152
//std::cout << vVariance << std::endl;
153153

154-
VectorType vVoxelSize = petReader->GetOutput()->GetSpacing();
154+
try {
155+
VectorType vVoxelSize = petReader->GetOutput()->GetSpacing();;
156+
} catch (itk::ExceptionObject& err) {
157+
std::cerr << "[Error]\tCannot read PET voxel sizes from input file: " << sPETFileName
158+
<< err
159+
<< std::endl;
160+
return EXIT_FAILURE;
161+
}
155162
//std::cout << vVoxelSize << std::endl;
156163

157164
vVariance[0] = pow(vVariance[0], 2);
@@ -163,7 +170,13 @@ int main(int argc, char *argv[])
163170
roussetFilter->SetMaskInput( maskReader->GetOutput() );
164171
roussetFilter->SetPSF( vVariance );
165172
roussetFilter->SetVerbose( bDebug );
166-
roussetFilter->Update();
173+
try {
174+
roussetFilter->Update();
175+
}
176+
catch (itk::ExceptionObject& err) {
177+
std::cerr << err << std::endl;
178+
return EXIT_FAILURE;
179+
}
167180

168181
return EXIT_SUCCESS;
169182
}

0 commit comments

Comments
 (0)