--- /dev/null
+
+#----------------------------------------------------------------------------
+# 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} )
+#----------------------------------------------------------------------------
+
+
--- /dev/null
+/*=========================================================================
+
+ 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
+}
+
+