Program: gdcm
Module: $RCSfile: gdcmVR.cxx,v $
Language: C++
- Date: $Date: 2005/02/05 01:37:09 $
- Version: $Revision: 1.35 $
+ Date: $Date: 2005/10/20 08:58:18 $
+ Version: $Revision: 1.42 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
namespace gdcm
{
//-----------------------------------------------------------------------------
+/// \brief auto generated function, to fill up the 'Value Representation'
+/// Dictionnary, if relevant file is not found on user's disk
void FillDefaultVRDict(VRHT &vr);
//-----------------------------------------------------------------------------
{
std::string filename = DictSet::BuildDictPath() + DICT_VR;
std::ifstream from(filename.c_str());
- if(!from)
+ if ( !from )
{
gdcmWarningMacro("Can't open dictionary" << filename.c_str());
FillDefaultVRDict(vr);
from >> std::ws;
from.getline(buff, 1024, '\n');
- if(key != "")
+ if ( key != "" )
{
vr[key] = name;
}
//-----------------------------------------------------------------------------
// Public
-/**
- * \brief Get the count for an element
- * @param key key to count
- */
-int VR::Count(VRKey const &key)
-{
- return vr.count(key);
-}
/**
* \brief Simple predicate that checks whether the given argument
- * corresponds to the Value Representation of a \ref BinEntry .
+ * corresponds to the Value Representation of a \ref DataEntry .
* @param tested value representation to check for.
*/
bool VR::IsVROfBinaryRepresentable(VRKey const &tested)
{
- if ( tested == GDCM_UNKNOWN)
- return true;
+ //if ( tested == GDCM_UNKNOWN)
+ //{
+ //std::cout << "---------- never used --------------" << tested
+ // << std::endl;
+ // return true;
+ //}
if ( IsVROfStringRepresentable(tested) )
return false;
/**
* \brief Simple predicate that checks whether the given argument
- * corresponds to the Value Representation of a \ref ValEntry
- * but NOT a \ref BinEntry.
+ * corresponds to the Value Representation of a representable
+ * string.
* @param tested value representation to be checked.
*/
bool VR::IsVROfStringRepresentable(VRKey const &tested)
tested == "TM" ||
tested == "UI" ||
tested == "UL" ||
- tested == "UN" ||
- tested == "US";
-}
-
-/**
- * \brief Simple predicate that checks whether the given argument
- * corresponds to the Value Representation of a \ref SeqEntry
- * @param tested value representation to check for.
- */
-bool VR::IsVROfSequence(VRKey const &tested)
-{
- return tested == "SQ";
+ tested == "US" ||
+ tested == "UT";
+
+ // Should be quicker --> But it doesn't work : revert to old code
+/*
+ return tested != "FL" &&
+ tested != "FD" &&
+ tested != "OB" &&
+ tested != "OW" &&
+ tested != "AT" && // Attribute Tag ?!?
+ tested != "SQ" ;
+*/
}
-bool VR::IsValidVR(VRKey const &key)
+unsigned short VR::GetAtomicElementLength(VRKey const &tested)
{
- return vr.find(key) != vr.end();
+ // Unsigned & signed short
+ if( tested == "US" || tested == "SS" )
+ return 2;
+ // Unsigned & signed long
+ if( tested == "UL" || tested == "SL" )
+ return 4;
+ // Float
+ if( tested == "FL" )
+ return 4;
+ // Double
+ if( tested == "FD" )
+ return 8;
+ // Word string
+ if( tested == "OW" )
+ return 2;
+ return 1;
}
//-----------------------------------------------------------------------------