34template <
int num_dimensions,
class IStreamT,
class elemT>
36read_data_help(is_not_1d, IStreamT& s, ArrayType<num_dimensions, elemT>& data,
const ByteOrder byte_order)
38 if (data.is_contiguous())
42 for (
typename ArrayType<num_dimensions, elemT>::iterator iter = data.begin(); iter != data.end(); ++iter)
44 if (
read_data(s, *iter, byte_order) == Succeeded::no)
47 return Succeeded::yes;
52template <
class IStreamT,
class elemT>
54read_data_help(is_1d, IStreamT& s, ArrayType<1, elemT>& data,
const ByteOrder byte_order)
61template <
int num_dimensions,
class IStreamT,
class elemT>
68template <
int num_dimensions,
class IStreamT,
class elemT,
class InputType,
class ScaleT>
76 if (
typeid(InputType) ==
typeid(elemT))
80 scale_factor = ScaleT(1);
87 if (success == Succeeded::no)
90 return Succeeded::yes;
94template <
int num_dimensions,
class IStreamT,
class elemT,
class ScaleT>
101#define CASE(NUMERICTYPE) \
103 return read_data(s, data, NumericInfo<typename TypeForNumericType<NUMERICTYPE>::type>(), scale, byte_order)
106 CASE(NumericType::SCHAR);
107 CASE(NumericType::UCHAR);
108 CASE(NumericType::SHORT);
109 CASE(NumericType::USHORT);
110 CASE(NumericType::INT);
111 CASE(NumericType::UINT);
112 CASE(NumericType::LONG);
113 CASE(NumericType::ULONG);
114 CASE(NumericType::FLOAT);
115 CASE(NumericType::DOUBLE);
118 warning(
"read_data : type not yet supported\n, at line %d in file %s", __LINE__, __FILE__);
119 return Succeeded::no;
defines the stir::Array class for multi-dimensional (numeric) arrays
This file declares the stir::ByteOrder class.
This file declares the class stir::NumericInfo.
This file declares the stir::NumericType class.
Declaration of class stir::Succeeded.
This class provides member functions to find out what byte-order your machine is and to swap numbers.
Definition ByteOrder.h:100
class NumericInfo<NUMBER> defines properties for the type NUMBER.
Definition NumericInfo.h:68
provides names for some numeric types and methods for finding their properties.
Definition NumericType.h:55
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition Succeeded.h:44
This file declares the stir::convert_array functions. This is a function to convert stir::Array objec...
Succeeded read_data_1d(std::istream &s, ArrayType< num_dimensions, elemT > &data, const ByteOrder byte_order)
This is an internal function called by read_data(). It does the actual reading to std::istream.
Definition read_data_1d.inl:33
Succeeded read_data(IStreamT &s, ArrayType< num_dimensions, elemT > &data, const ByteOrder byte_order=ByteOrder::native)
Read the data of an Array from file.
Definition read_data.inl:63
Array< num_dimensions, T2 > convert_array(scaleT &scale_factor, const Array< num_dimensions, T1 > &data_in, const NumericInfo< T2 > info2)
A function that returns a new Array (of the same dimension) with elements of type T2.
Definition convert_array.inl:35
void warning(const char *const s,...)
Print warning with format string a la printf.
Definition warning.cxx:41
Array< num_dimensions, elemT > ArrayType
type alias for future-proofing for "large" rectangular arrays
Definition ArrayFwd.h:25
Declaration of stir::read_data_1d() functions for reading 1D stir::Array objects from file.
a templated class used to check if it's a 1D array or not This class only exists to allow a work-arou...
Definition test_if_1d.h:71
Classes for use in implementation of stir::Array, stir::BasicCoordinate etc to test if it's a 1D arra...
Declaration of stir::warning()