]> Creatis software - gdcm.git/blobdiff - vtk/vtkgdcmSerieViewer2.cxx
Update
[gdcm.git] / vtk / vtkgdcmSerieViewer2.cxx
index 466fcd0629b5b8fd776609dbcde26b9221b20409..e4d8e2ea4e5702534ce7df0d85be19fbfde9da61 100755 (executable)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: vtkgdcmSerieViewer2.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/03/30 17:11:11 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2007/06/08 12:41:07 $
+  Version:   $Revision: 1.9 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -21,6 +21,7 @@
 //     SerieHelper::SetOrderToReverse, 
 //     SerieHelper::SetUserLessThanFunction
 //     SerieHelper::SetLoadMode
+//     SerieHelper::SetDropDuplicatePositions
 //     vtkGdcmReader::SetUserFunction
 //     vtkGdcmReader::SetCoherentFileList
 // Usage:
@@ -85,10 +86,19 @@ public:
       {
          if ( event == vtkCommand::CharEvent )
          {
+#if (VTK_MAJOR_VERSION >= 5)
+            int max = ImageViewer->GetSliceMax();
+            int slice = (ImageViewer->GetSlice() + 1 ) % ++max;
+            ImageViewer->SetSlice( slice );
+#else
             int max = ImageViewer->GetWholeZMax();
             int slice = (ImageViewer->GetZSlice() + 1 ) % ++max;
             ImageViewer->SetZSlice( slice );
+#endif
+#if !( (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION >= 5 ) )
+         // This used to be a bug in version VTK 4.4 and earlier
             ImageViewer->GetRenderer()->ResetCameraClippingRange();
+#endif
             ImageViewer->Render();
          }
       }
@@ -105,7 +115,7 @@ int main(int argc, char *argv[])
    " usage: vtkgdcmSerieViewer dirname=sourcedirectory                        ",
    "                           [noshadowseq][noshadow][noseq]                 ",
    "                           [reverse] [{[mirror]|[topdown]|[rotate]}]      ",
-   "                           [order=] [check][debug]                        ",
+   "                           [order=] [nodup][check][debug]                 ",
    "      sourcedirectory : name of the directory holding the images          ",
    "                        if it holds more than one serie,                  ",
    "                        only the first one is displayed.                  ",
@@ -115,14 +125,15 @@ int main(int argc, char *argv[])
    "      reverse    : user wants to sort the images reverse order            ",
    "      mirror     : user wants to 'mirror' the images    | just some simple",
    "      upsidedown : user wants to 'upsidedown' the images| examples of user",
-   "                                                        | definedfunctions",
+   "                                                        | suppliedfunction",
    "      check      : user wants to force more coherence checking            ",
    "      order=     : group1-elem1,group2-elem2,... (in hexa, no space)      ",
    "                   if we want to use them as a sort criterium             ",
    "                   Right now : ValEntries only -just an example-          ",
    "        or                                                                ",
    "      order=     : order=name if we want to sort on file name (why not ?) ",
-   "      debug      : user wants to run the program in 'debug mode'          ",
+   "      nodup       : user wants to drop duplicate positions                ",
+   "      debug      : developper wants to run the program in 'debug mode'    ",
    FINISH_USAGE
 
 
@@ -150,7 +161,7 @@ int main(int argc, char *argv[])
    }
 
    int reverse = am->ArgMgrDefined("reverse");
-
+   int nodup   = am->ArgMgrDefined("nodup");
    int mirror     = am->ArgMgrDefined("mirror");
    int upsidedown = am->ArgMgrDefined("upsidedown");
 
@@ -206,13 +217,20 @@ int main(int argc, char *argv[])
    else if (orderNb != 0)
       sh->SetUserLessThanFunction(userSuppliedLessThanFunction);
 
+   if (nodup)
+      sh->SetDropDuplicatePositions(true);
+      
    while (l)
    { 
       nbFiles = l->size() ;
       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