X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FexCurveData.cxx;h=c92df1516d2a63732da5adbc81b91f9b44ddbf0e;hb=217318a11796c8ab5f3307bc7f9a5f0056936474;hp=3a520e6fe0f27f59871a399ff9db1b78018de91d;hpb=1304084bfc9690503a0d701c5a115db734e22d5b;p=gdcm.git 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;