From: malaterre Date: Mon, 10 Oct 2005 20:42:33 +0000 (+0000) Subject: ENH: Adding a conversion from acronym data type to the full desc X-Git-Tag: Version1.2.bp~36 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=e45a5cec8433fe360f34dd7c74f32c8fbcd9684f;p=gdcm.git ENH: Adding a conversion from acronym data type to the full desc --- diff --git a/Example/exCurveData.cxx b/Example/exCurveData.cxx index 3a520e6f..c92df151 100644 --- a/Example/exCurveData.cxx +++ b/Example/exCurveData.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: exCurveData.cxx,v $ Language: C++ - Date: $Date: 2005/10/10 20:02:09 $ - Version: $Revision: 1.1 $ + Date: $Date: 2005/10/10 20:42:33 $ + Version: $Revision: 1.2 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -22,6 +22,39 @@ #include "gdcmDocEntry.h" #include "gdcmBinEntry.h" +static const char* TypeOfDataArrays[13][2] = { + { "TAC" , "time activity curve" }, + { "PROF" , "image profile" }, + { "HIST" , "histogram" }, + { "ROI" , "polygraphic region of interest" }, + { "TABL" , "table of values" }, + { "FILT" , "filter kernel" }, + { "POLY" , "poly line" }, + { "ECG" , "ecg data" }, + { "PRESSURE" , "pressure data" }, + { "FLOW" , "flow data" }, + { "PHYSIO" , "physio data" }, + { "RESP" , "Respiration trace" }, + NULL +}; + +// Part 3, C.10.2.1.1 Type of data +// Convert from acronym to full description +const char *ConvertTypeOfData(std::string const &type) +{ + const char **p = *TypeOfDataArrays; + while(*p != NULL) + { + if( p[0] == type ) // std::string== operator + { + // ok we found it: + return p[1]; + } + p+=2; + } + return NULL; +} + // Helper function template inline size_t PrintCurveData(DataValueRepresentation* data, unsigned short numPts) @@ -124,6 +157,7 @@ int main(int argc, char *argv[]) //* V 5004|0020 [CS] [Type of Data] [PHYSIO] std::string data_type = f->GetEntryValue(0x5004,0x0020); std::cout << "Type of Data: " << data_type << std::endl; + std::cout << " this is thus a : " << ConvertTypeOfData(data_type) << std::endl; //* V 5004|0022 [LO] [Curve Description] [] std::string curve_desc = f->GetEntryValue(0x5004,0x0022); std::cout << "Curve Description: " << curve_desc << std::endl;