From: David Sarrut Date: Thu, 15 Dec 2011 06:25:38 +0000 (+0100) Subject: Merge branch 'master' of git.creatis.insa-lyon.fr:clitk X-Git-Tag: v1.3.0~104^2~17 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=4efd93f02e07c2d8fe45f29f9579cabe27a93c1a;hp=afede09ad631dcf7297e3189aeb1d2288fb25902;p=clitk.git Merge branch 'master' of git.creatis.insa-lyon.fr:clitk --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 75f52c4..4cd0dc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,18 +6,20 @@ if(COMMAND cmake_policy) cmake_policy(SET CMP0003 NEW) endif(COMMAND cmake_policy) PROJECT(clitk) -SET(CLITK_SOURCE_DIR ${PROJECT_SOURCE_DIR}) +IF(NOT DEFINED CLITK_SOURCE_DIR) + SET(CLITK_SOURCE_DIR ${PROJECT_SOURCE_DIR}) +ENDIF(NOT DEFINED CLITK_SOURCE_DIR) #========================================================= #========================================================= -INCLUDE(cmake/common.cmake) -INCLUDE(cmake/dependencies.cmake) -INCLUDE(cmake/build_opt.cmake) +INCLUDE(${CLITK_SOURCE_DIR}/cmake/common.cmake) +INCLUDE(${CLITK_SOURCE_DIR}/cmake/dependencies.cmake) +INCLUDE(${CLITK_SOURCE_DIR}/cmake/build_opt.cmake) #========================================================= #========================================================= # Select what is compiled -ADD_SUBDIRECTORY(common) -ADD_SUBDIRECTORY(tools) -ADD_SUBDIRECTORY(segmentation) -ADD_SUBDIRECTORY(registration) +ADD_SUBDIRECTORY(${CLITK_SOURCE_DIR}/common ${PROJECT_BINARY_DIR}/common) +ADD_SUBDIRECTORY(${CLITK_SOURCE_DIR}/tools ${PROJECT_BINARY_DIR}/tools) +ADD_SUBDIRECTORY(${CLITK_SOURCE_DIR}/segmentation ${PROJECT_BINARY_DIR}/segmentation) +ADD_SUBDIRECTORY(${CLITK_SOURCE_DIR}/registration ${PROJECT_BINARY_DIR}/registration) diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 225ddcc..078c5a4 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -13,6 +13,18 @@ ENDIF(ITK_FOUND) FIND_PACKAGE(VTK REQUIRED) IF(VTK_FOUND) INCLUDE("${VTK_USE_FILE}") + IF(VTK_VERSION VERSION_LESS 5.8.0) + SET ( VTK_LIBRARIES + vtkCommon + vtkRendering + vtkIO + vtkFiltering + vtkGraphics + vtkWidgets + vtkImaging + vtkHybrid + ) + ENDIF(VTK_VERSION VERSION_LESS 5.8.0) ELSE(VTK_FOUND) MESSAGE(FATAL_ERROR "Please set VTK_DIR.") ENDIF(VTK_FOUND) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index b956dd9..336e225 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -1,7 +1,3 @@ -#========================================================= -INCLUDE(${CLITK_SOURCE_DIR}/cmake/common.cmake) -#========================================================= - #========================================================= # make clitk libraries* CONFIGURE_FILE(clitkConfiguration.h.in ${PROJECT_BINARY_DIR}/clitkConfiguration.h) diff --git a/registration/CMakeLists.txt b/registration/CMakeLists.txt index 3ae919f..e02f2ff 100644 --- a/registration/CMakeLists.txt +++ b/registration/CMakeLists.txt @@ -1,10 +1,6 @@ #ADD_LIBRARY(clitkLBGSB STATIC clitkLBGSBOptimizer.cxx) #========================================================= -INCLUDE(${CLITK_SOURCE_DIR}/cmake/common.cmake) - -#========================================================= - # Add Libraries used in vv and clitk to avoid recompilation WRAP_GGO(clitkAffineRegistration_GGO_C clitkAffineRegistration.ggo) ADD_LIBRARY(clitkAffineRegistrationLib diff --git a/scripts/create_midP-2.0.sh b/scripts/create_midP-2.0.sh index a422e4f..1f18830 100755 --- a/scripts/create_midP-2.0.sh +++ b/scripts/create_midP-2.0.sh @@ -38,7 +38,7 @@ registration() # with the specified preffix, which is interesting for debugging. # if blank, it means that the original images (those without bands) # will be used (see create_midP_masks-2.0.sh for details). - banded="banded_" + banded="" # params read from conf file params="$nb_iter $nb_samples $sampling_algo $nb_hist_bins $nb_levels $bspline_spacing $metric $optimizer $interpolator" @@ -102,15 +102,29 @@ registration() fi done - # create (zero) vf from reference to reference + # create (zero) vf from reference to reference and associated images + vf_in=$vf_dir/vf_inside_${ref_phase_nb}_${ref_phase_nb}.mhd + vf_out=$vf_dir/vf_outside_${ref_phase_nb}_${ref_phase_nb}.mhd clitkZeroVF -i $vf_ref -o $vf_dir/vf_${ref_phase_nb}_${ref_phase_nb}.mhd + clitkZeroVF -i $vf_ref -o $vf_in + clitkZeroVF -i $vf_ref -o $vf_out + abort_on_error registration $? clean_up_registration + + motion_mask=$mask_dir/mm_${ref_phase_nb}.mhd + reference_in=$mask_dir/${banded}inside_${ref_phase_nb}.mhd + reference_out=$mask_dir/${banded}outside_$ref_phase_nb.mhd + out_result=$output_dir/result_${ref_phase_nb}_${ref_phase_nb}.mhd + clitkCombineImage -i $reference_in -j $reference_out -m $motion_mask -o $out_result abort_on_error registration $? clean_up_registration # create 4D vf create_mhd_4D_pattern.sh $vf_dir/vf_${ref_phase_nb}_ + create_mhd_4D_pattern.sh $vf_dir/vf_inside_${ref_phase_nb}_ + create_mhd_4D_pattern.sh $vf_dir/vf_outside_${ref_phase_nb}_ # create 4D result image create_mhd_4D_pattern.sh $output_dir/result_inside_${ref_phase_nb}_ + create_mhd_4D_pattern.sh $output_dir/result_outside_${ref_phase_nb}_ create_mhd_4D_pattern.sh $output_dir/result_${ref_phase_nb}_ echo @@ -134,7 +148,7 @@ midp() ########### calculate the midp wrt the reference phase phase_nb=$ref_phase_nb echo "Calculating midp_$phase_nb.mhd..." - vf_midp=$midp_dir/vf_$phase_nb\_midp.mhd + vf_midp=$midp_dir/vf_midp_$phase_nb.mhd midp=$midp_dir/midp_$phase_nb.mhd # average the vf's from reference phase to phase clitkAverageTemporalDimension -i $vf_dir/vf_${ref_phase_nb}_4D.mhd -o $vf_midp @@ -157,7 +171,7 @@ midp() for i in $( seq 0 $((${#phase_files[@]} - 1))); do phase_file=${phase_files[$i]} phase_nb=${phase_nbs[$i]} - vf_midp=$midp_dir/vf_$phase_nb\_midp.mhd + vf_midp=$midp_dir/vf_midp_$phase_nb.mhd midp=$midp_dir/midp_$phase_nb.mhd if [ "$phase_nb" != "$ref_phase_nb" ]; then @@ -175,7 +189,9 @@ midp() fi done + # create 4D midp create_mhd_4D_pattern.sh $midp_dir/midp_ + create_mhd_4D_pattern.sh $midp_dir/vf_midp_ echo "Calculating midp_avg.mhd..." clitkAverageTemporalDimension -i $midp_dir/midp_4D.mhd -o $midp_dir/midp_avg.mhd @@ -186,7 +202,7 @@ midp() abort_on_error midp $? clean_up_midp # clean-up - rm $midp_dir/vf_* + #rm $midp_dir/vf_* echo echo "-------- Mid-position done ! --------" diff --git a/scripts/create_midP_masks-2.0.sh b/scripts/create_midP_masks-2.0.sh index 7c84294..eb5983a 100755 --- a/scripts/create_midP_masks-2.0.sh +++ b/scripts/create_midP_masks-2.0.sh @@ -43,7 +43,7 @@ extract_bones() extract_lungs() { echo "$phase_file -> Extracting lungs..." - clitkExtractLung -i $phase_file -o $mask_dir_tmp/lungs_$phase_nb.mhd -a $afdb_file --noAutoCrop --doNotSeparateLungs + clitkExtractLung -i $phase_file -o $mask_dir_tmp/lungs_$phase_nb.mhd -a $afdb_file --noAutoCrop --doNotSeparateLungs --type 1 } diff --git a/segmentation/CMakeLists.txt b/segmentation/CMakeLists.txt index 058b2c7..a2451a5 100644 --- a/segmentation/CMakeLists.txt +++ b/segmentation/CMakeLists.txt @@ -1,9 +1,5 @@ #========================================================= -INCLUDE(${CLITK_SOURCE_DIR}/cmake/common.cmake) - -#========================================================= - # Add Libraries used in vv and clitk to avoid recompilation FOREACH(clitkTool clitkExtractLung clitkExtractPatient) WRAP_GGO(${clitkTool}_GGO_C ${clitkTool}.ggo) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 21a8101..7b1a9fa 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,7 +1,3 @@ -#========================================================= -INCLUDE(${CLITK_SOURCE_DIR}/cmake/common.cmake) -#========================================================= - # Add Libraries used in vv and clitk to avoid recompilation WRAP_GGO(clitkCropImage_GGO_C clitkCropImage.ggo) ADD_LIBRARY(clitkCropImageLib clitkCropImageGenericFilter.cxx ${clitkCropImage_GGO_C}) @@ -126,7 +122,7 @@ IF (CLITK_BUILD_TOOLS) WRAP_GGO(clitkGammaIndex_GGO_C clitkGammaIndex.ggo) ADD_EXECUTABLE(clitkGammaIndex clitkGammaIndex.cxx ${clitkGammaIndex_GGO_C}) - TARGET_LINK_LIBRARIES(clitkGammaIndex clitkCommon ${VTK_LIBRARIES} ${ITK_LIBRARIES} vtkIO) + TARGET_LINK_LIBRARIES(clitkGammaIndex clitkCommon ${VTK_LIBRARIES} ${ITK_LIBRARIES}) SET(TOOLS_INSTALL ${TOOLS_INSTALL} clitkGammaIndex) ADD_EXECUTABLE(clitkImageArithm clitkImageArithm.cxx) @@ -368,21 +364,17 @@ IF (CLITK_BUILD_TOOLS) WRAP_GGO(clitkBinaryImageToMesh_GGO_C clitkBinaryImageToMesh.ggo) ADD_EXECUTABLE(clitkBinaryImageToMesh clitkBinaryImageToMesh.cxx ${clitkBinaryImageToMesh_GGO_C}) - TARGET_LINK_LIBRARIES(clitkBinaryImageToMesh ${ITK_LIBRARIES} vtkCommon vtkRendering) + TARGET_LINK_LIBRARIES(clitkBinaryImageToMesh ${ITK_LIBRARIES} ${VTK_LIBRARIES}) SET(TOOLS_INSTALL ${TOOLS_INSTALL} clitkBinaryImageToMesh) WRAP_GGO(clitkMeshToBinaryImage_GGO_C clitkMeshToBinaryImage.ggo) ADD_EXECUTABLE(clitkMeshToBinaryImage clitkMeshToBinaryImage.cxx ${clitkMeshToBinaryImage_GGO_C}) - IF(VTK_VERSION VERSION_LESS 5.8.0) - TARGET_LINK_LIBRARIES(clitkMeshToBinaryImage clitkCommon ${ITK_LIBRARIES} vtkHybrid vtkIO) - ELSE(VTK_VERSION VERSION_LESS 5.8.0) - TARGET_LINK_LIBRARIES(clitkMeshToBinaryImage clitkCommon ${ITK_LIBRARIES} ${VTK_LIBRARIES}) - ENDIF(VTK_VERSION VERSION_LESS 5.8.0) + TARGET_LINK_LIBRARIES(clitkMeshToBinaryImage clitkCommon ${ITK_LIBRARIES} ${VTK_LIBRARIES}) SET(TOOLS_INSTALL ${TOOLS_INSTALL} clitkMeshToBinaryImage) WRAP_GGO(clitkMeshViewer_GGO_C clitkMeshViewer.ggo) ADD_EXECUTABLE(clitkMeshViewer clitkMeshViewer.cxx ${clitkMeshViewer_GGO_C}) - TARGET_LINK_LIBRARIES(clitkMeshViewer vtkCommon vtkRendering) + TARGET_LINK_LIBRARIES(clitkMeshViewer ${VTK_LIBRARIES}) SET(TOOLS_INSTALL ${TOOLS_INSTALL} clitkMeshViewer) ENDIF(CLITK_EXPERIMENTAL)