19#ifndef rtkGeneralPurposeFunctions_h
20#define rtkGeneralPurposeFunctions_h
42static inline std::vector<double>
45 std::vector<double> signalVector;
46 std::ifstream is(filename.c_str());
49 itkGenericExceptionMacro(<<
"Could not open signal file " << filename);
54 while (getline(is, s))
58 std::istringstream tmp(s);
61 signalVector.push_back(0);
78 itkGenericExceptionMacro(<<
"Could not read " << filename);
80 reader->SetFileName(filename);
81 reader->ReadImageInformation();
85template <
typename ImageType>
87WriteImage(
typename ImageType::ConstPointer input, std::string name)
91 auto writer = WriterType::New();
92 writer->SetInput(input);
93 writer->SetFileName(name);
Writes image data to a single file.
SmartPointer< Self > Pointer
static ImageIOBasePointer CreateImageIO(const char *path, IOFileModeEnum mode)
static std::vector< double > ReadSignalFile(const std::string &filename)
A few functions that are used either in the applications or for debugging purposes.
TInput TInput constexpr auto Round(TInput x)
ITK_TEMPLATE_EXPORT void WriteImage(TImagePointer &&image, const std::string &filename, bool compress=false)
static itk::ImageIOBase::Pointer GetFileHeader(const std::string &filename)