]> Creatis software - gdcm.git/blobdiff - src/gdcmSerieHelper.cxx
COMP: oops could be usefull...
[gdcm.git] / src / gdcmSerieHelper.cxx
index f9fd686322cf17cdca35266b186bb823425662b7..4c62a8f074ec948580d204acd53d9888d55e036a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmSerieHelper.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/02/05 01:25:03 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2005/05/11 17:15:18 $
+  Version:   $Revision: 1.6 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -96,7 +96,7 @@ void SerieHelper::AddFileName(std::string const &filename)
 
       if ( CoherentGdcmFileListHT.count(uid) == 0 )
       {
-         gdcmVerboseMacro(" New Serie UID :[" << uid << "]");
+         gdcmWarningMacro(" New Serie UID :[" << uid << "]");
          // create a std::list in 'uid' position
          CoherentGdcmFileListHT[uid] = new GdcmFileList;
       }
@@ -105,7 +105,7 @@ void SerieHelper::AddFileName(std::string const &filename)
    }
    else
    {
-      gdcmVerboseMacro("Could not read file: " << filename );
+      gdcmWarningMacro("Could not read file: " << filename );
       delete header;
    }
 }
@@ -242,11 +242,6 @@ bool SerieHelper::ImagePositionPatientOrdering( GdcmFileList *fileList )
             dist += normal[i]*ipp[i];
          }
     
-         if( dist == 0 )
-         {
-            return false;
-         }
-
          distlist.push_back( dist );
 
          max = min = dist;
@@ -264,11 +259,6 @@ bool SerieHelper::ImagePositionPatientOrdering( GdcmFileList *fileList )
             dist += normal[i]*ipp[i];
          }
 
-         if( dist == 0 )
-         {
-            return false;
-         }
-      
          distlist.push_back( dist );
 
          min = (min < dist) ? min : dist;
@@ -285,6 +275,13 @@ bool SerieHelper::ImagePositionPatientOrdering( GdcmFileList *fileList )
    CoherentGdcmFileVector.resize( n );
    // gdcmAssertMacro( CoherentGdcmFileVector.capacity() >= n );
 
+   // Find out if min/max are coherent
+   if( min == max )
+     {
+     gdcmWarningMacro( "Looks like all images have the exact same image position...");
+     return false;
+     }
+
    float step = (max - min)/(n - 1);
    int pos;
    n = 0;
@@ -305,7 +302,7 @@ bool SerieHelper::ImagePositionPatientOrdering( GdcmFileList *fileList )
          CoherentGdcmFileVector[pos] = *it2;
       else
       {
-         gdcmVerboseMacro( "2 files same position");
+         gdcmWarningMacro( "2 files same position");
          return false;
       }
    }
@@ -389,7 +386,7 @@ void SerieHelper::Print(std::ostream &os, std::string const & indent)
    CoherentFileListmap::iterator itl = CoherentGdcmFileListHT.begin();
    if ( itl == CoherentGdcmFileListHT.end() )
    {
-      gdcmVerboseMacro( "No Coherent File list found" );
+      gdcmWarningMacro( "No Coherent File list found" );
       return;
    }
    while (itl != CoherentGdcmFileListHT.end())