]> Creatis software - gdcm.git/commitdiff
In SerieHeader::ImagePositionPatientOrdering()
authorjpr <jpr>
Tue, 18 Jan 2005 11:56:52 +0000 (11:56 +0000)
committerjpr <jpr>
Tue, 18 Jan 2005 11:56:52 +0000 (11:56 +0000)
      // a Dicom 'Serie' may contain scout views
// and images may have differents directions.
// -> More than one may have the same 'pos'
// Sorting has then NO meaning !

Thx to Eduardo Davila for reporting bug.

src/gdcmSerieHeader.cxx

index 05f2ecef1d6be1e665e3924081ef317802459609..3349af5882b6840d76ee2e4bdea726267a56dfda 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmSerieHeader.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/18 08:01:42 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2005/01/18 11:56:52 $
+  Version:   $Revision: 1.11 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -236,8 +236,15 @@ bool SerieHeader::ImagePositionPatientOrdering()
       //2*n sort algo !!
       //Assumption: all files are present (no one missing)
       pos = (int)( fabs( (distlist[n]-min)/step) + .5 );
-            
-      CoherentGdcmFileVector[pos] = *it2;
+
+      // a Dicom 'Serie' may contain scout views
+      // and images may have differents directions
+      // -> More than one may have the same 'pos'
+      // Sorting has then NO meaning !
+      if (CoherentGdcmFileVector[pos]==NULL)
+         CoherentGdcmFileVector[pos] = *it2;
+      else
+         return false;
    }
 
    CoherentGdcmFileList.clear();  //this doesn't delete list's element, node only