Skip to content

Commit

Permalink
Merge pull request #88 from KrisThielemans/GTMexcep
Browse files Browse the repository at this point in the history
GTM: handle exceptions
  • Loading branch information
KrisThielemans authored Mar 1, 2023
2 parents 90a3150 + f26a784 commit 16de3b8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ endif()

SET(VERSION_MAJOR 1)
SET(VERSION_MINOR 2)
SET(VERSION_PATCH 10)
SET(VERSION_PATCH 11)

MAKE_DIRECTORY(${PROJECT_BINARY_DIR}/config)

Expand Down
1 change: 1 addition & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
vmImage: 'Ubuntu-20.04'
steps:
- script: |
sudo apt-get update
sudo apt-get install -y ninja-build libinsighttoolkit4-dev
displayName: Apt install dependencies
- script: |
Expand Down
21 changes: 17 additions & 4 deletions src/GTM.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ int main(int argc, char *argv[])
maskReader->Update();
} catch (itk::ExceptionObject & err) {
std::cerr << "[Error]\tCannot read mask input file: " << sMaskFileName
<< std::endl;
<< err << std::endl;
return EXIT_FAILURE;
}

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

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

VectorType vVoxelSize = petReader->GetOutput()->GetSpacing();
try {
VectorType vVoxelSize = petReader->GetOutput()->GetSpacing();;
} catch (itk::ExceptionObject& err) {
std::cerr << "[Error]\tCannot read PET voxel sizes from input file: " << sPETFileName
<< err
<< std::endl;
return EXIT_FAILURE;
}
//std::cout << vVoxelSize << std::endl;

vVariance[0] = pow(vVariance[0], 2);
Expand All @@ -163,7 +170,13 @@ int main(int argc, char *argv[])
roussetFilter->SetMaskInput( maskReader->GetOutput() );
roussetFilter->SetPSF( vVariance );
roussetFilter->SetVerbose( bDebug );
roussetFilter->Update();
try {
roussetFilter->Update();
}
catch (itk::ExceptionObject& err) {
std::cerr << err << std::endl;
return EXIT_FAILURE;
}

return EXIT_SUCCESS;
}
Expand Down

0 comments on commit 16de3b8

Please sign in to comment.