Program: gdcm
Module: $RCSfile: gdcmDicomDir.cxx,v $
Language: C++
- Date: $Date: 2004/10/09 03:21:55 $
- Version: $Revision: 1.71 $
+ Date: $Date: 2004/10/10 00:42:54 $
+ Version: $Revision: 1.72 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
if( tmpGr == 0x0004 && tmpEl == 0x1130 ) // File-set ID
{
// force to the *end* File Name
- val = GetName( path );
+ val = gdcmUtil::GetName( path );
}
else if( tmpGr == 0x0004 && tmpEl == 0x1500 ) // Only used for image
{
Program: gdcm
Module: $RCSfile: gdcmDicomDirElement.cxx,v $
Language: C++
- Date: $Date: 2004/10/09 03:21:55 $
- Version: $Revision: 1.18 $
+ Date: $Date: 2004/10/10 00:42:54 $
+ Version: $Revision: 1.19 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
s << "Meta Elements :"<<std::endl;
for (it = DicomDirMetaList.begin(); it != DicomDirMetaList.end(); ++it)
{
- greltag = Format("%04x|%04x ",it->Group,it->Elem);
+ greltag = gdcmUtil::Format("%04x|%04x ",it->Group,it->Elem);
s << " (" << greltag << ") = " << it->Value << std::endl;
}
s << "Patient Elements :"<<std::endl;
for (it = DicomDirPatientList.begin(); it != DicomDirPatientList.end(); ++it)
{
- greltag = Format("%04x|%04x ",it->Group,it->Elem);
+ greltag = gdcmUtil::Format("%04x|%04x ",it->Group,it->Elem);
s << " (" << greltag << ") = " << it->Value << std::endl;
}
s << "Study Elements :"<<std::endl;
for (it = DicomDirStudyList.begin(); it != DicomDirStudyList.end(); ++it)
{
- greltag = Format("%04x|%04x ", it->Group, it->Elem);
+ greltag = gdcmUtil::Format("%04x|%04x ", it->Group, it->Elem);
s << " (" << greltag << ") = " << it->Value << std::endl;
}
s << "Serie Elements :"<<std::endl;
for (it = DicomDirSerieList.begin(); it != DicomDirSerieList.end(); ++it)
{
- greltag = Format("%04x|%04x ", it->Group, it->Elem);
+ greltag = gdcmUtil::Format("%04x|%04x ", it->Group, it->Elem);
s << " (" << greltag << ") = " << it->Value << std::endl;
}
s << "Image Elements :"<<std::endl;
for (it = DicomDirImageList.begin(); it != DicomDirImageList.end(); ++it)
{
- greltag = Format("%04x|%04x ", it->Group, it->Elem);
+ greltag = gdcmUtil::Format("%04x|%04x ", it->Group, it->Elem);
s << " (" << greltag << ") = " << it->Value << std::endl;
}
Program: gdcm
Module: $RCSfile: gdcmDictEntry.cxx,v $
Language: C++
- Date: $Date: 2004/10/09 02:57:11 $
- Version: $Revision: 1.24 $
+ Date: $Date: 2004/10/10 00:42:54 $
+ Version: $Revision: 1.25 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
gdcmTagKey gdcmDictEntry::TranslateToKey(uint16_t group, uint16_t element)
{
- gdcmTagKey key = Format("%04x|%04x", group , element);
+ gdcmTagKey key = gdcmUtil::Format("%04x|%04x", group , element);
return key;
}
Program: gdcm
Module: $RCSfile: gdcmDirList.cxx,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:06 $
- Version: $Revision: 1.21 $
+ Date: $Date: 2004/10/10 00:42:54 $
+ Version: $Revision: 1.22 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
gdcmDirList::gdcmDirList(std::string dirName, bool recursive)
{
name = dirName;
- NormalizePath(name);
+ gdcmUtil::NormalizePath(name);
Explore(name, recursive);
}
{
int numberOfFiles = 0;
std::string fileName;
- NormalizePath(dirName);
+ gdcmUtil::NormalizePath(dirName);
#if defined(_MSC_VER) || (__CYGWIN__)
WIN32_FIND_DATA fileData;
HANDLE hFile=FindFirstFile((dirName+"*").c_str(),&fileData);
Program: gdcm
Module: $RCSfile: gdcmDocEntry.cxx,v $
Language: C++
- Date: $Date: 2004/10/09 03:31:26 $
- Version: $Revision: 1.25 $
+ Date: $Date: 2004/10/10 00:42:54 $
+ Version: $Revision: 1.26 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
lgth = GetReadLength(); // ReadLength, as opposed to UsableLength
if (lgth == 0xffffffff)
{
- st = Format("x(ffff)"); // I said : "x(ffff)" !
+ st = gdcmUtil::Format("x(ffff)"); // I said : "x(ffff)" !
s.setf(std::ios::left);
s << std::setw(10-st.size()) << " ";
s << st << " ";
}
else
{
- st = Format("x(%x)",lgth);
+ st = gdcmUtil::Format("x(%x)",lgth);
s.setf(std::ios::left);
s << std::setw(10-st.size()) << " ";
s << st << " ";
s << std::setw(8) << lgth;
}
s << " Off.: ";
- st = Format("x(%x)",o);
+ st = gdcmUtil::Format("x(%x)",o);
s << std::setw(10-st.size()) << " ";
s << st << " ";
s << std::setw(8) << o;
Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2004/10/09 03:36:56 $
- Version: $Revision: 1.99 $
+ Date: $Date: 2004/10/10 00:42:54 $
+ Version: $Revision: 1.100 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
gdcmVRKey vr = valEntry->GetVR();
if( vr == "US" || vr == "SS" )
{
- c = CountSubstring(content, "\\") + 1; // for multivaluated items
+ c = gdcmUtil::CountSubstring(content, "\\") + 1; // for multivaluated items
l = c*2;
}
else if( vr == "UL" || vr == "SL" )
{
- c = CountSubstring(content, "\\") + 1; // for multivaluated items
+ c = gdcmUtil::CountSubstring(content, "\\") + 1; // for multivaluated items
l = c*4;;
}
}
{
// We thought this was explicit VR, but we end up with an
// implicit VR tag. Let's backtrack.
- msg = Format("Falsely explicit vr file (%04x,%04x)\n",
+ msg = gdcmUtil::Format("Falsely explicit vr file (%04x,%04x)\n",
entry->GetGroup(), entry->GetElement());
dbg.Verbose(1, "gdcmDocument::FindVR: ", msg.c_str());
uint16_t newInt16;
tokens.erase( tokens.begin(), tokens.end()); // clean any previous value
- Tokenize (((gdcmValEntry *)entry)->GetValue(), tokens, "\\");
+ gdcmUtil::Tokenize (((gdcmValEntry *)entry)->GetValue(), tokens, "\\");
for (unsigned int i=0; i<tokens.size(); i++)
{
newInt16 = atoi(tokens[i].c_str());
uint32_t newInt32;
tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
- Tokenize (((gdcmValEntry *)entry)->GetValue(), tokens, "\\");
+ gdcmUtil::Tokenize (((gdcmValEntry *)entry)->GetValue(), tokens, "\\");
for (unsigned int i=0; i<tokens.size();i++)
{
newInt32 = atoi(tokens[i].c_str());
Program: gdcm
Module: $RCSfile: gdcmHeader.cxx,v $
Language: C++
- Date: $Date: 2004/10/09 03:42:51 $
- Version: $Revision: 1.191 $
+ Date: $Date: 2004/10/10 00:42:54 $
+ Version: $Revision: 1.192 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
{
// no (GrPixel, NumPixel) element
std::string s_lgPix;
- s_lgPix = Format("%d", i_lgPix+12);
+ s_lgPix = gdcmUtil::Format("%d", i_lgPix+12);
ReplaceOrCreateByNumber(s_lgPix,GrPixel, 0x0000);
}
}
tokens.clear(); // clean any previous value
- Tokenize ( lutDescription, tokens, "\\" );
+ gdcmUtil::Tokenize ( lutDescription, tokens, "\\" );
//LutLength=atoi(tokens[0].c_str());
//LutDepth=atoi(tokens[1].c_str());
void gdcmHeader::SetImageDataSize(size_t ImageDataSize)
{
///FIXME I don't understand this code wh ydo we set two times 'car' ?
- std::string car = Format("%d", ImageDataSize);
+ std::string car = gdcmUtil::Format("%d", ImageDataSize);
gdcmDocEntry *a = GetDocEntryByNumber(GrPixel, NumPixel);
a->SetLength(ImageDataSize);
ImageDataSize += 8;
- car = Format("%d", ImageDataSize);
+ car = gdcmUtil::Format("%d", ImageDataSize);
SetEntryByNumber(car, GrPixel, NumPixel);
}
Program: gdcm
Module: $RCSfile: gdcmJpeg12.cxx,v $
Language: C++
- Date: $Date: 2004/10/08 17:24:54 $
- Version: $Revision: 1.18 $
+ Date: $Date: 2004/10/10 00:42:55 $
+ Version: $Revision: 1.19 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
extern "C" {
-//#include <stdio.h>
#include "src/jpeg/libijg12/jconfig.h"
#include "src/jpeg/libijg12/jpeglib.h"
-//#include "jconfig12.h"
#include <setjmp.h>
}
/******************** JPEG COMPRESSION SAMPLE INTERFACE *******************/
Program: gdcm
Module: $RCSfile: gdcmJpeg8.cxx,v $
Language: C++
- Date: $Date: 2004/10/08 17:24:54 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2004/10/10 00:42:55 $
+ Version: $Revision: 1.4 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
extern "C" {
-//#include "stdio.h"
#include "src/jpeg/libijg8/jconfig.h"
#include "src/jpeg/libijg8/jpeglib.h"
Program: gdcm
Module: $RCSfile: gdcmUtil.cxx,v $
Language: C++
- Date: $Date: 2004/10/09 02:57:12 $
- Version: $Revision: 1.52 $
+ Date: $Date: 2004/10/10 00:42:55 $
+ Version: $Revision: 1.53 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <stdarg.h> //only included in implementation file
#include <stdio.h> //only included in implementation file
-std::string Format(const char* format, ...)
+std::string gdcmUtil::Format(const char* format, ...)
{
char buffer[2048];
va_list args;
* \ingroup Globals
* \brief Because not available in C++ (?)
*/
-void Tokenize (const std::string& str,
+void gdcmUtil::Tokenize (const std::string& str,
std::vector<std::string>& tokens,
const std::string& delimiters)
{
* Counts the number of occurences of a substring within a string
*/
-int CountSubstring (const std::string& str,
+int gdcmUtil::CountSubstring (const std::string& str,
const std::string& subStr)
{
int count = 0; // counts how many times it appears
* to avoid corrupting the terminal of invocation when printing)
* @param s string to remove non printable characters from
*/
-std::string CreateCleanString(std::string s)
+std::string gdcmUtil::CreateCleanString(std::string s)
{
std::string str = s;
* \brief Add a SEPARATOR to the end of the name is necessary
* @param name file/directory name to normalize
*/
-void NormalizePath(std::string &name)
+void gdcmUtil::NormalizePath(std::string &name)
{
const char SEPARATOR_X = '/';
const char SEPARATOR_WIN = '\\';
* \brief Get the (directory) path from a full path file name
* @param fullName file/directory name to extract Path from
*/
-std::string GetPath(std::string &fullName)
+std::string gdcmUtil::GetPath(std::string &fullName)
{
int pos1 = fullName.rfind("/");
int pos2 = fullName.rfind("\\");
* \brief Get the (last) name of a full path file name
* @param fullName file/directory name to extract end name from
*/
-std::string GetName(std::string &fullName)
+std::string gdcmUtil::GetName(std::string &fullName)
{
int fin = fullName.length()-1;
char a =fullName.c_str()[fin];
Program: gdcm
Module: $RCSfile: gdcmUtil.h,v $
Language: C++
- Date: $Date: 2004/10/09 02:57:12 $
- Version: $Revision: 1.34 $
+ Date: $Date: 2004/10/10 00:42:55 $
+ Version: $Revision: 1.35 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
//-----------------------------------------------------------------------------
-GDCM_EXPORT std::string Format(const char* format, ...);
-GDCM_EXPORT void Tokenize (const std::string& str,
- std::vector<std::string>& tokens,
- const std::string& delimiters = " ");
-GDCM_EXPORT int CountSubstring (const std::string& str,
- const std::string& subStr);
-GDCM_EXPORT std::string CreateCleanString(std::string s);
-GDCM_EXPORT void NormalizePath(std::string &name);
-GDCM_EXPORT std::string GetPath(std::string &fullName);
-GDCM_EXPORT std::string GetName(std::string &fullName);
+class GDCM_EXPORT gdcmUtil
+{
+public:
+ static std::string Format(const char* format, ...);
+ static void Tokenize (const std::string& str,
+ std::vector<std::string>& tokens,
+ const std::string& delimiters = " ");
+ static int CountSubstring (const std::string& str,
+ const std::string& subStr);
+
+ static std::string CreateCleanString(std::string s);
+ static void NormalizePath(std::string &name);
+ static std::string GetPath(std::string &fullName);
+ static std::string GetName(std::string &fullName);
+};
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmValEntry.cxx,v $
Language: C++
- Date: $Date: 2004/10/09 03:48:25 $
- Version: $Revision: 1.28 $
+ Date: $Date: 2004/10/10 00:42:55 $
+ Version: $Revision: 1.29 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
gdcmTS * ts = gdcmGlobal::GetTS();
v = GetValue(); // not applicable for SQ ...
- d2 = CreateCleanString(v); // replace non printable characters by '.'
+ d2 = gdcmUtil::CreateCleanString(v); // replace non printable characters by '.'
if( (GetLength()<=MAX_SIZE_PRINT_ELEMENT_VALUE) ||
//(PrintLevel>=3) || (d2.find("gdcm::NotLoaded.") < d2.length()) )
(PrintLevel>=3) || (d2.find(GDCM_NOTLOADED) < d2.length()) )
{
if (v == "4294967295") // to avoid troubles in convertion
{
- st = Format(" x(ffffffff)");
+ st = gdcmUtil::Format(" x(ffffffff)");
}
else
{
if ( GetLength() !=0 )
{
- st = Format(" x(%x)", atoi(v.c_str()));//FIXME
+ st = gdcmUtil::Format(" x(%x)", atoi(v.c_str()));//FIXME
}
else
{
- st = Format(" ");
+ st = gdcmUtil::Format(" ");
}
}
s << st;
// we split the string and write each value as a short int
std::vector<std::string> tokens;
tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
- Tokenize (GetValue(), tokens, "\\");
+ gdcmUtil::Tokenize (GetValue(), tokens, "\\");
for (unsigned int i=0; i<tokens.size();i++)
{
uint16_t val_uint16 = atoi(tokens[i].c_str());
// along the '\' and write each value as an int:
std::vector<std::string> tokens;
tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
- Tokenize (GetValue(), tokens, "\\");
+ gdcmUtil::Tokenize (GetValue(), tokens, "\\");
for (unsigned int i=0; i<tokens.size();i++)
{
uint32_t val_uint32 = atoi(tokens[i].c_str());
Program: gdcm
Module: $RCSfile: gdcmValEntry.h,v $
Language: C++
- Date: $Date: 2004/10/07 21:05:40 $
- Version: $Revision: 1.24 $
+ Date: $Date: 2004/10/10 00:42:55 $
+ Version: $Revision: 1.25 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/// \brief Returns the 'Value' (e.g. "Dupond Marcel") converted into a
/// 'string', if it's stored as an integer in the header of the
/// current Dicom Document Entry
- std::string GetValue() { return Value; };
+ std::string & GetValue() { return Value; };
/// Sets the value (string) of the current Dicom Document Entry
void SetValue(std::string const & val) { Value = val; };