]> Creatis software - gdcm.git/commitdiff
ENH: Adding IsValueCountValid. Should save a lot of time for dev, since we you really...
authormalaterre <malaterre>
Fri, 21 Oct 2005 14:09:41 +0000 (14:09 +0000)
committermalaterre <malaterre>
Fri, 21 Oct 2005 14:09:41 +0000 (14:09 +0000)
src/gdcmDataEntry.cxx
src/gdcmDataEntry.h
src/gdcmFile.cxx

index 6c7a11b813f1900a2b16857dfbc783e9bdaa9eb4..7f08f14b086c7c96968d57c892d6eb4d2a89cfa0 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDataEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/20 07:23:50 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2005/10/21 14:09:41 $
+  Version:   $Revision: 1.5 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -219,6 +219,15 @@ double DataEntry::GetValue(const uint32_t &id) const
       return BinArea[id];
 }
 
+bool DataEntry::IsValueCountValid() const
+{
+  uint32_t vm;
+  ostringstream os;
+  os.str( GetVM() );
+  os >> vm;
+  return vm == GetValueCount();
+}
+
 uint32_t DataEntry::GetValueCount(void) const
 {
    const VRKey &vr = GetVR();
@@ -241,8 +250,8 @@ uint32_t DataEntry::GetValueCount(void) const
       }
       return count;
    }
-   else
-      return GetLength();
+
+   return GetLength();
 }
 
 void DataEntry::SetString(std::string const &value)
index 2469bc4669b57278d954de18942375b8a890cdba..7bd598302a1cb02dc72cfa1ef3670c3ccb6829c7 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDataEntry.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/19 08:06:45 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2005/10/21 14:09:41 $
+  Version:   $Revision: 1.3 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -63,6 +63,7 @@ public:
    void SetValue(const uint32_t &id,const double &val);
    double GetValue(const uint32_t &id) const;
    uint32_t GetValueCount(void) const;
+   bool IsValueCountValid() const;
 
    void SetString(std::string const &value);
    std::string const &GetString() const;
index 428c866e0c513d309b62b6cb66f6b57b5beafdcf..def9a2ba8bd8d53bbc5f7e4c4f92232d073eea79 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmFile.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/21 12:12:18 $
-  Version:   $Revision: 1.285 $
+  Date:      $Date: 2005/10/21 14:09:41 $
+  Version:   $Revision: 1.286 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -889,7 +889,6 @@ float File::GetZOrigin()
    entry = GetDataEntry(0x0020,0x0050);
    if( entry )
    {
-      gdcmWarningMacro( "Unfound Location (0020,0050)");
       if( entry->GetValueCount() == 1 )
          return (float)entry->GetValue(0);
       gdcmWarningMacro( "Wrong Location (0020,0050)");