]> Creatis software - creaBruker.git/commitdiff
Uodates
authorjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Fri, 17 Jul 2009 14:14:03 +0000 (14:14 +0000)
committerjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Fri, 17 Jul 2009 14:14:03 +0000 (14:14 +0000)
appli/CMakeLists.txt
appli/Dcm2VtkImageData/CMakeLists.txt [new file with mode: 0644]
appli/Dcm2VtkImageData/Dcm2VtkImageData.cxx [new file with mode: 0644]
appli/template_appli/CMakeLists.txt
appli/template_wx_appli/CMakeLists.txt
appli/testBruker2Dicom/CMakeLists.txt

index 282a75462acbbb35c82558dbd6f03b5159ee2009..282ad04a867ce88e9b36ad8ac3002556fb3200f0 100644 (file)
@@ -15,6 +15,7 @@ SUBDIRS(
    PrintParameterFile
    #exObjectVaryingProperties
    testBruker2Dicom
+   Dcm2VtkImageData
    #appli1_WithoutWx
    #appli2_WithWx
    
diff --git a/appli/Dcm2VtkImageData/CMakeLists.txt b/appli/Dcm2VtkImageData/CMakeLists.txt
new file mode 100644 (file)
index 0000000..dca8dfa
--- /dev/null
@@ -0,0 +1,42 @@
+
+#----------------------------------------------------------------------------
+# SET THE NAME OF YOUR EXECUTABLE
+SET ( EXE_NAME   Dcm2VtkImageData )
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# EXECUTABLE SOURCES (TO BE COMPILED)
+# EITHER LIST ALL .cxx, *.cpp, *.cc IN CURRENT DIR USING NEXT LINE:
+FILE(GLOB ${EXE_NAME}_SOURCES *.cxx *.cpp *.cc)
+# OR MANUALLY LIST YOUR FILES WITH NEXT COMMAND (WITHOUT EXTENSION)
+#  SET ( ${EXE_NAME}_SOURCES 
+#   
+#    )
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# DEPENDENCIES (LIBRARIES TO LINK WITH)
+SET ( ${EXE_NAME}_LINK_LIBRARIES
+      ${crea_LIBRARIES}
+  #    ${WXWIDGETS_LIBRARIES}
+  #    ${KWWidgets_LIBRARIES}
+       ${VTK_LIBRARIES}
+  #    ${ITK_LIBRARIES}
+      ${GDCM_LIBRARIES}
+      ${BOOST_LIBRARIES}
+      
+  #   creaBruker
+  )
+
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# CREATES AND INSTALLS THE EXE
+# Set to ON if your appli has a GUI (to build as a Win32 app on windows)
+SET(${EXE_NAME}_HAS_GUI   OFF)
+# Set to ON if your appli has a GUI but you also want a msdos console on windows
+SET(${EXE_NAME}_CONSOLE   OFF)
+CREA_ADD_EXECUTABLE( ${EXE_NAME} )
+#----------------------------------------------------------------------------
+
+
diff --git a/appli/Dcm2VtkImageData/Dcm2VtkImageData.cxx b/appli/Dcm2VtkImageData/Dcm2VtkImageData.cxx
new file mode 100644 (file)
index 0000000..1d28631
--- /dev/null
@@ -0,0 +1,100 @@
+/*=========================================================================
+                                                                                
+  Program:   gdcm
+  Module:    $RCSfile: Dcm2VtkImageData.cxx,v $
+  Language:  C++
+  Date:      $Date: 2009/07/17 14:14:04 $
+  Version:   $Revision: 1.1 $
+                                                                                
+  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
+     PURPOSE.  See the above copyright notices for more information.
+                                      
+=========================================================================*/
+
+/** 
+ * 
+ */
+
+#include "gdcmCommon.h"
+#include "gdcmDebug.h"
+#include "gdcmUtil.h"
+#include "gdcmDirList.h"
+
+#include "gdcmArgMgr.h"
+#include "vtkGdcmReader.h"
+
+// ===================================================================================================
+
+
+int main(int argc, char *argv[])
+{
+   START_USAGE(usage)
+   " \n Dcm2VtkImageData : \n                                                 ",
+   " usage: Dcm2VtkImageData dirin=rootDirectoryName                          ",
+   "                         nb=number of Slices                              ",
+   "                   [debug] [verbose]                                      ",
+   "                                                                          ",
+   "  debug      : developper wants to run the program in 'debug mode'        ",
+   FINISH_USAGE
+   
+   // ------------ Initialize Arguments Manager ---------------- 
+    
+   GDCM_NAME_SPACE::ArgMgr *am= new GDCM_NAME_SPACE::ArgMgr(argc, argv);
+  
+   if (argc == 1 || am->ArgMgrDefined("usage") )
+   {
+      am->ArgMgrUsage(usage); // Display 'usage'
+      delete am;
+      return 1;
+   }
+
+   const char *dirNamein;   
+   dirNamein  = am->ArgMgrGetString("dirin",".");
+   int nb = am->ArgMgrGetInt("nb",1);
+
+   if (am->ArgMgrDefined("debug"))
+      GDCM_NAME_SPACE::Debug::DebugOn();
+
+   bool verbose  = am->ArgMgrDefined("verbose");      
+             
+   /* if unused Param we give up */
+   if ( am->ArgMgrPrintUnusedLabels() )
+   {
+      am->ArgMgrUsage(usage);
+      delete am;
+      return 1;
+   } 
+      
+   delete am;  // we don't need Argument Manager any longer  
+
+   // ----------- End Arguments Manager ---------
+   
+//2dseq_Slice_0.dcm   
+
+   // ----- Begin Processing -----
+   vtkGdcmReader *reader = vtkGdcmReader::New();
+   std::vector <vtkImageData *> output;
+   char nomFich[1024]; // Hope it's enough !
+
+   for (int i = 0; i < nb; i++)
+   {
+      sprintf(nomFich, "%s%c2dseq_Slice_%d.dcm", 
+         dirNamein, 
+         GDCM_NAME_SPACE::GDCM_FILESEPARATOR, 
+         i);
+      if (verbose)
+         std::cout << "file to be processed : [" << nomFich << ")" << std::endl;
+      reader->SetFileName(nomFich);
+      reader->Update();
+      output.push_back(reader->GetOutput());    
+   }
+   
+   // Here you call the function that processes the vtkImageData vector  
+} 
+
+
index abff49ee674856afec899e6de311122bc161976c..020be7eb9eacbb0311a337b0d5c05decc8fdca12 100644 (file)
@@ -16,7 +16,7 @@ FILE(GLOB ${EXE_NAME}_SOURCES *.cxx *.cpp *.cc)
 #----------------------------------------------------------------------------
 # DEPENDENCIES (LIBRARIES TO LINK WITH)
 SET ( ${EXE_NAME}_LINK_LIBRARIES
-  #    ${crea_LIBRARIES}
+  ${crea_LIBRARIES}
   #    ${WXWIDGETS_LIBRARIES}
   #    ${KWWidgets_LIBRARIES}
   #    ${VTK_LIBRARIES}
index fd728c2899ad343e4595ad80836d518a75f86166..adfd6f37a5680af189c160681977973cddad81b3 100644 (file)
@@ -18,6 +18,7 @@ FILE(GLOB ${EXE_NAME}_SOURCES *.cxx *.cpp *.cc)
 SET ( ${EXE_NAME}_LINK_LIBRARIES
   ${crea_LIBRARIES}
   #    ${WXWIDGETS_LIBRARIES}
+  #    ${KWWidgets_LIBRARIES}
   #    ${VTK_LIBRARIES}
   #    ${ITK_LIBRARIES}
   #    ${GDCM_LIBRARIES}
index 005754396b0737881eac8b47cb70e61c259848df..61bad20fe3cbfa669ba07ccbeb0783f4fd82359c 100755 (executable)
@@ -25,6 +25,8 @@ SET ( ${EXE_NAME}_LINK_LIBRARIES
       ${GDCM_LIBRARIES}
       ${BOOST_LIBRARIES}
       
+  # Add here those agmonst the various (?) PROJECT LIBRARIES you need
+  # for the current executable      
       creaBruker
   )