]> Creatis software - gdcm.git/commitdiff
Fix some verbosity
authorjpr <jpr>
Mon, 4 Jun 2007 08:51:23 +0000 (08:51 +0000)
committerjpr <jpr>
Mon, 4 Jun 2007 08:51:23 +0000 (08:51 +0000)
Example/ToInTag.cxx
Example/exSerieHelper.cxx
Testing/TestAllReadCompareDicom.cxx
src/gdcmSerieHelper.cxx
vtk/vtkgdcmSerieViewer2.cxx

index fbc2cc129703b2bb406d34db7083a07c175cffca..ccf6bcbeb414d211837c0135fcd60e9f94bb132a 100755 (executable)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: ToInTag.cxx,v $
   Language:  C++
-  Date:      $Date: 2007/05/29 10:36:10 $
-  Version:   $Revision: 1.12 $
+  Date:      $Date: 2007/06/04 08:51:23 $
+  Version:   $Revision: 1.13 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -436,7 +436,8 @@ int main(int argc, char *argv[])
       currentFile = it2->second;
        
       fullFilename =  currentFile->GetFileName();
-      lastFilename =  GDCM_NAME_SPACE::Util::GetName( fullFilename ); 
+      lastFilename =  GDCM_NAME_SPACE::Util::GetName( fullFilename );
+      if (verbose) 
       std::cout <<" ------------------------------------------------------------------------------" 
                 << std::endl << " Deal with [" << it2->first << "] : ["<<fullFilename << "]" 
                 << std::endl;
index 8a0133e554328191e68593750bfd10d49be894e0..01e222dfcb8e6928b0844c7c8c0d242c9d2f3de5 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exSerieHelper.cxx,v $
   Language:  C++
-  Date:      $Date: 2007/05/31 12:22:46 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2007/06/04 08:51:23 $
+  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
@@ -38,6 +38,10 @@ int main(int argc, char *argv[])
 
   
    std::cout << "Dir Name :[" << dirName << "]" << std::endl;
+   //   
+   // Something, using only SerieHelper is not enought !
+   // See also exXcoherentFileSet
+   //
 
    s = GDCM_NAME_SPACE::SerieHelper::New();
    s->SetLoadMode(GDCM_NAME_SPACE::LD_ALL);     // Load everything for each File
@@ -71,6 +75,7 @@ int main(int argc, char *argv[])
              << std::endl;
 
    int nbFiles;
+   double zspacing = 0.;
    // For all the Single SerieUID Files Sets of the GDCM_NAME_SPACE::Serie
    l = s->GetFirstSingleSerieUIDFileSet();
    while (l)
@@ -78,11 +83,16 @@ int main(int argc, char *argv[])
       nbFiles = l->size() ;
       if ( l->size() > 5 ) // Why not ? Just an example, for testing
       {
-         std::cout << "Sort list : " << nbFiles << " long" << std::endl;
-         s->OrderFileList(l);  // sort the list
+         std::cout << "Sort list : " << nbFiles << " long" << std::endl; 
+         //---------------------------------------------------------
+         s->OrderFileList(l);  // sort the list (and compute ZSpacing !)
+         //---------------------------------------------------------
+          zspacing = s->GetZSpacing();
          // Just to show : GetZSpacing from a gdcm::SerieHelper is right  
          std::cout << "GetZSpacing() of sorted SingleSerieUIDFileSet "
-                   << "from gdcm::SerieHelper: " << s->GetZSpacing() << std::endl;
+                   << "from gdcm::SerieHelper: " << zspacing << std::endl;
          std::cout << " ('-1' means all the files have the same position)" << std::endl;
          for (std::vector<GDCM_NAME_SPACE::File* >::iterator it =  l->begin();
                                             it != l->end();
index fdd84ee3423b5545ddd9ba498a0bbdf1f1012f6f..56aecc31634df67bce56481e673b2aeb846c6f9e 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestAllReadCompareDicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/11/28 16:29:13 $
-  Version:   $Revision: 1.58 $
+  Date:      $Date: 2007/06/04 08:51:24 $
+  Version:   $Revision: 1.59 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -170,7 +170,7 @@ int TestFile::ComputeSwapCode(uint32_t tag)
 {
 // FIXME : 100 % useless method !
 // "gdcm" was written on disc byte per byte.
-// when you fread if, you'll get *allways* "gdcm"
+// when you fread it, you'll get *always* "gdcm"
 // whatever the processor indianess is !
 
    int swap = 0;
@@ -197,6 +197,7 @@ int TestFile::ComputeSwapCode(uint32_t tag)
       }
       tag >>= 8;
    }
+   //std::cout << std::hex << "0x(" << tag << ")" << std::dec << tag << std::endl;
    return swap;
 }
 
@@ -260,6 +261,7 @@ bool TestFile::ReadFileHeader(std::ifstream *fp)
    SwapCode = ComputeSwapCode(tag);
    if( SwapCode == 0 )
    {
+      // We shall *never* come here!
       std::cout << "TestFile: Bad tag - Must be 'gdcm'" << std::endl;
       return(false);
    }
index accac6161b547689383dd4bffcb10b56a12b758a..0be2e44aa43c79f6b7bf9c4745b38ebc2f4e086e 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmSerieHelper.cxx,v $
   Language:  C++
-  Date:      $Date: 2007/05/23 15:30:29 $
-  Version:   $Revision: 1.55 $
+  Date:      $Date: 2007/06/04 08:51:24 $
+  Version:   $Revision: 1.56 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -694,8 +694,9 @@ bool SerieHelper::ImagePositionPatientOrdering( FileList *fileList )
    // Find out if min/max are coherent
    if ( min == max )
    {
-     gdcmWarningMacro("Looks like all images have the exact same image position"
-                      << ". No PositionPatientOrdering sort performed" );
+     gdcmWarningMacro("Looks like all images have the exact same image position. "
+                      << "No PositionPatientOrdering sort performed. " 
+                      << "No 'ZSpacing' calculated! ");
      return false;
    }
 
@@ -707,11 +708,13 @@ bool SerieHelper::ImagePositionPatientOrdering( FileList *fileList )
    {
       if (distmultimap.count((*it2).first) != 1)
       {
-         gdcmErrorMacro("File: "
+         gdcmErrorMacro("File: ["
               << ((*it2).second->GetFileName())
-              << " Distance: "
+              << "] : more than ONE file at distance: '"
               << (*it2).first
-              << " position is not unique");
+              << " (position is not unique!) " 
+              << "No PositionPatientOrdering sort performed. " 
+              << "No 'ZSpacing' calculated! ");      
 
          ok = false;
       }
@@ -889,19 +892,23 @@ void SerieHelper::CreateDefaultUniqueSeriesIdentifier()
    // A scout scan prior to a CT volume scan can share the same
    //   SeriesUID, but they will sometimes have a different Series Number
    AddRestriction( TagKey(0x0020, 0x0011) );
+   
    // 0018 0024 Sequence Name
    // For T1-map and phase-contrast MRA, the different flip angles and
    //   directions are only distinguished by the Sequence Name
    AddRestriction( TagKey(0x0018, 0x0024) );
+   
    // 0018 0050 Slice Thickness
    // On some CT systems, scout scans and subsequence volume scans will
    //   have the same SeriesUID and Series Number - YET the slice 
    //   thickness will differ from the scout slice and the volume slices.
    AddRestriction( TagKey(0x0018, 0x0050));
+   
    // 0028 0010 Rows
    // If the 2D images in a sequence don't have the same number of rows,
    // then it is difficult to reconstruct them into a 3D volume.
    AddRestriction( TagKey(0x0028, 0x0010));
+   
    // 0028 0011 Columns
    // If the 2D images in a sequence don't have the same number of columns,
    // then it is difficult to reconstruct them into a 3D volume.
@@ -995,7 +1002,7 @@ std::string SerieHelper::CreateUserDefinedFileIdentifier( File * inFile )
       const ExDetail &r = *it2;
       s = inFile->GetEntryString( r.group, r.elem );
 
-      // User is allowed to ask 'convertion', to allow further ordering
+      // User is allowed to ask for 'convertion', to allow further ordering
       // e.g : 100 would be *before* 20; 000020.00 vs 00100.00 : OK
       if (it2->convert)
       {
@@ -1013,10 +1020,10 @@ std::string SerieHelper::CreateUserDefinedFileIdentifier( File * inFile )
       for(unsigned int i=0; i<s.size(); i++)
       {
          while(i<s.size()
-            && !( s[i] == '.' || s[i] == '%'
-                    || (s[i] >= 'a' && s[i] <= 'z')
-                    || (s[i] >= '0' && s[i] <= '9')
-                    || (s[i] >= 'A' && s[i] <= 'Z')))
+               && !( s[i] == '.' || s[i] == '%'
+                 || (s[i] >= 'a' && s[i] <= 'z')
+                 || (s[i] >= '0' && s[i] <= '9')
+                 || (s[i] >= 'A' && s[i] <= 'Z')))
          {
             s.erase(i, 1);
          }
index 7b0f9b053b5c03bf0930154c56e27203bd3b0751..dade791fce23261e6d29c5b392118837b60d721b 100755 (executable)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: vtkgdcmSerieViewer2.cxx,v $
   Language:  C++
-  Date:      $Date: 2007/03/29 13:52:16 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2007/06/04 08:51:25 $
+  Version:   $Revision: 1.8 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -221,7 +221,11 @@ int main(int argc, char *argv[])
       if ( l->size() > 1 )
       {
          std::cout << "Sort list : " << nbFiles << " long" << std::endl;
-         sh->OrderFileList(l);  // sort the list
+         //---------------------------------------------------------
+         sh->OrderFileList(l);  // sort the list (and compute ZSpacing !)
+         //---------------------------------------------------------
          double zsp = sh->GetZSpacing();
          std::cout << "List sorted, ZSpacing = " << zsp << std::endl;
          break;  // The first one is OK. user will have to check