From 0e3a02d90050aba0eb538163491c14f908bda727 Mon Sep 17 00:00:00 2001 From: jean-pierre roux Date: Fri, 17 Jul 2009 14:14:03 +0000 Subject: [PATCH] Uodates --- appli/CMakeLists.txt | 1 + appli/Dcm2VtkImageData/CMakeLists.txt | 42 ++++++++ appli/Dcm2VtkImageData/Dcm2VtkImageData.cxx | 100 ++++++++++++++++++++ appli/template_appli/CMakeLists.txt | 2 +- appli/template_wx_appli/CMakeLists.txt | 1 + appli/testBruker2Dicom/CMakeLists.txt | 2 + 6 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 appli/Dcm2VtkImageData/CMakeLists.txt create mode 100644 appli/Dcm2VtkImageData/Dcm2VtkImageData.cxx diff --git a/appli/CMakeLists.txt b/appli/CMakeLists.txt index 282a754..282ad04 100644 --- a/appli/CMakeLists.txt +++ b/appli/CMakeLists.txt @@ -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 index 0000000..dca8dfa --- /dev/null +++ b/appli/Dcm2VtkImageData/CMakeLists.txt @@ -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 index 0000000..1d28631 --- /dev/null +++ b/appli/Dcm2VtkImageData/Dcm2VtkImageData.cxx @@ -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 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 +} + + diff --git a/appli/template_appli/CMakeLists.txt b/appli/template_appli/CMakeLists.txt index abff49e..020be7e 100644 --- a/appli/template_appli/CMakeLists.txt +++ b/appli/template_appli/CMakeLists.txt @@ -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} diff --git a/appli/template_wx_appli/CMakeLists.txt b/appli/template_wx_appli/CMakeLists.txt index fd728c2..adfd6f3 100644 --- a/appli/template_wx_appli/CMakeLists.txt +++ b/appli/template_wx_appli/CMakeLists.txt @@ -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} diff --git a/appli/testBruker2Dicom/CMakeLists.txt b/appli/testBruker2Dicom/CMakeLists.txt index 0057543..61bad20 100755 --- a/appli/testBruker2Dicom/CMakeLists.txt +++ b/appli/testBruker2Dicom/CMakeLists.txt @@ -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 ) -- 2.45.0