]> Creatis software - creaBruker.git/blobdiff - appli/testBruker2Dicom/testBruker2Dicom.cxx
Don't compile appli untill they are converted to GDCM2
[creaBruker.git] / appli / testBruker2Dicom / testBruker2Dicom.cxx
index a9a6c328abf6126873f73c53fc727cad4990f190..bcadbc55614a1e552bd9b6222042ff384e9f7b83 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: testBruker2Dicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/05/27 10:43:07 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2010/04/22 17:20:41 $
+  Version:   $Revision: 1.10 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 #include "gdcmArgMgr.h"
 
 #include "bruker2dicom.h"
+#include "brukerexception.h"
 
 // ===================================================================================================
 /**
-  * \brief   
+  * \brief
   *          - explores  the given root directory e.g. :
   *            B67d1.Bp1
   *              subject
@@ -62,7 +63,7 @@
   *                       isa  <--
   *                       meta
   *                       procs
-  *                       roi                      ...                   
+  *                       roi                      ...
   *                       roi
   *                    3               // post processed images (if any)
   *                       2dseq
   *                       meta
   *                       procs
   *                       roi
-  *                    ...        
+  *                    ...
   *              2
   *                 acqp
   *                 fid
   *                 ...
   *                 pdata
-  *              3         
+  *              3
   *                ...
   *          - fills a single level Directory with the MHD files,
-  */  
-  
+  */
+
 
 int main(int argc, char *argv[])
 {
    START_USAGE(usage)
    " \n testBruker2Dicom : \n                                                 ",
-   " - explores the given directory, at the 3 levels,                         ",
-   " - fills an equivalent Directory with the MHD files or the DICOM files    ",
-   " usage: testBruker2Dicom dirin=rootDirectoryName                          ",
-   "                         dirout=outputDirectoryName                       ",
-   "                   [D] [M]                                                ",
-   "                   [{b|l}] b:BigEndian,l:LittleEndian default : l         ",
-   "                   [debug] [verbose] [listonly]                           ",
+   " - explores the given directory (holding a FULL Bruker exam), at the 3 levels,",
+   " - fills an equivalent Directory with the MHD files and/or the DICOM files",
+   " usage: testBruker2Dicom --dirin=rootDirectoryName                        ",
+   "                         --dirout=outputDirectoryName                     ",
+   "                   [-D] [-M]                                              ",
+   "                   [{-b|-l}] b:BigEndian,l:LittleEndian default : l       ",
+   "                   [--debug] [--verbose] [--listonly] [--usage]           ",
    "                                                                          ",
    "   D         : user wants to export as DICOM                              ",
    "   M         : user wants to export as MHD                                ",   
    "  debug      : developper wants to run the program in 'debug mode'        ",
+   "                                                                          ",   
+   "  REMARK :                                                                ",   
+   "         If you were supplied  an *incomplete* Bruker exam                ",
+   "        (e.g. only the '2' serie) put it a 'root' directory,              ",
+   "         and run this test using this 'root' directory as 'dirin'         ",   
    FINISH_USAGE
    
    // ------------ Initialize Arguments Manager ----------------  
    GDCM_NAME_SPACE::ArgMgr *am= new GDCM_NAME_SPACE::ArgMgr(argc, argv);
   
-   if (argc == 1 || am->ArgMgrDefined("usage") )
+   if (argc == 1 || am->ArgMgrDefined("--usage") )
    {
       am->ArgMgrUsage(usage); // Display 'usage'
       delete am;
@@ -114,30 +120,30 @@ int main(int argc, char *argv[])
    Bruker2Dicom b2d;
       
    const char *dirNamein;   
-   dirNamein  = am->ArgMgrGetString("dirin",".");
+   dirNamein  = am->ArgMgrGetString("--dirin",".");
 
    const char *dirNameout;   
-   dirNameout  = am->ArgMgrGetString("dirout",".");
+   dirNameout  = am->ArgMgrGetString("--dirout",".");
 
 // note : Big Endian / Little Endian pb not yet dealt with.
 //        not a great issue, since everybody (?) works on Intell procs  
-   int b = am->ArgMgrDefined("b");
-   int l = am->ArgMgrDefined("l");
+   int b = am->ArgMgrDefined("-b");
+   int l = am->ArgMgrDefined("-l");
 
-   if (am->ArgMgrDefined("debug"))
+   if (am->ArgMgrDefined("--debug"))
       GDCM_NAME_SPACE::Debug::DebugOn();
 
-   b2d.verbose  = am->ArgMgrDefined("verbose");      
-   int listonly = am->ArgMgrDefined("listonly");
+   b2d.verbose  = am->ArgMgrDefined("--verbose");      
+   int listonly = am->ArgMgrDefined("--listonly");
    
-   int dicom    = am->ArgMgrDefined("D");
-   int mhd      = am->ArgMgrDefined("M");
+   int dicom    = am->ArgMgrDefined("-D");
+   int mhd      = am->ArgMgrDefined("-M");
    
    if (dicom)
       b2d.SetConvertModeToDicom();
    if (mhd)
       b2d.SetConvertModeToMhd();
-             
+
    /* if unused Param we give up */
    if ( am->ArgMgrPrintUnusedLabels() )
    {
@@ -151,8 +157,8 @@ int main(int argc, char *argv[])
 
 // b2d.day : unused  ...
    b2d.day          = am->ArgMgrGetString("day", "You_forget_the_Day");
-      
-  
+
+ delete am;  // we don't need Argument Manager any longer
 
    // ----------- End Arguments Manager ---------
    
@@ -163,7 +169,7 @@ int main(int argc, char *argv[])
    b2d.SetOutputDirectory(dirNameout);
 
    /// \TODO : *do* use exceptions in the methods!
-      
+
    try {
       b2d.Execute();
    }
@@ -178,9 +184,12 @@ int main(int argc, char *argv[])
    }
   */
 
+   catch (BrukerHopelessException &e)
+   {
+      std::cout << "And Hopless Exception was thrown  (" << e.what() << ") " << std::endl;
+   }
 
 
- delete am;  // we don't need Argument Manager any longer
-} 
+}