Skip to content

Commit

Permalink
Merge pull request #1476 from KrisThielemans/remove_some_boost
Browse files Browse the repository at this point in the history
remove use of boo:st:lexical_cast and pi
  • Loading branch information
KrisThielemans authored Aug 19, 2024
2 parents 69f20be + 60eb87e commit 209cbb6
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/IO/MultiDynamicDiscretisedDensityOutputFileFormat.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ MultiDynamicDiscretisedDensityOutputFileFormat::actual_write_to_file(std::string
// Create all the filenames
VectorWithOffset<std::string> individual_filenames(1, int(density.get_num_time_frames()));
for (int i = 1; i <= int(density.get_num_time_frames()); i++)
individual_filenames[i] = filename + "_" + boost::lexical_cast<std::string>(i);
individual_filenames[i] = filename + "_" + std::to_string(i);

// Write each individual image
for (int i = 1; i <= int(density.get_num_time_frames()); i++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ ParamDiscDensityOutputFileFormat::actual_write_to_file(std::string& filename,
// Create all the filenames
VectorWithOffset<std::string> individual_filenames(1, int(density.get_num_params()));
for (int i = 1; i <= int(density.get_num_params()); i++)
individual_filenames[i] = filename + "_" + boost::lexical_cast<std::string>(i);
individual_filenames[i] = filename + "_" + std::to_string(i);

// Write each individual image
for (int i = 1; i <= int(density.get_num_params()); i++)
Expand Down
14 changes: 11 additions & 3 deletions src/include/stir/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@
#include <cstring>
#include <cmath>
#include <cassert>
#include <boost/math/constants/constants.hpp>
#if __cplusplus >= 202002L
# include <numbers>
#endif

//*************** namespace macros
#define START_NAMESPACE_STIR \
Expand Down Expand Up @@ -128,10 +130,16 @@
//***************
START_NAMESPACE_STIR

#ifndef _PI
# if __cplusplus >= 202002L
//! The constant pi to high precision.
/*! \ingroup buildblock */
#ifndef _PI
# define _PI boost::math::constants::pi<double>()
# define _PI std::numbers::pi
# else
//! The constant pi to high precision.
/*! \ingroup buildblock */
# define _PI 3.1415926535897932384626433832795028841971693993751058209749445923078164062
# endif
#endif

//! Define the speed of light in mm / ps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
/*!
\file
\ingroup recon_buildblock
\brief Declaration of ML_estimate_component_based_normalisation
\brief Declaration of stir::ML_estimate_component_based_normalisation
\author Kris Thielemans
*/
#include "stir/common.h"
#include <string>

START_NAMESPACE_STIR

Expand Down
6 changes: 2 additions & 4 deletions src/include/stir/warning.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
\author Kris Thielemans
*/
#include "stir/common.h"
#include "stir/Verbosity.h"
#include <iostream>

#include "TextWriter.h"
#include "stir/TextWriter.h"
#include <sstream>

START_NAMESPACE_STIR

Expand Down
2 changes: 1 addition & 1 deletion src/recon_buildblock/BinNormalisationSPECT.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ BinNormalisationSPECT::read_uniformity_table(Array<3, float>& uniformity) const
for (int n = 1; n <= num_detector_heads; n++)
{

const std::string n_string = boost::lexical_cast<std::string>(n);
const std::string n_string = std::to_string(n);
const std::string filename(this->folder_prefix + n_string + "/" + uniformity_filename);

std::ifstream input(filename.c_str());
Expand Down

0 comments on commit 209cbb6

Please sign in to comment.