18 #ifndef __stir_ImagingModality_H__ 19 #define __stir_ImagingModality_H__ 51 : modality(modality_v)
68 explicit ImagingModality(
const std::string& modality_string_v) { this->set_from_string(modality_string_v); }
73 std::string
get_name()
const {
return this->modality_string; }
75 bool operator==(
const ImagingModality& mod)
const {
return this->modality == mod.modality; }
76 bool operator!=(
const ImagingModality& mod)
const {
return !(*
this == mod); }
77 bool is_known()
const {
return this->modality != Unknown; }
78 bool is_unknown()
const {
return this->modality == Unknown; }
82 std::string modality_string;
86 switch (this->modality)
89 this->modality_string =
"PT";
92 this->modality_string =
"NM";
95 this->modality_string =
"MR";
98 this->modality_string =
"CT";
101 this->modality_string =
"US";
104 this->modality_string =
"Optical";
108 this->modality_string =
"Unknown";
113 void set_from_string(
const std::string& modality)
116 if (mod ==
"pt" || mod ==
"pet")
118 else if (mod ==
"nm" || mod ==
"nucmed" || mod ==
"spect")
120 else if (mod ==
"mr" || mod ==
"mri")
122 else if (mod ==
"ct" || mod ==
"cat")
124 else if (mod ==
"us" || mod ==
"ultrasound")
126 else if (mod ==
"optical")
127 this->modality = Optical;
130 if (!mod.empty() && mod !=
"unknown")
131 warning(
"Unrecognised modality: '" + mod +
"'. Setting to Unknown");
132 this->modality = Unknown;
Namespace for the STIR library (and some/most of its applications)
Definition: General_Reconstruction.cxx:6
ImagingModality(ImagingModalityValue modality_v=Unknown)
Construct from enum, set string accordingly.
Definition: ImagingModality.h:50
std::string get_name() const
Returns name as a standardised string (in DICOM conventions)
Definition: ImagingModality.h:73
ImagingModalityValue
enum with possible values (using DICOM naming)
Definition: ImagingModality.h:38
Class for encoding the modality.
Definition: ImagingModality.h:34
string standardise_interfile_keyword(const string &keyword)
Put a (Interfile) keyword into a standard form.
Definition: interfile_keyword_functions.cxx:28
void warning(const char *const s,...)
Print warning with format string a la printf.
Definition: warning.cxx:41
Functions useful for manipulating Interfile keywords.
ImagingModality(const std::string &modality_string_v)
Construct from string, set enum accordingly.
Definition: ImagingModality.h:68
Declaration of stir::warning()