]> Creatis software - gdcm.git/blobdiff - src/gdcmSerieHelper.cxx
ENH: A user does not know (and should not) what we internally use for representing...
[gdcm.git] / src / gdcmSerieHelper.cxx
index f025fd036130b2cbf8e5f0561d4def573330adec..23e60112f8a1c034b658593be36d4c05d34d7194 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmSerieHelper.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/25 12:40:03 $
-  Version:   $Revision: 1.29 $
+  Date:      $Date: 2005/11/08 16:31:21 $
+  Version:   $Revision: 1.34 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -68,7 +68,7 @@ void SerieHelper::ClearAll()
                                     it != l->end(); 
                                   ++it)
       {
-         delete *it; // remove each entry
+         (*it)->Delete(); // remove each entry
       }
       l->clear();
       delete l;     // remove the container
@@ -88,7 +88,7 @@ void SerieHelper::ClearAll()
 void SerieHelper::AddFileName(std::string const &filename)
 {
    // Create a DICOM file
-   File *header = new File ();
+   File *header = File::New();
    header->SetLoadMode(LoadMode);
    header->SetFileName( filename ); 
    header->Load();
@@ -139,13 +139,13 @@ void SerieHelper::AddFileName(std::string const &filename)
       else
       {
          // at least one rule was unmatched we need to deallocate the file:
-         delete header;
+         header->Delete();
       }
    }
    else
    {
       gdcmWarningMacro("Could not read file: " << filename );
-      delete header;
+      header->Delete();
    }
 }
 
@@ -218,12 +218,12 @@ void SerieHelper::AddGdcmFile(File *header)
  * @param value value to be checked to exclude File
  * @param op  operator we want to use to check
  */
-void SerieHelper::AddRestriction(uint16_t group, uint16_t elem
+void SerieHelper::AddRestriction(TagKey const &key
                                  std::string const &value, int op)
 {
    ExRule r;
-   r.group = group;
-   r.elem  = elem;
+   r.group = key[0];
+   r.elem  = key[1];
    r.value = value;
    r.op    = op;
    ExRestrictions.push_back( r ); 
@@ -296,10 +296,10 @@ bool SerieHelper::IsCoherent(FileList *fileSet)
 
    FileList::const_iterator it = fileSet->begin();
 
-   int nX = (*it)->GetXSize();
-   int nY = (*it)->GetYSize();
-   int pixelSize = (*it)->GetPixelSize();
-
+   int nX =               (*it)->GetXSize();
+   int nY =               (*it)->GetYSize();
+   int pixelSize =        (*it)->GetPixelSize();
+   bool signedPixelData = (*it)->IsSignedPixelData();
    it ++;
    for ( ;
          it != fileSet->end();
@@ -311,7 +311,9 @@ bool SerieHelper::IsCoherent(FileList *fileSet)
          return false;
       if ( (*it)->GetPixelSize() != pixelSize )
          return false;
-      // probabely more is to be checked (?)
+      if ( (*it)->IsSignedPixelData() != signedPixelData )
+         return false;
+      // probabely more is to be checked (?)      
    }
    return true;
 }
@@ -425,7 +427,7 @@ XCoherentFileSetmap SerieHelper::SplitOnOrientation(FileList *fileSet)
       strOrient = ossOrient.str();
       ossOrient.str("");
       // FIXME : is it a 'cleaner' way to initialize an ostringstream? 
-       
+
       if ( CoherentFileSet.count(strOrient) == 0 )
       {
          gdcmDebugMacro(" New Orientation :[" << strOrient << "]");
@@ -434,7 +436,7 @@ XCoherentFileSetmap SerieHelper::SplitOnOrientation(FileList *fileSet)
       }
       // Current Orientation and DICOM header match; add the file:
       CoherentFileSet[strOrient]->push_back( (*it) );
-   }   
+   } 
    return CoherentFileSet;
 }
 
@@ -497,7 +499,8 @@ XCoherentFileSetmap SerieHelper::SplitOnPosition(FileList *fileSet)
         ossPosition << pos[i]; 
       }      
       strPosition = ossPosition.str();
-      
+      ossPosition.str("");
+            
       if ( CoherentFileSet.count(strPosition) == 0 )
       {
          gdcmDebugMacro(" New Position :[" << strPosition << "]");