]> Creatis software - creaBruker.git/blobdiff - appli/testBruker2Dicom/testBruker2Dicom.cxx
BUG #1917
[creaBruker.git] / appli / testBruker2Dicom / testBruker2Dicom.cxx
index b81541029e6a5ffd421633b0ae322f73fca95c6f..6ccdf93140e59853c79e4cd0739d46320ae15622 100644 (file)
@@ -1,14 +1,38 @@
+/*
+       # ---------------------------------------------------------------------
+       #
+       # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
+       #                        pour la Santé)
+       # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+       # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+       # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+       #
+       #  This software is governed by the CeCILL-B license under French law and 
+       #  abiding by the rules of distribution of free software. You can  use, 
+       #  modify and/ or redistribute the software under the terms of the CeCILL-B 
+       #  license as circulated by CEA, CNRS and INRIA at the following URL 
+       #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+       #  or in the file LICENSE.txt.
+       #
+       #  As a counterpart to the access to the source code and  rights to copy,
+       #  modify and redistribute granted by the license, users are provided only
+       #  with a limited warranty  and the software's author,  the holder of the
+       #  economic rights,  and the successive licensors  have only  limited
+       #  liability. 
+       #
+       #  The fact that you are presently reading this means that you have had
+       #  knowledge of the CeCILL-B license and that you accept its terms.
+       # ------------------------------------------------------------------------
+*/
+
 /*=========================================================================
                                                                                 
-  Program:   gdcm
+  Program:   creaBruker
   Module:    $RCSfile: testBruker2Dicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/12/14 14:08:08 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2012/11/15 13:31:58 $
+  Version:   $Revision: 1.12 $
                                                                                 
-  Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
-  l'Image). All rights reserved. See Doc/License.txt or
-  http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
                                                                                 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
@@ -35,7 +59,7 @@
 
 // ===================================================================================================
 /**
-  * \brief   
+  * \brief
   *          - explores  the given root directory e.g. :
   *            B67d1.Bp1
   *              subject
@@ -63,7 +87,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,
-  */  
-  
+  *          - fills an equivalent Directory with the MHD / DICOM files,
+  */
+
 
 int main(int argc, char *argv[])
 {
    START_USAGE(usage)
    " \n testBruker2Dicom : \n                                                 ",
    " - explores the given directory (holding a FULL Bruker exam), 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]                           ",
+   " - 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                                ",   
@@ -109,7 +133,7 @@ int main(int argc, char *argv[])
    // ------------ 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;
@@ -120,30 +144,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() )
    {
@@ -157,8 +181,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  
+
+ delete am;  // we don't need Argument Manager any longer
 
    // ----------- End Arguments Manager ---------
    
@@ -169,7 +193,7 @@ int main(int argc, char *argv[])
    b2d.SetOutputDirectory(dirNameout);
 
    /// \TODO : *do* use exceptions in the methods!
-      
+
    try {
       b2d.Execute();
    }
@@ -190,6 +214,6 @@ int main(int argc, char *argv[])
    }
 
 
-} 
+}