From: David Sarrut Date: Tue, 4 Dec 2018 07:46:52 +0000 (+0100) Subject: Merge branch 'master' of git.creatis.insa-lyon.fr:clitk X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=4480e52377d1150ca781c96e359b3164b65c3503;hp=60b0c152dc3a8df68ddd4c8e88bdd5492dd6916b;p=clitk.git Merge branch 'master' of git.creatis.insa-lyon.fr:clitk --- diff --git a/.travis.yml b/.travis.yml index a1d3ba9..99db61b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,51 +12,60 @@ compiler: - gcc - clang env: - - WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.9.1 QT_VERSION=5.5.1 C11=false - - WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.9.1 QT_VERSION=4.8.7 C11=false - - WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.9.1 QT_VERSION=5.5.1 C11=false - - WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.9.1 QT_VERSION=4.8.7 C11=false - - WITH_CMAKE=true VTK_VERSION=5.10 ITK_VERSION=4.6 QT_VERSION=4.8.7 C11=false - - WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.9.1 QT_VERSION=5.5.1 C11=true - - WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.9.1 QT_VERSION=4.8.7 C11=true - - WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.9.1 QT_VERSION=5.5.1 C11=true - - WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.9.1 QT_VERSION=4.8.7 C11=true - - WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.13.0 QT_VERSION=5.5.1 C11=false - - WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.13.0 QT_VERSION=5.5.1 C11=false - - WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.13.0 QT_VERSION=5.5.1 C11=true - - WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.13.0 QT_VERSION=5.5.1 C11=true + - WITH_CMAKE=true VTK_VERSION=v5.10.0 ITK_VERSION=v4.6.0 QT_VERSION=4.8.7 C11=false + - WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.9.1 QT_VERSION=4.8.7 C11=false + - WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.9.1 QT_VERSION=5.5.1 C11=false + - WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=false + - WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.9.1 QT_VERSION=4.8.7 C11=false + - WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.9.1 QT_VERSION=5.5.1 C11=false + - WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=false + - WITH_CMAKE=true VTK_VERSION=v8.1.1 ITK_VERSION=v5.0b01 QT_VERSION=5.5.1 C11=false + - WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.9.1 QT_VERSION=4.8.7 C11=true + - WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.9.1 QT_VERSION=5.5.1 C11=true + - WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=true + - WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.9.1 QT_VERSION=4.8.7 C11=true + - WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.9.1 QT_VERSION=5.5.1 C11=true + - WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=true + - WITH_CMAKE=true VTK_VERSION=v8.1.1 ITK_VERSION=v5.0b01 QT_VERSION=5.5.1 C11=true matrix: exclude: - - os: osx - env: WITH_CMAKE=true VTK_VERSION=5.10 ITK_VERSION=4.6 QT_VERSION=4.8.7 C11=false #VTK5.10 doesn't work with osX - - os: osx - env: WITH_CMAKE=true VTK_VERSION=5.10 ITK_VERSION=4.6 QT_VERSION=4.8.7 C11=true #VTK5.10 doesn't work with osX - - os: osx - env: WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.9.1 QT_VERSION=4.8.7 C11=false #Qt4 doesn't work with brew anymore - - os: osx - env: WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.9.1 QT_VERSION=4.8.7 C11=true #Qt4 doesn't work with brew anymore - - os: osx - env: WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.9.1 QT_VERSION=4.8.7 C11=false - - os: osx - env: WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.9.1 QT_VERSION=4.8.7 C11=true + - os: osx #VTK5.10, Qt4, ITK < 4.13 doesn't work with osX - os: linux - env: WITH_CMAKE=true VTK_VERSION=5.10 ITK_VERSION=4.6 QT_VERSION=4.8.7 C11=true #Problem with VTK 5.10 and c++11 + env: WITH_CMAKE=true VTK_VERSION=v5.10.0 ITK_VERSION=v4.6.0 QT_VERSION=4.8.7 C11=true #Problem with VTK 5.10 and c++11 - os: linux compiler: clang #Remove ITK with clang on linux include: - os: linux compiler: clang - env: WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.13.0 QT_VERSION=5.5.1 C11=false + env: WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=false + - os: linux + compiler: clang + env: WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=false - os: linux compiler: clang - env: WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.13.0 QT_VERSION=5.5.1 C11=false + env: WITH_CMAKE=true VTK_VERSION=v8.1.1 ITK_VERSION=v5.0b01 QT_VERSION=5.5.1 C11=false - os: linux compiler: clang - env: WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.13.0 QT_VERSION=5.5.1 C11=true + env: WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=true - os: linux compiler: clang - env: WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.13.0 QT_VERSION=5.5.1 C11=true + env: WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=true + - os: linux + compiler: clang + env: WITH_CMAKE=true VTK_VERSION=v8.1.1 ITK_VERSION=v5.0b01 QT_VERSION=5.5.1 C11=true + - os: osx + env: WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=false + - os: osx + env: WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=false + - os: osx + env: WITH_CMAKE=true VTK_VERSION=v8.1.1 ITK_VERSION=v5.0b01 QT_VERSION=5.5.1 C11=flase + - os: osx + env: WITH_CMAKE=true VTK_VERSION=v6.3.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=true + - os: osx + env: WITH_CMAKE=true VTK_VERSION=v7.0.0 ITK_VERSION=v4.13.0 QT_VERSION=5.5.1 C11=true + - os: osx + env: WITH_CMAKE=true VTK_VERSION=v8.1.1 ITK_VERSION=v5.0b01 QT_VERSION=5.5.1 C11=true language: cpp @@ -84,16 +93,17 @@ before_install: - export cwd=$(pwd) - export SCRIPTS=$cwd/travis - export EXTERNALS_DIR=$HOME -- export VTK_SOURCE_DIR=${EXTERNALS_DIR}/vtk-${VTK_VERSION} -- export VTK_DIR=${EXTERNALS_DIR}/vtk-${VTK_VERSION}-build -- export ITK_SOURCE_DIR=${EXTERNALS_DIR}/itk-${ITK_VERSION} -- export ITK_DIR=${EXTERNALS_DIR}/itk-${ITK_VERSION}-build +- export VTK_SOURCE_DIR=${EXTERNALS_DIR}/vtk +- export VTK_DIR=${EXTERNALS_DIR}/vtk-build +- export ITK_SOURCE_DIR=${EXTERNALS_DIR}/itk +- export ITK_DIR=${EXTERNALS_DIR}/itk-build - export BUILD_DIR=$cwd/build - if test $TRAVIS_OS_NAME == linux ; then sudo apt-get install -y -qq build-essential cmake; fi #Install qt5 - $SCRIPTS/travis_build_qt.sh - if test $TRAVIS_OS_NAME == linux; then sudo apt-get -y install libgdcm2-dev libpq-dev; fi - if test $TRAVIS_OS_NAME == linux; then if [[ "$QT_VERSION" == "5.5.1" ]] ; then QTDIR="/opt/qt55" && PATH="$PATH:$QTDIR/bin" && qt55-env.sh ; fi; fi +- if test $TRAVIS_OS_NAME == linux; then cd $HOME && wget https://cmake.org/files/v3.11/cmake-3.11.4-Linux-x86_64.tar.gz && tar -xzf cmake-3.11.4-Linux-x86_64.tar.gz && export PATH=$HOME/cmake-3.11.4-Linux-x86_64/bin:${PATH} ; fi - if test $TRAVIS_OS_NAME == osx ; then export HOMEBREW_QT_VERSION=$(brew list --versions qt | rev | cut -d' ' -f1 | rev); fi - if test $TRAVIS_OS_NAME == osx ; then brew install ccache; fi - if test $TRAVIS_OS_NAME == osx ; then export PATH="/usr/local/opt/qt/bin:/usr/local/opt/ccache/libexec:$PATH"; fi @@ -101,18 +111,10 @@ before_install: cache: - directories: - - $HOME/vtk-5.10 - - $HOME/vtk-5.10-build - - $HOME/vtk-6.3 - - $HOME/vtk-6.3-build - - $HOME/vtk-7.0.0 - - $HOME/vtk-7.0.0-build - - $HOME/itk-4.6 - - $HOME/itk-4.6-build - - $HOME/itk-4.9.1 - - $HOME/itk-4.9.1-build - - $HOME/itk-4.13.0 - - $HOME/itk-4.13.0-build + - $HOME/vtk + - $HOME/vtk-build + - $HOME/itk + - $HOME/itk-build - '$HOME/.sonar/cache' - timeout: 10000 diff --git a/cluster_tools/gate_power_merge.sh b/cluster_tools/gate_power_merge.sh index 8fa4cfc..43d90d0 100755 --- a/cluster_tools/gate_power_merge.sh +++ b/cluster_tools/gate_power_merge.sh @@ -207,6 +207,7 @@ function merge_doseByRegions { echo " ${indent}creating ${merged}" local count=0 start_bar $# + source ${doseMerger} while test $# -gt 0 do local partial="$1" @@ -217,12 +218,14 @@ function merge_doseByRegions { then update_bar ${count} "copying first partial result ${partial}" cp "${partial}" "${merged}" + copyFirstPartialResult -i "${merged}" -o "${merged}" 2> /dev/null > /dev/null || warning "error while calling ${doseMerger}" continue fi update_bar ${count} "adding ${partial}" - ${doseMerger} -i "${merged}" -j "${partial}" -o "${merged}" 2> /dev/null > /dev/null || warning "error while calling ${doseMerger}" + addToPartialResult -i "${merged}" -j "${partial}" -o "${merged}" 2> /dev/null > /dev/null || warning "error while calling ${doseMerger}" done + divideUncertaintyResult -i "${merged}" -o "${merged}" 2> /dev/null > /dev/null || warning "error while calling ${doseMerger}" end_bar echo " ${indent}merged ${count} files" } diff --git a/cluster_tools/mergeDoseByRegions.sh b/cluster_tools/mergeDoseByRegions.sh index d7a390a..b9303aa 100755 --- a/cluster_tools/mergeDoseByRegions.sh +++ b/cluster_tools/mergeDoseByRegions.sh @@ -2,102 +2,276 @@ set -u function usage { - echo "$0 -i -j -o " + echo "$0 -i -j -o " exit 1 } -if [ $# != 6 ] -then - usage -fi +function addToPartialResult { + IN1=$2 #merged file for previous jobs + IN2=$4 # current job + RESULT=$6 #output merged file -IN1=$2 -IN2=$4 -RESULT=$6 + test -f ${IN1} && test -f ${IN2} || usage -test -f ${IN1} && test -f ${IN2} || usage + TMP="$(mktemp)" -TMP="$(mktemp)" -echo "merging dose by regions file" -# check if all 3 text files have the same number of lines -nblines=`cat ${IN1} | wc -l` -nb2=`cat ${IN2} | wc -l` -nb3=`cat ${RESULT} | wc -l` + # check if all 3 text files have the same number of lines + nblines=`cat ${IN1} | wc -l` + nb2=`cat ${IN2} | wc -l` + nb3=`cat ${RESULT} | wc -l` -if [ $nblines -ne $nb2 ] || [ $nblines -ne $nb3 ]; then - echo "Files does not have the same size" - exit 1 -fi - -#Copy the 1st line in output -line1=`sed -n "1p" < ${RESULT}` -echo "${line1}" >> ${TMP} - -# for all lines (except the 1st), split according tab -# sum the some elements (dose, edep) ... -for i in $(seq 2 $nblines); do - #Get the 3 lines - line1=`sed -n "${i}p" < ${IN1}` - line2=`sed -n "${i}p" < ${IN2}` - line3=`sed -n "${i}p" < ${RESULT}` - - # sum edep: get the 2 values, sum them and replace it in the line3 - # The /#./0. is important to add 0 for decimal value between 0 and 1 - edep1=$(echo ${line1} | cut -f3 -d' ') - edep2=$(echo ${line2} | cut -f3 -d' ') - edep3=$(echo "scale=30;$edep1+$edep2" | bc) - edep3=${edep3/#./0.} - line3=$(echo $line3 |awk -v r=${edep3} '{$3=r}1') - - # sqrt sum square std_edep: get the 2 values, sum the square, take the sqrt and replace it in the line3 - edep1=$(echo ${line1} | cut -f4 -d' ') - edep2=$(echo ${line2} | cut -f4 -d' ') - edep3=$(echo "scale=30;sqrt($edep1*$edep1+$edep2*$edep2)" | bc) - edep3=${edep3/#./0.} - line3=$(echo $line3 |awk -v r=${edep3} '{$4=r}1') - - # sum square_edep: get the 2 values, sum them and replace it in the line3 - edep1=$(echo ${line1} | cut -f5 -d' ') - edep2=$(echo ${line2} | cut -f5 -d' ') - edep3=$(echo "scale=30;$edep1+$edep2" | bc) - edep3=${edep3/#./0.} - line3=$(echo $line3 |awk -v r=${edep3} '{$5=r}1') - - # sum dose: get the 2 values, sum them and replace it in the line3 - edep1=$(echo ${line1} | cut -f6 -d' ') - edep2=$(echo ${line2} | cut -f6 -d' ') - edep3=$(echo "scale=30;$edep1+$edep2" | bc) - edep3=${edep3/#./0.} - line3=$(echo $line3 |awk -v r=${edep3} '{$6=r}1') - - # sqrt sum square std_dose: get the 2 values, sum the square, take the sqrt and replace it in the line3 - edep1=$(echo ${line1} | cut -f7 -d' ') - edep2=$(echo ${line2} | cut -f7 -d' ') - edep3=$(echo "scale=30;sqrt($edep1*$edep1+$edep2*$edep2)" | bc) - edep3=${edep3/#./0.} - line3=$(echo $line3 |awk -v r=${edep3} '{$7=r}1') - - # sum square_dose: get the 2 values, sum them and replace it in the line3 - edep1=$(echo ${line1} | cut -f8 -d' ') - edep2=$(echo ${line2} | cut -f8 -d' ') - edep3=$(echo "scale=30;$edep1+$edep2" | bc) - edep3=${edep3/#./0.} - line3=$(echo $line3 |awk -v r=${edep3} '{$8=r}1') - - # sum n_hits: get the 2 values, sum them and replace it in the line3 - edep1=$(echo ${line1} | cut -f9 -d' ') - edep2=$(echo ${line2} | cut -f9 -d' ') - edep3=$(echo "scale=30;$edep1+$edep2" | bc) - line3=$(echo $line3 |awk -v r=${edep3} '{$9=r}1') - - # sum n_event_hits: get the 2 values, sum them and replace it in the line3 - edep1=$(echo ${line1} | cut -f10 -d' ') - edep2=$(echo ${line2} | cut -f10 -d' ') - edep3=$(echo "scale=30;$edep1+$edep2" | bc) - line3=$(echo $line3 |awk -v r=${edep3} '{$10=r}1') - - #Write the output - echo "${line3}" >> ${TMP} -done -mv -f ${TMP} ${RESULT} + if [ $nblines -ne $nb2 ] || [ $nblines -ne $nb3 ]; then + echo "Files does not have the same size" + exit 1 + fi + + # Find the number of primaries for this job (the same for all line and different of 0) + # Get the number of primaries from edep and square_edep to determine the std. + nbPrimary=0 + for i in $(seq 2 $nblines); do + #Get the line + file2=`sed -n "${i}p" < ${IN2}` + + edep2=$(echo ${file2} | cut -f3 -d' ') + stdEdep2=$(echo ${file2} | cut -f4 -d' ') + sqEdep2=$(echo ${file2} | cut -f5 -d' ') + nbPrimary=$(python <> ${TMP} + # for all lines (except the 1st), split according tab + # sum the some elements (dose, edep) ... + for i in $(seq 2 $nblines); do + #Get the 3 lines + file1=`sed -n "${i}p" < ${IN1}` + file2=`sed -n "${i}p" < ${IN2}` + file3=`sed -n "${i}p" < ${RESULT}` + + # sum edep: get the 2 values, sum them and replace it in the file3 + # The /#./0. is important to add 0 for decimal value between 0 and 1 + edep1=$(echo ${file1} | cut -f3 -d' ') + edep2=$(echo ${file2} | cut -f3 -d' ') + edep3=$(python -c "print($edep1+$edep2)") + edep3=${edep3/#./0.} + file3=$(echo $file3 |awk -v r=${edep3} '{$3=r}1') + + # sum square_edep: get the 2 values, sum them and replace it in the file3 + sqEdep1=$(echo ${file1} | cut -f5 -d' ') + sqEdep2=$(echo ${file2} | cut -f5 -d' ') + sqEdep3=$(python -c "print($sqEdep1+$sqEdep2)") + sqEdep3=${sqEdep3/#./0.} + file3=$(echo $file3 |awk -v r=${sqEdep3} '{$5=r}1') + + # Get the number of primaries from edep and square_edep to determine the std. + # Sum the number of primaries with the latter ones + nbPrimaryEdep1=$(echo ${file1} | cut -f4 -d' ') + nbPrimaryEdep3=$(python <> ${TMP} + done + mv -f ${TMP} ${RESULT} +} + +function copyFirstPartialResult { + IN1=$2 + RESULT=$4 + + TMP="$(mktemp)" + + # check if all 2 text files have the same number of lines + nblines=`cat ${IN1} | wc -l` + nb3=`cat ${RESULT} | wc -l` + + if [ $nblines -ne $nb3 ]; then + echo "Files does not have the same size" + exit 1 + fi + # Find the number of primaries for this job (the same for all line and different of 0) + # Get the number of primaries from edep and square_edep to determine the std. + nbPrimary=0 + for i in $(seq 2 $nblines); do + #Get the line + file2=`sed -n "${i}p" < ${IN1}` + + edep2=$(echo ${file2} | cut -f3 -d' ') + stdEdep2=$(echo ${file2} | cut -f4 -d' ') + sqEdep2=$(echo ${file2} | cut -f5 -d' ') + nbPrimary=$(python <> ${TMP} + # for all lines (except the 1st), split according tab + # write the number of primaries + for i in $(seq 2 $nblines); do + #Get the lines + file3=`sed -n "${i}p" < ${RESULT}` + + file3=$(echo $file3 |awk -v r=${nbPrimary} '{$4=r}1') + file3=$(echo $file3 |awk -v r=${nbPrimary} '{$7=r}1') + + #Write the output + echo "${file3}" >> ${TMP} + done + mv -f ${TMP} ${RESULT} +} + +function divideUncertaintyResult { + IN1=$2 + RESULT=$4 + + TMP="$(mktemp)" + + # check if all 2 text files have the same number of lines + nblines=`cat ${IN1} | wc -l` + nb3=`cat ${RESULT} | wc -l` + + if [ $nblines -ne $nb3 ]; then + echo "Files does not have the same size" + exit 1 + fi + + #Copy the 1st line in output + line1=`sed -n "1p" < ${RESULT}` + echo "${line1}" >> ${TMP} + # for all lines (except the 1st), split according tab + # sum the some elements (dose, edep) ... + for i in $(seq 2 $nblines); do + #Get the lines + file1=`sed -n "${i}p" < ${IN1}` + file3=`sed -n "${i}p" < ${RESULT}` + + # Divide uncertainty and replace it in the file3 + edep1=$(echo ${file1} | cut -f3 -d' ') + nbPrimaryEdep1=$(echo ${file1} | cut -f4 -d' ') + sqEdep1=$(echo ${file1} | cut -f5 -d' ') + stdEdep3=$(python <> ${TMP} + done + mv -f ${TMP} ${RESULT} +} diff --git a/common/clitkDicomRTDoseIO.cxx b/common/clitkDicomRTDoseIO.cxx index 88e1289..72f711f 100644 --- a/common/clitkDicomRTDoseIO.cxx +++ b/common/clitkDicomRTDoseIO.cxx @@ -21,7 +21,7 @@ #include "clitkCommon.h" // itk include -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 // IMPLEMENTATION NOTE: // The following has been done without the use of vtkGDCMImageReader which directly // handle RTDOSE image. Another approach would have been to use gdcm::ImageReader @@ -56,7 +56,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation() int rc; #endif -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 m_GdcmImageReader.SetFileName(m_FileName.c_str()); m_GdcmImageReader.Read(); gdcm::File* m_GdcmFile = &m_GdcmImageReader.GetFile(); @@ -68,7 +68,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation() #endif /* Modality -- better be RTSTRUCT */ -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::DataSet &ds = m_GdcmFile->GetDataSet(); gdcm::Attribute<0x8,0x60> at1; @@ -82,7 +82,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation() } /* ImagePositionPatient */ -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Attribute<0x20,0x32> at2; at2.SetFromDataSet(ds); ipp[0] = at2.GetValue(0); @@ -97,7 +97,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation() #endif /* Rows */ -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Attribute<0x28,0x10> at3; at3.SetFromDataSet(ds); dim[1] = at3.GetValue(); @@ -110,7 +110,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation() #endif /* Columns */ -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Attribute<0x28,0x11> at4; at4.SetFromDataSet(ds); dim[0] = at4.GetValue(); @@ -123,7 +123,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation() #endif /* PixelSpacing */ -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Attribute<0x28,0x30> at5; at5.SetFromDataSet(ds); spacing[0] = at5.GetValue(0); @@ -137,7 +137,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation() #endif /* GridFrameOffsetVector */ -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Attribute<0x3004,0x000C> at6; const gdcm::DataElement& de6 = ds.GetDataElement( at6.GetTag() ); at6.SetFromDataElement(de6); @@ -198,7 +198,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation() #endif /* DoseGridScaling */ -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Attribute<0x3004,0x000E> at7 = { 1. } ; at7.SetFromDataSet(ds); m_DoseScaling = at7.GetValue(); @@ -228,7 +228,7 @@ void clitk::DicomRTDoseIO::ReadImageInformation() // Read Image Information bool clitk::DicomRTDoseIO::CanReadFile(const char* FileNameToRead) { -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Reader creader; creader.SetFileName(FileNameToRead); if (!creader.Read()) @@ -279,7 +279,7 @@ void clitk::DicomRTDoseIO::Read(void * buffer) npix *= GetDimensions(i); /* PixelData */ -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Image &i = m_GdcmImageReader.GetImage(); char* image_data = new char[i.GetBufferLength()]; diff --git a/common/clitkDicomRTDoseIO.h b/common/clitkDicomRTDoseIO.h index 2f08938..dbcafe1 100644 --- a/common/clitkDicomRTDoseIO.h +++ b/common/clitkDicomRTDoseIO.h @@ -24,7 +24,7 @@ // itk include #include #include -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 #include #endif @@ -77,7 +77,7 @@ protected: bool mustWriteHeader; int m_HeaderSize; std::ofstream file; -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::ImageReader m_GdcmImageReader; #else gdcm::File *m_GdcmFile; diff --git a/common/clitkDicomRT_Contour.cxx b/common/clitkDicomRT_Contour.cxx index 28fd054..9a5042b 100644 --- a/common/clitkDicomRT_Contour.cxx +++ b/common/clitkDicomRT_Contour.cxx @@ -20,7 +20,7 @@ #include "clitkDicomRT_Contour.h" #include -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 #include "gdcmAttribute.h" #include "gdcmItem.h" #endif @@ -53,7 +53,7 @@ void clitk::DicomRT_Contour::Print(std::ostream & os) const //-------------------------------------------------------------------- -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 void clitk::DicomRT_Contour::UpdateDicomItem() { DD("DicomRT_Contour::UpdateDicomItem"); @@ -119,7 +119,7 @@ void clitk::DicomRT_Contour::UpdateDicomItem() //-------------------------------------------------------------------- -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 bool clitk::DicomRT_Contour::Read(gdcm::Item * item) { mItem = item; diff --git a/common/clitkDicomRT_Contour.h b/common/clitkDicomRT_Contour.h index 077599f..ab6db0d 100644 --- a/common/clitkDicomRT_Contour.h +++ b/common/clitkDicomRT_Contour.h @@ -22,7 +22,7 @@ #include "clitkCommon.h" #include -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 #else #include #include @@ -44,7 +44,7 @@ public: void Print(std::ostream & os = std::cout) const; -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 bool Read(gdcm::Item * item); void UpdateDicomItem(); #else @@ -71,7 +71,7 @@ protected: ///Z location of the contour double mZ; -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Item * mItem; #else gdcm::SQItem * mItem; diff --git a/common/clitkDicomRT_ROI.cxx b/common/clitkDicomRT_ROI.cxx index 4135b31..d8af8c3 100644 --- a/common/clitkDicomRT_ROI.cxx +++ b/common/clitkDicomRT_ROI.cxx @@ -25,7 +25,7 @@ #include #include -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 #include "gdcmAttribute.h" #include "gdcmItem.h" #endif @@ -148,7 +148,7 @@ double clitk::DicomRT_ROI::GetForegroundValueLabelImage() const //-------------------------------------------------------------------- -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 bool clitk::DicomRT_ROI::Read(gdcm::Item * itemInfo, gdcm::Item * itemContour) { //FATAL("Error : compile vv with itk4 + external gdcm"); @@ -302,7 +302,7 @@ void clitk::DicomRT_ROI::ComputeMeshFromContour() //-------------------------------------------------------------------- -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 //-------------------------------------------------------------------- void clitk::DicomRT_ROI::UpdateDicomItem() { diff --git a/common/clitkDicomRT_ROI.h b/common/clitkDicomRT_ROI.h index ec43538..b417933 100644 --- a/common/clitkDicomRT_ROI.h +++ b/common/clitkDicomRT_ROI.h @@ -79,7 +79,7 @@ public: void SetName(std::string n) { mName = n; } // Read from DICOM RT STRUCT -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 bool Read(gdcm::Item * itemInfo, gdcm::Item * itemContour); void UpdateDicomItem(); #else @@ -104,7 +104,7 @@ protected: double mForegroundValue; bool m_DicomUptodateFlag; -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Item * mItemInfo; gdcm::Item * mItemContour; gdcm::SmartPointer mContoursSequenceOfItems; diff --git a/common/clitkDicomRT_StructureSet.cxx b/common/clitkDicomRT_StructureSet.cxx index 49d90bd..a845ef5 100644 --- a/common/clitkDicomRT_StructureSet.cxx +++ b/common/clitkDicomRT_StructureSet.cxx @@ -239,7 +239,7 @@ void clitk::DicomRT_StructureSet::Print(std::ostream & os) const //-------------------------------------------------------------------- -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 //-------------------------------------------------------------------- int clitk::DicomRT_StructureSet::ReadROINumber(const gdcm::Item & item) { @@ -255,7 +255,7 @@ int clitk::DicomRT_StructureSet::ReadROINumber(const gdcm::Item & item) //-------------------------------------------------------------------- void clitk::DicomRT_StructureSet::Write(const std::string & filename) { -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 // Assert that the gdcm file is still open (we can write only if it was readed) if (mFile == NULL) { @@ -461,7 +461,7 @@ void clitk::DicomRT_StructureSet::Read(const std::string & filename) bool clitk::DicomRT_StructureSet::IsDicomRTStruct(const std::string & filename) { // Open DICOM -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 // Read gdcm file mReader = new gdcm::Reader; mReader->SetFileName(filename.c_str()); diff --git a/common/clitkDicomRT_StructureSet.h b/common/clitkDicomRT_StructureSet.h index 7932051..dff4d75 100644 --- a/common/clitkDicomRT_StructureSet.h +++ b/common/clitkDicomRT_StructureSet.h @@ -38,7 +38,7 @@ #endif // gdcm -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 // This is not use if CLITK_USE_SYSTEM_GDCM==1 #include "gdcmReader.h" #include "gdcmWriter.h" @@ -81,7 +81,7 @@ public: int AddBinaryImageAsNewROI(vvImage * i, std::string name); -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 // Static static int ReadROINumber(const gdcm::Item & item); #endif @@ -98,7 +98,7 @@ protected: std::map mROIs; std::map mMapOfROIName; -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Reader * mReader; gdcm::SmartPointer mROIInfoSequenceOfItems; gdcm::SmartPointer mROIContoursSequenceOfItems; diff --git a/itk/RelativePositionPropImageFilter.h b/itk/RelativePositionPropImageFilter.h index c4f0812..e876f9f 100644 --- a/itk/RelativePositionPropImageFilter.h +++ b/itk/RelativePositionPropImageFilter.h @@ -169,8 +169,11 @@ namespace itk } } - - virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError) ITK_OVERRIDE; +#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 )) + virtual void GenerateInputRequestedRegion() ITK_OVERRIDE; +#else + virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError) ITK_OVERRIDE; +#endif void EnlargeOutputRequestedRegion (DataObject * output) ITK_OVERRIDE; protected: diff --git a/itk/RelativePositionPropImageFilter.txx b/itk/RelativePositionPropImageFilter.txx index eee0f0a..c34c7c3 100644 --- a/itk/RelativePositionPropImageFilter.txx +++ b/itk/RelativePositionPropImageFilter.txx @@ -50,7 +50,11 @@ namespace itk template void RelativePositionPropImageFilter +#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 )) + ::GenerateInputRequestedRegion() +#else ::GenerateInputRequestedRegion() throw (InvalidRequestedRegionError) +#endif { // call the superclass' implementation of this method Superclass::GenerateInputRequestedRegion (); diff --git a/itk/clitkBackProjectImageFilter.h b/itk/clitkBackProjectImageFilter.h index 8ff8def..9ffaffb 100644 --- a/itk/clitkBackProjectImageFilter.h +++ b/itk/clitkBackProjectImageFilter.h @@ -210,7 +210,11 @@ namespace clitk void SetOutputParametersFromImage( const OutputImageConstPointer image ); +#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 )) + void Initialize(void); +#else void Initialize(void) throw (itk::ExceptionObject); +#endif protected: diff --git a/itk/clitkBackProjectImageFilter.txx b/itk/clitkBackProjectImageFilter.txx index f981291..fa8d261 100644 --- a/itk/clitkBackProjectImageFilter.txx +++ b/itk/clitkBackProjectImageFilter.txx @@ -190,7 +190,11 @@ namespace clitk template void BackProjectImageFilter +#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 )) + ::Initialize( void ) +#else ::Initialize( void ) throw (itk::ExceptionObject) +#endif { //Change the origin of the 2D input typename InputImageType::ConstPointer inputPtr=this->GetInput(); diff --git a/itk/clitkForwardWarpImageFilter.h b/itk/clitkForwardWarpImageFilter.h index 85a5c22..7efac8f 100644 --- a/itk/clitkForwardWarpImageFilter.h +++ b/itk/clitkForwardWarpImageFilter.h @@ -71,10 +71,18 @@ namespace clitk itkSetMacro( Verbose, bool); itkSetMacro( EdgePaddingValue, PixelType ); itkSetMacro( DeformationField, typename DeformationFieldType::Pointer); +#if ITK_VERSION_MAJOR <= 4 void SetNumberOfThreads(unsigned int r ) +#else + void SetNumberOfWorkUnits(unsigned int r ) +#endif { m_NumberOfThreadsIsGiven=true; +#if ITK_VERSION_MAJOR <= 4 m_NumberOfThreads=r; +#else + m_NumberOfWorkUnits=r; +#endif } itkSetMacro(ThreadSafe, bool); @@ -102,7 +110,11 @@ namespace clitk private: bool m_Verbose; bool m_NumberOfThreadsIsGiven; +#if ITK_VERSION_MAJOR <= 4 unsigned int m_NumberOfThreads; +#else + unsigned int m_NumberOfWorkUnits; +#endif PixelType m_EdgePaddingValue; typename DeformationFieldType::Pointer m_DeformationField; bool m_ThreadSafe; diff --git a/itk/clitkForwardWarpImageFilter.txx b/itk/clitkForwardWarpImageFilter.txx index f5e9853..4d49b4d 100644 --- a/itk/clitkForwardWarpImageFilter.txx +++ b/itk/clitkForwardWarpImageFilter.txx @@ -445,7 +445,13 @@ void ForwardWarpImageFilterSetNumberOfThreads(m_NumberOfThreads); + if(m_NumberOfThreadsIsGiven) { +#if ITK_VERSION_MAJOR <= 4 + helper1->SetNumberOfThreads(m_NumberOfThreads); +#else + helper1->SetNumberOfWorkUnits(m_NumberOfWorkUnits); +#endif + } helper1->SetInput(inputPtr); helper1->SetDeformationField(m_DeformationField); helper1->SetWeights(weights); @@ -478,7 +484,13 @@ void ForwardWarpImageFilterSetNumberOfThreads(m_NumberOfThreads); + if(m_NumberOfThreadsIsGiven) { +#if ITK_VERSION_MAJOR <= 4 + helper2->SetNumberOfThreads(m_NumberOfThreads); +#else + helper2->SetNumberOfWorkUnits(m_NumberOfWorkUnits); +#endif + } helper2->SetInput(temp); helper2->SetWeights(weights); helper2->SetEdgePaddingValue(m_EdgePaddingValue); diff --git a/itk/clitkInvertVFFilter.h b/itk/clitkInvertVFFilter.h index 52edcd9..8ad84a2 100644 --- a/itk/clitkInvertVFFilter.h +++ b/itk/clitkInvertVFFilter.h @@ -65,10 +65,18 @@ namespace clitk //Set Methods(inline) itkSetMacro( Verbose, bool); itkSetMacro( EdgePaddingValue, PixelType ); +#if ITK_VERSION_MAJOR <= 4 void SetNumberOfThreads(unsigned int r ) ITK_OVERRIDE +#else + void SetNumberOfWorkUnits(unsigned int r ) ITK_OVERRIDE +#endif { m_NumberOfThreadsIsGiven=true; +#if ITK_VERSION_MAJOR <= 4 m_NumberOfThreads=r; +#else + m_NumberOfWorkUnits=r; +#endif } itkSetMacro(ThreadSafe, bool); itkSetMacro(OutputSpacing, SpacingType); @@ -84,7 +92,11 @@ namespace clitk bool m_NumberOfThreadsIsGiven; SpacingType m_OutputSpacing; SizeType m_OutputSize; +#if ITK_VERSION_MAJOR <= 4 unsigned int m_NumberOfThreads; +#else + unsigned int m_NumberOfWorkUnits; +#endif PixelType m_EdgePaddingValue; bool m_ThreadSafe; }; diff --git a/itk/clitkInvertVFFilter.txx b/itk/clitkInvertVFFilter.txx index 4b98230..b2485e0 100644 --- a/itk/clitkInvertVFFilter.txx +++ b/itk/clitkInvertVFFilter.txx @@ -438,7 +438,13 @@ template void InvertVFFilterSetNumberOfThreads(m_NumberOfThreads); + if(m_NumberOfThreadsIsGiven) { +#if ITK_VERSION_MAJOR <= 4 + helper1->SetNumberOfThreads(m_NumberOfThreads); +#else + helper1->SetNumberOfWorkUnits(m_NumberOfWorkUnits); +#endif + } helper1->SetInput(inputPtr); helper1->SetWeights(weights); @@ -468,7 +474,13 @@ template void InvertVFFilterSetNumberOfThreads(m_NumberOfThreads); + if(m_NumberOfThreadsIsGiven) { +#if ITK_VERSION_MAJOR <= 4 + helper2->SetNumberOfThreads(m_NumberOfThreads); +#else + helper2->SetNumberOfWorkUnits(m_NumberOfWorkUnits); +#endif + } helper2->SetInput(temp); helper2->SetWeights(weights); helper2->SetEdgePaddingValue(m_EdgePaddingValue); diff --git a/itk/clitkPasteImageFilter.hxx b/itk/clitkPasteImageFilter.hxx index 348d858..2a3f99d 100644 --- a/itk/clitkPasteImageFilter.hxx +++ b/itk/clitkPasteImageFilter.hxx @@ -15,7 +15,7 @@ namespace clitk PasteImageFilter< TInputImage, TSourceImage, TOutputImage > ::PasteImageFilter() { - this->ProcessObject::SetNumberOfRequiredInputs(2); + //this->ProcessObject::SetNumberOfRequiredInputs(2); this->InPlaceOff(); this->m_DestinationIndex.Fill(0); diff --git a/itk/clitkResampleImageWithOptionsFilter.txx b/itk/clitkResampleImageWithOptionsFilter.txx index 4c949ce..97f6f41 100644 --- a/itk/clitkResampleImageWithOptionsFilter.txx +++ b/itk/clitkResampleImageWithOptionsFilter.txx @@ -224,7 +224,11 @@ GenerateData() case B_LUT: std::cout << "B-LUT " << m_BSplineOrder << " " << m_BLUTSamplingFactor << std::endl; break; case WSINC: std::cout << "Windowed Sinc" << std::endl; break; } +#if ITK_VERSION_MAJOR <= 4 std::cout << "Threads = " << this->GetNumberOfThreads() << std::endl; +#else + std::cout << "Threads = " << this->GetNumberOfWorkUnits() << std::endl; +#endif std::cout << "LastDimIsTime = " << m_LastDimensionIsTime << std::endl; } @@ -241,7 +245,11 @@ GenerateData() filter->SetOutputSpacing(m_OutputSpacing); filter->SetOutputOrigin(m_OutputOrigin); filter->SetDefaultPixelValue(m_DefaultPixelValue); +#if ITK_VERSION_MAJOR <= 4 filter->SetNumberOfThreads(this->GetNumberOfThreads()); +#else + filter->SetNumberOfWorkUnits(this->GetNumberOfWorkUnits()); +#endif filter->SetOutputDirection(m_OutputDirection); // <-- NEEDED if we want to keep orientation (in case of PermutAxes for example) // Select interpolator diff --git a/registration/CMakeLists.txt b/registration/CMakeLists.txt index 4ad12a4..91f1e26 100644 --- a/registration/CMakeLists.txt +++ b/registration/CMakeLists.txt @@ -1,16 +1,16 @@ #========================================================= +if(CLITK_BUILD_REGISTRATION) # Add Libraries used in vv and clitk to avoid recompilation -WRAP_GGO(clitkAffineRegistration_GGO_C clitkAffineRegistration.ggo) -add_library(clitkAffineRegistrationLib - clitkAffineRegistrationGenericFilter.cxx - ${clitkAffineRegistration_GGO_C} - clitkLBFGSBOptimizer.cxx - clitkGenericAffineTransform.cxx) + WRAP_GGO(clitkAffineRegistration_GGO_C clitkAffineRegistration.ggo) + add_library(clitkAffineRegistrationLib + clitkAffineRegistrationGenericFilter.cxx + ${clitkAffineRegistration_GGO_C} + clitkLBFGSBOptimizer.cxx + clitkGenericAffineTransform.cxx) #========================================================= -if(CLITK_BUILD_REGISTRATION) ############################## registration algorithms add_executable(clitkAffineRegistration clitkAffineRegistration.cxx) target_link_libraries(clitkAffineRegistration clitkAffineRegistrationLib clitkCommon) diff --git a/registration/clitkAffineRegistrationGenericFilter.cxx b/registration/clitkAffineRegistrationGenericFilter.cxx index 17ebca9..d034912 100644 --- a/registration/clitkAffineRegistrationGenericFilter.cxx +++ b/registration/clitkAffineRegistrationGenericFilter.cxx @@ -393,7 +393,13 @@ void AffineRegistrationGenericFilter::UpdateWithInputImageType() typename MetricType::Pointer metric=genericMetric->GetMetricPointer(); if (movingMask) metric->SetMovingImageMask(movingMask); - if (threadsGiven) metric->SetNumberOfThreads( threads ); + if (threadsGiven) { +#if ITK_VERSION_MAJOR <= 4 + metric->SetNumberOfThreads( threads ); +#else + metric->SetNumberOfWorkUnits( threads ); +#endif + } //============================================================================ // Initialize using image moments. diff --git a/registration/clitkBLUTDIRGenericFilter.cxx b/registration/clitkBLUTDIRGenericFilter.cxx index 35ac6eb..24d4613 100644 --- a/registration/clitkBLUTDIRGenericFilter.cxx +++ b/registration/clitkBLUTDIRGenericFilter.cxx @@ -649,7 +649,11 @@ namespace clitk typename MetricType::Pointer metric=genericMetric->GetMetricPointer(); if (movingMask) metric->SetMovingImageMask(movingMask); if (threadsGiven) { +#if ITK_VERSION_MAJOR <= 4 metric->SetNumberOfThreads( threads ); +#else + metric->SetNumberOfWorkUnits( threads ); +#endif if (m_Verbose) std::cout<< "Using " << threads << " threads." << std::endl; } @@ -675,7 +679,11 @@ namespace clitk registration->SetInterpolator( interpolator ); registration->SetTransform (regTransform ); if(threadsGiven) { +#if ITK_VERSION_MAJOR <= 4 registration->SetNumberOfThreads(threads); +#else + registration->SetNumberOfWorkUnits(threads); +#endif if (m_Verbose) std::cout<< "Using " << threads << " threads." << std::endl; } registration->SetFixedImage( croppedFixedImage ); @@ -793,7 +801,11 @@ namespace clitk typedef itk::TransformToDisplacementFieldFilter ConvertorType; #endif typename ConvertorType::Pointer filter= ConvertorType::New(); +#if ITK_VERSION_MAJOR <= 4 filter->SetNumberOfThreads(1); +#else + filter->SetNumberOfWorkUnits(1); +#endif if(m_ArgsInfo.itkbspline_flag) sTransform->SetBulkTransform(ITK_NULLPTR); else diff --git a/registration/clitkCorrelationRatioImageToImageMetric.h b/registration/clitkCorrelationRatioImageToImageMetric.h index 04a6a37..a4bc342 100644 --- a/registration/clitkCorrelationRatioImageToImageMetric.h +++ b/registration/clitkCorrelationRatioImageToImageMetric.h @@ -105,7 +105,11 @@ public: * (1) making sure that all the components are present and plugged * together correctly, * (3) allocate memory for bin data structures. */ +#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 )) + virtual void Initialize(void) ITK_OVERRIDE; +#else virtual void Initialize(void) throw ( ExceptionObject ) ITK_OVERRIDE; +#endif /** Get the derivatives of the match measure. */ void GetDerivative( const TransformParametersType & parameters, diff --git a/registration/clitkCorrelationRatioImageToImageMetric.txx b/registration/clitkCorrelationRatioImageToImageMetric.txx index b52c077..1454539 100644 --- a/registration/clitkCorrelationRatioImageToImageMetric.txx +++ b/registration/clitkCorrelationRatioImageToImageMetric.txx @@ -51,7 +51,11 @@ CorrelationRatioImageToImageMetric template void CorrelationRatioImageToImageMetric +#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 )) +::Initialize(void) +#else ::Initialize(void) throw ( ExceptionObject ) +#endif { this->Superclass::Initialize(); diff --git a/registration/clitkDemonsDeformableRegistrationGenericFilter.txx b/registration/clitkDemonsDeformableRegistrationGenericFilter.txx index d4b0cb2..0c49dd7 100644 --- a/registration/clitkDemonsDeformableRegistrationGenericFilter.txx +++ b/registration/clitkDemonsDeformableRegistrationGenericFilter.txx @@ -335,7 +335,13 @@ namespace clitk // ======================================================= // The multiresolution scheme // ======================================================= - if (threadsGiven) multiResolutionFilter->SetNumberOfThreads(threads); + if (threadsGiven) { +#if ITK_VERSION_MAJOR <= 4 + multiResolutionFilter->SetNumberOfThreads(threads); +#else + multiResolutionFilter->SetNumberOfWorkUnits(threads); +#endif + } unsigned int nLevels=m_ArgsInfo.levels_arg; if (m_Verbose) std::cout<<"Setting the number of resolution levels to "<SetFixedImage( fixedImage ); @@ -343,8 +349,14 @@ namespace clitk multiResolutionFilter->SetNumberOfLevels( nLevels ); multiResolutionFilter->SetFixedImagePyramid( fixedImagePyramid ); multiResolutionFilter->SetMovingImagePyramid( movingImagePyramid ); - if (threadsGiven) multiResolutionFilter->SetNumberOfThreads( threads ); - + if (threadsGiven) { +#if ITK_VERSION_MAJOR <= 4 + multiResolutionFilter->SetNumberOfThreads( threads ); +#else + multiResolutionFilter->SetNumberOfWorkUnits( threads ); +#endif + } + //------------------------------------ //Set the number of iterations //------------------------------------ diff --git a/registration/clitkOptNormalizedCorrelationImageToImageMetric.h b/registration/clitkOptNormalizedCorrelationImageToImageMetric.h index 46dcae9..067cd87 100644 --- a/registration/clitkOptNormalizedCorrelationImageToImageMetric.h +++ b/registration/clitkOptNormalizedCorrelationImageToImageMetric.h @@ -95,7 +95,11 @@ public: * (2) uniformly select NumberOfSpatialSamples within * the FixedImageRegion, and * (3) allocate memory for pdf data structures. */ +#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 )) + virtual void Initialize(void) ITK_OVERRIDE; +#else virtual void Initialize(void) throw ( itk::ExceptionObject ) ITK_OVERRIDE; +#endif /** Get the value. */ MeasureType GetValue( const ParametersType & parameters ) const ITK_OVERRIDE; diff --git a/registration/clitkOptNormalizedCorrelationImageToImageMetric.txx b/registration/clitkOptNormalizedCorrelationImageToImageMetric.txx index 0f8fa64..ea2c52a 100644 --- a/registration/clitkOptNormalizedCorrelationImageToImageMetric.txx +++ b/registration/clitkOptNormalizedCorrelationImageToImageMetric.txx @@ -117,7 +117,11 @@ NormalizedCorrelationImageToImageMetric template void NormalizedCorrelationImageToImageMetric +#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 )) +::Initialize(void) +#else ::Initialize(void) throw ( itk::ExceptionObject ) +#endif { this->Superclass::Initialize(); @@ -130,44 +134,74 @@ NormalizedCorrelationImageToImageMetric if(m_ThreaderSFF != NULL) { delete [] m_ThreaderSFF; } +#if ITK_VERSION_MAJOR <= 4 m_ThreaderSFF = new double[this->m_NumberOfThreads]; +#else + m_ThreaderSFF = new double[this->m_NumberOfWorkUnits]; +#endif if(m_ThreaderSMM != NULL) { delete [] m_ThreaderSMM; } +#if ITK_VERSION_MAJOR <= 4 m_ThreaderSMM = new double[this->m_NumberOfThreads]; +#else + m_ThreaderSMM = new double[this->m_NumberOfWorkUnits]; +#endif if(m_ThreaderSFM != NULL) { delete [] m_ThreaderSFM; } +#if ITK_VERSION_MAJOR <= 4 m_ThreaderSFM = new double[this->m_NumberOfThreads]; +#else + m_ThreaderSFM = new double[this->m_NumberOfWorkUnits]; +#endif if(this->m_SubtractMean) { if(m_ThreaderSF != NULL) { delete [] m_ThreaderSF; } +#if ITK_VERSION_MAJOR <= 4 m_ThreaderSF = new double[this->m_NumberOfThreads]; +#else + m_ThreaderSF = new double[this->m_NumberOfWorkUnits]; +#endif if(m_ThreaderSM != NULL) { delete [] m_ThreaderSM; } +#if ITK_VERSION_MAJOR <= 4 m_ThreaderSM = new double[this->m_NumberOfThreads]; +#else + m_ThreaderSM = new double[this->m_NumberOfWorkUnits]; +#endif } if(m_ThreaderDerivativeF != NULL) { delete [] m_ThreaderDerivativeF; } +#if ITK_VERSION_MAJOR <= 4 m_ThreaderDerivativeF = new DerivativeType[this->m_NumberOfThreads]; for(unsigned int threadID=0; threadIDm_NumberOfThreads; threadID++) { +#else + m_ThreaderDerivativeF = new DerivativeType[this->m_NumberOfWorkUnits]; + for(unsigned int threadID=0; threadIDm_NumberOfWorkUnits; threadID++) { +#endif m_ThreaderDerivativeF[threadID].SetSize( this->m_NumberOfParameters ); } if(m_ThreaderDerivativeM != NULL) { delete [] m_ThreaderDerivativeM; } +#if ITK_VERSION_MAJOR <= 4 m_ThreaderDerivativeM = new DerivativeType[this->m_NumberOfThreads]; for(unsigned int threadID=0; threadIDm_NumberOfThreads; threadID++) { +#else + m_ThreaderDerivativeM = new DerivativeType[this->m_NumberOfWorkUnits]; + for(unsigned int threadID=0; threadIDm_NumberOfWorkUnits; threadID++) { +#endif m_ThreaderDerivativeM[threadID].SetSize( this->m_NumberOfParameters ); } } @@ -208,12 +242,23 @@ NormalizedCorrelationImageToImageMetric //Reset the accumulators +#if ITK_VERSION_MAJOR <= 4 memset( m_ThreaderSFF, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); memset( m_ThreaderSMM, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); memset( m_ThreaderSFM, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); +#else + memset( m_ThreaderSFF, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); + memset( m_ThreaderSMM, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); + memset( m_ThreaderSFM, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); +#endif if(this->m_SubtractMean) { +#if ITK_VERSION_MAJOR <= 4 memset( m_ThreaderSF, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); memset( m_ThreaderSM, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); +#else + memset( m_ThreaderSF, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); + memset( m_ThreaderSM, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); +#endif } @@ -244,7 +289,11 @@ NormalizedCorrelationImageToImageMetric sf = m_ThreaderSF[0]; sm = m_ThreaderSM[0]; +#if ITK_VERSION_MAJOR <= 4 for(unsigned int t=1; tm_NumberOfThreads; t++) { +#else + for(unsigned int t=1; tm_NumberOfWorkUnits; t++) { +#endif sff += m_ThreaderSFF[t]; smm += m_ThreaderSMM[t]; sfm += m_ThreaderSFM[t]; @@ -282,12 +331,23 @@ NormalizedCorrelationImageToImageMetric { //No checking for the fixed image, done in the caller //Reset the accumulators +#if ITK_VERSION_MAJOR <= 4 memset( m_ThreaderSFF, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); memset( m_ThreaderSMM, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); memset( m_ThreaderSFM, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); +#else + memset( m_ThreaderSFF, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); + memset( m_ThreaderSMM, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); + memset( m_ThreaderSFM, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); +#endif if(this->m_SubtractMean) { +#if ITK_VERSION_MAJOR <= 4 memset( m_ThreaderSF, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); memset( m_ThreaderSM, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); +#else + memset( m_ThreaderSF, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); + memset( m_ThreaderSM, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); +#endif } @@ -317,7 +377,11 @@ NormalizedCorrelationImageToImageMetric m_SF = m_ThreaderSF[0]; m_SM = m_ThreaderSM[0]; +#if ITK_VERSION_MAJOR <= 4 for(unsigned int t=1; tm_NumberOfThreads; t++) { +#else + for(unsigned int t=1; tm_NumberOfWorkUnits; t++) { +#endif m_SFF += m_ThreaderSFF[t]; m_SMM += m_ThreaderSMM[t]; m_SFM += m_ThreaderSFM[t]; @@ -431,8 +495,11 @@ NormalizedCorrelationImageToImageMetric memset( derivative.data_block(), 0, this->m_NumberOfParameters * sizeof(typename DerivativeType::ValueType) ); - +#if ITK_VERSION_MAJOR <= 4 for( unsigned int threadID = 0; threadIDm_NumberOfThreads; threadID++ ) { +#else + for( unsigned int threadID = 0; threadIDm_NumberOfWorkUnits; threadID++ ) { +#endif memset( m_ThreaderDerivativeF[threadID].data_block(), 0, this->m_NumberOfParameters * sizeof(typename DerivativeType::ValueType) ); @@ -447,7 +514,11 @@ NormalizedCorrelationImageToImageMetric // Accumulate over the threads DerivativeType derivativeF(this->m_NumberOfParameters), derivativeM(this->m_NumberOfParameters); +#if ITK_VERSION_MAJOR <= 4 for(unsigned int t=0; tm_NumberOfThreads; t++) { +#else + for(unsigned int t=0; tm_NumberOfWorkUnits; t++) { +#endif for(unsigned int parameter = 0; parameter < this->m_NumberOfParameters; parameter++) { derivativeF[parameter] += m_ThreaderDerivativeF[t][parameter]; derivativeM[parameter] += m_ThreaderDerivativeM[t][parameter]; diff --git a/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h b/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h index 24afdbe..208cb38 100644 --- a/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h +++ b/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h @@ -95,7 +95,11 @@ public: * (2) uniformly select NumberOfSpatialSamples within * the FixedImageRegion, and * (3) allocate memory for pdf data structures. */ +#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 )) + virtual void Initialize(void) ITK_OVERRIDE; +#else virtual void Initialize(void) throw ( itk::ExceptionObject ) ITK_OVERRIDE; +#endif /** Get the value. */ MeasureType GetValue( const ParametersType & parameters ) const ITK_OVERRIDE; diff --git a/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx b/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx index 959bfed..042b4b7 100644 --- a/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx +++ b/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx @@ -117,7 +117,11 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD template void NormalizedCorrelationImageToImageMetricFor3DBLUTFFD +#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 )) +::Initialize(void) +#else ::Initialize(void) throw ( itk::ExceptionObject ) +#endif { this->Superclass::Initialize(); @@ -130,44 +134,74 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD if(m_ThreaderSFF != NULL) { delete [] m_ThreaderSFF; } +#if ITK_VERSION_MAJOR <= 4 m_ThreaderSFF = new double[this->m_NumberOfThreads]; +#else + m_ThreaderSFF = new double[this->m_NumberOfWorkUnits]; +#endif if(m_ThreaderSMM != NULL) { delete [] m_ThreaderSMM; } +#if ITK_VERSION_MAJOR <= 4 m_ThreaderSMM = new double[this->m_NumberOfThreads]; +#else + m_ThreaderSMM = new double[this->m_NumberOfWorkUnits]; +#endif if(m_ThreaderSFM != NULL) { delete [] m_ThreaderSFM; } +#if ITK_VERSION_MAJOR <= 4 m_ThreaderSFM = new double[this->m_NumberOfThreads]; +#else + m_ThreaderSFM = new double[this->m_NumberOfWorkUnits]; +#endif if(this->m_SubtractMean) { if(m_ThreaderSF != NULL) { delete [] m_ThreaderSF; } +#if ITK_VERSION_MAJOR <= 4 m_ThreaderSF = new double[this->m_NumberOfThreads]; +#else + m_ThreaderSF = new double[this->m_NumberOfWorkUnits]; +#endif if(m_ThreaderSM != NULL) { delete [] m_ThreaderSM; } +#if ITK_VERSION_MAJOR <= 4 m_ThreaderSM = new double[this->m_NumberOfThreads]; +#else + m_ThreaderSM = new double[this->m_NumberOfWorkUnits]; +#endif } if(m_ThreaderDerivativeF != NULL) { delete [] m_ThreaderDerivativeF; } +#if ITK_VERSION_MAJOR <= 4 m_ThreaderDerivativeF = new DerivativeType[this->m_NumberOfThreads]; for(unsigned int threadID=0; threadIDm_NumberOfThreads; threadID++) { +#else + m_ThreaderDerivativeF = new DerivativeType[this->m_NumberOfWorkUnits]; + for(unsigned int threadID=0; threadIDm_NumberOfWorkUnits; threadID++) { +#endif m_ThreaderDerivativeF[threadID].SetSize( this->m_NumberOfParameters ); } if(m_ThreaderDerivativeM != NULL) { delete [] m_ThreaderDerivativeM; } +#if ITK_VERSION_MAJOR <= 4 m_ThreaderDerivativeM = new DerivativeType[this->m_NumberOfThreads]; for(unsigned int threadID=0; threadIDm_NumberOfThreads; threadID++) { +#else + m_ThreaderDerivativeM = new DerivativeType[this->m_NumberOfWorkUnits]; + for(unsigned int threadID=0; threadIDm_NumberOfWorkUnits; threadID++) { +#endif m_ThreaderDerivativeM[threadID].SetSize( this->m_NumberOfParameters ); } } @@ -208,12 +242,23 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD //Reset the accumulators +#if ITK_VERSION_MAJOR <= 4 memset( m_ThreaderSFF, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); memset( m_ThreaderSMM, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); memset( m_ThreaderSFM, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); +#else + memset( m_ThreaderSFF, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); + memset( m_ThreaderSMM, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); + memset( m_ThreaderSFM, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); +#endif if(this->m_SubtractMean) { +#if ITK_VERSION_MAJOR <= 4 memset( m_ThreaderSF, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); memset( m_ThreaderSM, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); +#else + memset( m_ThreaderSF, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); + memset( m_ThreaderSM, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); +#endif } @@ -244,7 +289,11 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD sf = m_ThreaderSF[0]; sm = m_ThreaderSM[0]; +#if ITK_VERSION_MAJOR <= 4 for(unsigned int t=1; tm_NumberOfThreads; t++) { +#else + for(unsigned int t=1; tm_NumberOfWorkUnits; t++) { +#endif sff += m_ThreaderSFF[t]; smm += m_ThreaderSMM[t]; sfm += m_ThreaderSFM[t]; @@ -282,12 +331,23 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD { //No checking for the fixed image, done in the caller //Reset the accumulators +#if ITK_VERSION_MAJOR <= 4 memset( m_ThreaderSFF, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); memset( m_ThreaderSMM, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); memset( m_ThreaderSFM, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); +#else + memset( m_ThreaderSFF, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); + memset( m_ThreaderSMM, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); + memset( m_ThreaderSFM, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); +#endif if(this->m_SubtractMean) { +#if ITK_VERSION_MAJOR <= 4 memset( m_ThreaderSF, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); memset( m_ThreaderSM, 0, this->m_NumberOfThreads * sizeof(AccumulateType) ); +#else + memset( m_ThreaderSF, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); + memset( m_ThreaderSM, 0, this->m_NumberOfWorkUnits * sizeof(AccumulateType) ); +#endif } @@ -317,7 +377,11 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD m_SF = m_ThreaderSF[0]; m_SM = m_ThreaderSM[0]; +#if ITK_VERSION_MAJOR <= 4 for(unsigned int t=1; tm_NumberOfThreads; t++) { +#else + for(unsigned int t=1; tm_NumberOfWorkUnits; t++) { +#endif m_SFF += m_ThreaderSFF[t]; m_SMM += m_ThreaderSMM[t]; m_SFM += m_ThreaderSFM[t]; @@ -457,7 +521,11 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD 0, this->m_NumberOfParameters * sizeof(typename DerivativeType::ValueType) ); +#if ITK_VERSION_MAJOR <= 4 for( unsigned int threadID = 0; threadIDm_NumberOfThreads; threadID++ ) { +#else + for( unsigned int threadID = 0; threadIDm_NumberOfWorkUnits; threadID++ ) { +#endif memset( m_ThreaderDerivativeF[threadID].data_block(), 0, this->m_NumberOfParameters * sizeof(typename DerivativeType::ValueType) ); @@ -472,7 +540,11 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD // Accumulate over the threads DerivativeType derivativeF(this->m_NumberOfParameters), derivativeM(this->m_NumberOfParameters); +#if ITK_VERSION_MAJOR <= 4 for(unsigned int t=0; tm_NumberOfThreads; t++) { +#else + for(unsigned int t=0; tm_NumberOfWorkUnits; t++) { +#endif for(unsigned int parameter = 0; parameter < this->m_NumberOfParameters; parameter++) { derivativeF[parameter] += m_ThreaderDerivativeF[t][parameter]; derivativeM[parameter] += m_ThreaderDerivativeM[t][parameter]; diff --git a/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.h b/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.h index e914c1f..c51414e 100644 --- a/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.h +++ b/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.h @@ -187,7 +187,11 @@ public: * (2) uniformly select NumberOfSpatialSamples within * the FixedImageRegion, and * (3) allocate memory for pdf data structures. */ +#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 )) + virtual void Initialize(void) ITK_OVERRIDE; +#else virtual void Initialize(void) throw ( ExceptionObject ) ITK_OVERRIDE; +#endif /** Get the value. */ MeasureType GetValue( const ParametersType & parameters ) const ITK_OVERRIDE; diff --git a/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx b/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx index dec3acf..ef4257e 100644 --- a/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx +++ b/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx @@ -183,7 +183,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD template void MattesMutualInformationImageToImageMetricFor3DBLUTFFD +#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 )) +::Initialize(void) +#else ::Initialize(void) throw ( ExceptionObject ) +#endif { this->Superclass::Initialize(); this->Superclass::MultiThreadingInitialize(); @@ -192,7 +196,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD typename FixedImageStatisticsFilterType::Pointer fixedImageStats = FixedImageStatisticsFilterType::New(); fixedImageStats->SetInput( this->m_FixedImage ); +#if ITK_VERSION_MAJOR <= 4 fixedImageStats->SetNumberOfThreads( this->m_NumberOfThreads ); +#else + fixedImageStats->SetNumberOfWorkUnits( this->m_NumberOfWorkUnits ); +#endif fixedImageStats->Update(); m_FixedImageTrueMin = fixedImageStats->GetMinimum(); @@ -205,7 +213,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD typename MovingImageStatisticsFilterType::Pointer movingImageStats = MovingImageStatisticsFilterType::New(); movingImageStats->SetInput( this->m_MovingImage ); +#if ITK_VERSION_MAJOR <= 4 movingImageStats->SetNumberOfThreads( this->m_NumberOfThreads ); +#else + movingImageStats->SetNumberOfWorkUnits( this->m_NumberOfWorkUnits ); +#endif movingImageStats->Update(); m_MovingImageTrueMin = movingImageStats->GetMinimum(); @@ -362,35 +374,62 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD } // Assumes number of threads doesn't change between calls to Initialize m_ThreaderFixedImageMarginalPDF = new - PDFValueType[(this->m_NumberOfThreads-1) - * m_NumberOfHistogramBins]; +#if ITK_VERSION_MAJOR <= 4 + PDFValueType[(this->m_NumberOfThreads-1) * m_NumberOfHistogramBins]; +#else + PDFValueType[(this->m_NumberOfWorkUnits-1) * m_NumberOfHistogramBins]; +#endif if(m_ThreaderJointPDF != NULL) { delete [] m_ThreaderJointPDF; } m_ThreaderJointPDF = new typename +#if ITK_VERSION_MAJOR <= 4 JointPDFType::Pointer[this->m_NumberOfThreads-1]; +#else + JointPDFType::Pointer[this->m_NumberOfWorkUnits-1]; +#endif if(m_ThreaderJointPDFStartBin != NULL) { delete [] m_ThreaderJointPDFStartBin; } +#if ITK_VERSION_MAJOR <= 4 m_ThreaderJointPDFStartBin = new int[this->m_NumberOfThreads]; +#else + m_ThreaderJointPDFStartBin = new int[this->m_NumberOfWorkUnits]; +#endif if(m_ThreaderJointPDFEndBin != NULL) { delete [] m_ThreaderJointPDFEndBin; } +#if ITK_VERSION_MAJOR <= 4 m_ThreaderJointPDFEndBin = new int[this->m_NumberOfThreads]; +#else + m_ThreaderJointPDFEndBin = new int[this->m_NumberOfWorkUnits]; +#endif if(m_ThreaderJointPDFSum != NULL) { delete [] m_ThreaderJointPDFSum; } +#if ITK_VERSION_MAJOR <= 4 m_ThreaderJointPDFSum = new double[this->m_NumberOfThreads]; +#else + m_ThreaderJointPDFSum = new double[this->m_NumberOfWorkUnits]; +#endif unsigned int threadID; +#if ITK_VERSION_MAJOR <= 4 int binRange = m_NumberOfHistogramBins / this->m_NumberOfThreads; +#else + int binRange = m_NumberOfHistogramBins / this->m_NumberOfWorkUnits; +#endif +#if ITK_VERSION_MAJOR <= 4 for(threadID = 0; threadID < this->m_NumberOfThreads-1; threadID++) { +#else + for(threadID = 0; threadID < this->m_NumberOfWorkUnits-1; threadID++) { +#endif m_ThreaderJointPDF[threadID] = JointPDFType::New(); m_ThreaderJointPDF[threadID]->SetRegions( jointPDFRegion ); m_ThreaderJointPDF[threadID]->Allocate(); @@ -399,10 +438,13 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD m_ThreaderJointPDFEndBin[threadID] = (threadID + 1) * binRange - 1; } - m_ThreaderJointPDFStartBin[this->m_NumberOfThreads-1] = - (this->m_NumberOfThreads - 1 ) * binRange; - +#if ITK_VERSION_MAJOR <= 4 + m_ThreaderJointPDFStartBin[this->m_NumberOfThreads-1] = (this->m_NumberOfThreads - 1 ) * binRange; m_ThreaderJointPDFEndBin[this->m_NumberOfThreads-1] = m_NumberOfHistogramBins - 1; +#else + m_ThreaderJointPDFStartBin[this->m_NumberOfWorkUnits-1] = (this->m_NumberOfWorkUnits - 1 ) * binRange; + m_ThreaderJointPDFEndBin[this->m_NumberOfWorkUnits-1] = m_NumberOfHistogramBins - 1; +#endif // Release memory of arrays that may have been used for // previous executions of this metric with different settings @@ -420,18 +462,34 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD if( this->m_UseExplicitPDFDerivatives ) { m_ThreaderJointPDFDerivatives = new typename +#if ITK_VERSION_MAJOR <= 4 JointPDFDerivativesType::Pointer[this->m_NumberOfThreads-1]; +#else + JointPDFDerivativesType::Pointer[this->m_NumberOfWorkUnits-1]; +#endif +#if ITK_VERSION_MAJOR <= 4 for(threadID = 0; threadID < this->m_NumberOfThreads-1; threadID++) { +#else + for(threadID = 0; threadID < this->m_NumberOfWorkUnits-1; threadID++) { +#endif m_ThreaderJointPDFDerivatives[threadID] = JointPDFDerivativesType::New(); m_ThreaderJointPDFDerivatives[threadID]->SetRegions( jointPDFDerivativesRegion ); m_ThreaderJointPDFDerivatives[threadID]->Allocate(); } } else { +#if ITK_VERSION_MAJOR <= 4 m_ThreaderMetricDerivative = new DerivativeType[this->m_NumberOfThreads-1]; +#else + m_ThreaderMetricDerivative = new DerivativeType[this->m_NumberOfWorkUnits-1]; +#endif +#if ITK_VERSION_MAJOR <= 4 for(threadID = 0; threadID < this->m_NumberOfThreads-1; threadID++) { +#else + for(threadID = 0; threadID < this->m_NumberOfWorkUnits-1; threadID++) { +#endif this->m_ThreaderMetricDerivative[threadID] = DerivativeType( this->GetNumberOfParameters() ); } } @@ -595,7 +653,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD unsigned int tPdfPtrOffset; tPdfPtrOffset = ( m_ThreaderJointPDFStartBin[threadID] * m_JointPDF->GetOffsetTable()[1] ); +#if ITK_VERSION_MAJOR <= 4 for(t=0; tm_NumberOfThreads-1; t++) { +#else + for(t=0; tm_NumberOfWorkUnits-1; t++) { +#endif pdfPtr = pdfPtrStart; tPdfPtr = m_ThreaderJointPDF[t]->GetBufferPointer() + tPdfPtrOffset; tPdfPtrEnd = tPdfPtr + maxI; @@ -637,7 +699,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD // MUST BE CALLED TO INITIATE PROCESSING this->GetValueMultiThreadedPostProcessInitiate(); +#if ITK_VERSION_MAJOR <= 4 for(unsigned int threadID = 0; threadIDm_NumberOfThreads-1; threadID++) { +#else + for(unsigned int threadID = 0; threadIDm_NumberOfWorkUnits-1; threadID++) { +#endif m_JointPDFSum += m_ThreaderJointPDFSum[threadID]; } if ( m_JointPDFSum == 0.0 ) { @@ -883,7 +949,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD JointPDFDerivativesValueType *tPdfDPtrEnd; unsigned int tPdfDPtrOffset; tPdfDPtrOffset = m_ThreaderJointPDFStartBin[threadID] * rowSize; +#if ITK_VERSION_MAJOR <= 4 for(unsigned int t=0; tm_NumberOfThreads-1; t++) { +#else + for(unsigned int t=0; tm_NumberOfWorkUnits-1; t++) { +#endif pdfDPtr = pdfDPtrStart; tPdfDPtr = m_ThreaderJointPDFDerivatives[t]->GetBufferPointer() + tPdfDPtrOffset; @@ -930,7 +1000,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD } else { this->m_PRatioArray.Fill( 0.0 ); this->m_MetricDerivative.Fill( NumericTraits< MeasureType >::Zero ); +#if ITK_VERSION_MAJOR <= 4 for(unsigned int threadID = 0; threadID < this->m_NumberOfThreads-1; threadID++ ) { +#else + for(unsigned int threadID = 0; threadID < this->m_NumberOfWorkUnits-1; threadID++ ) { +#endif this->m_ThreaderMetricDerivative[threadID].Fill( NumericTraits< MeasureType >::Zero ); } this->m_ImplicitDerivativesSecondPass = false; @@ -945,7 +1019,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD // CALL IF DOING THREADED POST PROCESSING this->GetValueAndDerivativeMultiThreadedPostProcessInitiate(); +#if ITK_VERSION_MAJOR <= 4 for(unsigned int threadID = 0; threadIDm_NumberOfThreads-1; threadID++) { +#else + for(unsigned int threadID = 0; threadIDm_NumberOfWorkUnits-1; threadID++) { +#endif m_JointPDFSum += m_ThreaderJointPDFSum[threadID]; } if ( m_JointPDFSum == 0.0 ) { @@ -1054,7 +1132,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD // Consolidate the contributions from each one of the threads to the total // derivative. +#if ITK_VERSION_MAJOR <= 4 for(unsigned int t = 0; t < this->m_NumberOfThreads-1; t++ ) { +#else + for(unsigned int t = 0; t < this->m_NumberOfWorkUnits-1; t++ ) { +#endif DerivativeType * source = &(this->m_ThreaderMetricDerivative[t]); for(unsigned int pp=0; pp < this->m_NumberOfParameters; pp++ ) { this->m_MetricDerivative[pp] += (*source)[pp]; diff --git a/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h b/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h index 06ecf29..e12b42f 100644 --- a/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h +++ b/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h @@ -98,7 +98,11 @@ public: * (2) uniformly select NumberOfSpatialSamples within * the FixedImageRegion, and * (3) allocate memory for pdf data structures. */ +#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 )) + virtual void Initialize(void) ITK_OVERRIDE; +#else virtual void Initialize(void) throw ( ExceptionObject ) ITK_OVERRIDE; +#endif /** Get the value. */ MeasureType GetValue( const ParametersType & parameters ) const ITK_OVERRIDE; diff --git a/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.txx b/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.txx index dd7000d..02427a3 100644 --- a/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.txx +++ b/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.txx @@ -100,7 +100,11 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD template void MeanSquaresImageToImageMetricFor3DBLUTFFD +#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 )) +::Initialize(void) +#else ::Initialize(void) throw ( ExceptionObject ) +#endif { this->Superclass::Initialize(); @@ -109,13 +113,22 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD if(m_ThreaderMSE != NULL) { delete [] m_ThreaderMSE; } +#if ITK_VERSION_MAJOR <= 4 m_ThreaderMSE = new double[this->m_NumberOfThreads]; +#else + m_ThreaderMSE = new double[this->m_NumberOfWorkUnits]; +#endif if(m_ThreaderMSEDerivatives != NULL) { delete [] m_ThreaderMSEDerivatives; } +#if ITK_VERSION_MAJOR <= 4 m_ThreaderMSEDerivatives = new DerivativeType[this->m_NumberOfThreads]; for(unsigned int threadID=0; threadIDm_NumberOfThreads; threadID++) { +#else + m_ThreaderMSEDerivatives = new DerivativeType[this->m_NumberOfWorkUnits]; + for(unsigned int threadID=0; threadIDm_NumberOfWorkUnits; threadID++) { +#endif m_ThreaderMSEDerivatives[threadID].SetSize( this->m_NumberOfParameters ); } } @@ -147,9 +160,11 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD itkExceptionMacro( << "Fixed image has not been assigned" ); } - memset( m_ThreaderMSE, - 0, - this->m_NumberOfThreads * sizeof(MeasureType) ); +#if ITK_VERSION_MAJOR <= 4 + memset( m_ThreaderMSE, 0, this->m_NumberOfThreads * sizeof(MeasureType) ); +#else + memset( m_ThreaderMSE, 0, this->m_NumberOfWorkUnits * sizeof(MeasureType) ); +#endif // Set up the parameters in the transform this->m_Transform->SetParameters( parameters ); @@ -171,7 +186,11 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD } double mse = m_ThreaderMSE[0]; +#if ITK_VERSION_MAJOR <= 4 for(unsigned int t=1; tm_NumberOfThreads; t++) { +#else + for(unsigned int t=1; tm_NumberOfWorkUnits; t++) { +#endif mse += m_ThreaderMSE[t]; } mse /= this->m_NumberOfPixelsCounted; @@ -252,9 +271,11 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD this->m_Transform->SetParameters( parameters ); // Reset the joint pdfs to zero - memset( m_ThreaderMSE, - 0, - this->m_NumberOfThreads * sizeof(MeasureType) ); +#if ITK_VERSION_MAJOR <= 4 + memset( m_ThreaderMSE, 0, this->m_NumberOfThreads * sizeof(MeasureType) ); +#else + memset( m_ThreaderMSE, 0, this->m_NumberOfWorkUnits * sizeof(MeasureType) ); +#endif // Set output values to zero if(derivative.GetSize() != this->m_NumberOfParameters) { @@ -264,7 +285,11 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD 0, this->m_NumberOfParameters * sizeof(double) ); +#if ITK_VERSION_MAJOR <= 4 for( unsigned int threadID = 0; threadIDm_NumberOfThreads; threadID++ ) { +#else + for( unsigned int threadID = 0; threadIDm_NumberOfWorkUnits; threadID++ ) { +#endif memset( m_ThreaderMSEDerivatives[threadID].data_block(), 0, this->m_NumberOfParameters * sizeof(double) ); @@ -287,7 +312,11 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD } value = 0; +#if ITK_VERSION_MAJOR <= 4 for(unsigned int t=0; tm_NumberOfThreads; t++) { +#else + for(unsigned int t=0; tm_NumberOfWorkUnits; t++) { +#endif value += m_ThreaderMSE[t]; for(unsigned int parameter = 0; parameter < this->m_NumberOfParameters; parameter++) { diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index e616c35..0a044fe 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -54,6 +54,11 @@ if(CLITK_BUILD_TOOLS) target_link_libraries(clitkImageInfo clitkCommon) set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkImageInfo) + WRAP_GGO(clitkScintivolStats_GGO_C clitkScintivolStats.ggo) + add_executable(clitkScintivolStats clitkScintivolStats.cxx ${clitkScintivolStats_GGO_C}) + target_link_libraries(clitkScintivolStats clitkCommon) + set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkScintivolStats) + add_executable(clitkImageConvert clitkImageConvert.cxx) target_link_libraries(clitkImageConvert clitkImageConvertLib clitkCommon) set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkImageConvert) @@ -147,13 +152,14 @@ if(CLITK_BUILD_TOOLS) set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkInvertVF) WRAP_GGO(clitkAffineTransform_GGO_C clitkAffineTransform.ggo) + add_library(clitkAffineTransformLib clitkAffineTransform.cxx ${clitkAffineTransform_GGO_C}) add_executable(clitkAffineTransform clitkAffineTransform.cxx ${clitkAffineTransform_GGO_C}) target_link_libraries(clitkAffineTransform clitkCommon ) set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkAffineTransform) WRAP_GGO(clitkElastixTransformToMatrix_GGO_C clitkElastixTransformToMatrix.ggo) add_executable(clitkElastixTransformToMatrix clitkElastixTransformToMatrix.cxx ${clitkElastixTransformToMatrix_GGO_C}) - target_link_libraries(clitkElastixTransformToMatrix clitkCommon ) + target_link_libraries(clitkElastixTransformToMatrix clitkAffineTransformLib clitkCommon ) set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkElastixTransformToMatrix) WRAP_GGO(clitkMatrixToElastixTransform_GGO_C clitkMatrixToElastixTransform.ggo) @@ -269,6 +275,16 @@ if(CLITK_BUILD_TOOLS) target_link_libraries(clitkImageStatistics clitkCommon) set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkImageStatistics) + WRAP_GGO(clitkSUVPeak_GGO_C clitkSUVPeak.ggo) + add_executable(clitkSUVPeak clitkSUVPeak.cxx clitkSUVPeakGenericFilter.cxx ${clitkSUVPeak_GGO_C}) + target_link_libraries(clitkSUVPeak clitkCommon) + set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkSUVPeak) + + WRAP_GGO(clitkRTStructStatistics_GGO_C clitkRTStructStatistics.ggo) + add_executable(clitkRTStructStatistics clitkRTStructStatistics.cxx clitkRTStructStatisticsGenericFilter.cxx ${clitkRTStructStatistics_GGO_C}) + target_link_libraries(clitkRTStructStatistics clitkCommon) + set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkRTStructStatistics) + WRAP_GGO(clitkVFConvert_GGO_C clitkVFConvert.ggo) add_executable(clitkVFConvert clitkVFConvert.cxx clitkVFConvertGenericFilter.cxx ${clitkVFConvert_GGO_C}) target_link_libraries(clitkVFConvert clitkCommon ) @@ -303,6 +319,11 @@ if(CLITK_BUILD_TOOLS) target_link_libraries(clitkSum clitkCommon) set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkSum) + WRAP_GGO(clitkExtrude_GGO_C clitkExtrude.ggo) + add_executable(clitkExtrude clitkExtrude.cxx ${clitkExtrude_GGO_C}) + target_link_libraries(clitkExtrude clitkCommon) + set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkExtrude) + WRAP_GGO(clitkTransformLandmarks_GGO_C clitkTransformLandmarks.ggo) add_executable(clitkTransformLandmarks clitkTransformLandmarks.cxx ${clitkTransformLandmarks_GGO_C}) target_link_libraries(clitkTransformLandmarks clitkCommon) diff --git a/tools/clitkAffineTransformGenericFilter.txx b/tools/clitkAffineTransformGenericFilter.txx index ab488f3..a3ec420 100644 --- a/tools/clitkAffineTransformGenericFilter.txx +++ b/tools/clitkAffineTransformGenericFilter.txx @@ -94,6 +94,10 @@ namespace clitk // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; // UpdateWithDimAndPixelType(); // } + else if(PixelType == "double"){ + if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and double..." << std::endl; + UpdateWithDimAndPixelType(); + } else { if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; UpdateWithDimAndPixelType(); diff --git a/tools/clitkBackProjectImageGenericFilter.txx b/tools/clitkBackProjectImageGenericFilter.txx index 52dd428..d5a552d 100644 --- a/tools/clitkBackProjectImageGenericFilter.txx +++ b/tools/clitkBackProjectImageGenericFilter.txx @@ -34,7 +34,7 @@ namespace clitk //================================================================================ template void BackProjectImageGenericFilter::UpdateWithPixelType() { - + //--------------------------------- // Define the images //--------------------------------- @@ -51,81 +51,87 @@ namespace clitk const unsigned int OutputImageDimension=3; typedef float OutputPixelType; typedef itk::Image OutputImageType; - + //Create the BackProjectImageFilter typedef BackProjectImageFilter BackProjectImageFilterType; typename BackProjectImageFilterType::Pointer filter=BackProjectImageFilterType::New(); - + //--------------------------------- //Pass all the necessary parameters //--------------------------------- unsigned int i=0; filter->SetInput(input); - if (m_ArgsInfo.threads_given) filter->SetNumberOfThreads(m_ArgsInfo.threads_arg); - + if (m_ArgsInfo.threads_given) { +#if ITK_VERSION_MAJOR <= 4 + filter->SetNumberOfThreads(m_ArgsInfo.threads_arg); +#else + filter->SetNumberOfWorkUnits(m_ArgsInfo.threads_arg); +#endif + } + //Projection parameters OutputImageType::PointType iso; if (m_ArgsInfo.iso_given) - { - for(i=0;iSetIsoCenter(iso); - } + { + for(i=0;iSetIsoCenter(iso); + } if (m_ArgsInfo.panel_shift_given) filter->SetPanelShift(m_ArgsInfo.panel_shift_arg[0], m_ArgsInfo.panel_shift_arg[1]); filter->SetSourceToScreen(m_ArgsInfo.screen_arg); filter->SetSourceToAxis(m_ArgsInfo.axis_arg); filter->SetProjectionAngle(m_ArgsInfo.angle_arg); if (m_ArgsInfo.matrix_given) - { - itk::Matrix rt =ReadMatrix3D(m_ArgsInfo.matrix_arg); - filter->SetRigidTransformMatrix(rt); - } + { + itk::Matrix rt =ReadMatrix3D(m_ArgsInfo.matrix_arg); + filter->SetRigidTransformMatrix(rt); + } filter->SetEdgePaddingValue(static_cast(m_ArgsInfo.pad_arg)); - + //Output image info if (m_ArgsInfo.like_given) - { - typedef itk::ImageFileReader ReaderType; - ReaderType::Pointer reader2=ReaderType::New(); - reader2->SetFileName(m_ArgsInfo.like_arg); - reader2->Update(); + { + typedef itk::ImageFileReader ReaderType; + ReaderType::Pointer reader2=ReaderType::New(); + reader2->SetFileName(m_ArgsInfo.like_arg); + reader2->Update(); - OutputImageType::Pointer image=reader2->GetOutput(); - filter->SetOutputParametersFromImage(image); - } + OutputImageType::Pointer image=reader2->GetOutput(); + filter->SetOutputParametersFromImage(image); + } else + { + if(m_ArgsInfo.origin_given) { - if(m_ArgsInfo.origin_given) - { - OutputImageType::PointType origin; - for(i=0;iSetOutputOrigin(origin); - } - if (m_ArgsInfo.spacing_given) - { - OutputImageType::SpacingType spacing; - for(i=0;iSetOutputSpacing(spacing); - } - if (m_ArgsInfo.spacing_given) - { - OutputImageType::SizeType size; - for(i=0;iSetOutputSize(size); - } + OutputImageType::PointType origin; + for(i=0;iSetOutputOrigin(origin); } + if (m_ArgsInfo.spacing_given) + { + OutputImageType::SpacingType spacing; + for(i=0;iSetOutputSpacing(spacing); + } + if (m_ArgsInfo.spacing_given) + { + OutputImageType::SizeType size; + for(i=0;iSetOutputSize(size); + } + } //Go filter->Update(); - + //Get the output OutputImageType::Pointer output=filter->GetOutput(); - + //Write the output typedef itk::ImageFileWriter OutputWriterType; OutputWriterType::Pointer outputWriter = OutputWriterType::New(); diff --git a/tools/clitkCropImage.ggo b/tools/clitkCropImage.ggo index a674f8b..6308dd2 100644 --- a/tools/clitkCropImage.ggo +++ b/tools/clitkCropImage.ggo @@ -1,32 +1,30 @@ #File clitkCropImage.ggo package "clitkCropImage" version "1.0" -purpose "Crop an image according to a given extends or AutoCrop with a background value or like another image" +purpose "Crop an image according to a given extends or AutoCrop with a background value or like another image. +In all cases, by default, the output origin is set to be able to overlay input and output without registration." -option "config" - "Config file" string no -option "imagetypes" - "Display allowed image types" flag off -option "verbose" v "Verbose" flag off -option "verboseOption" - "Display options values" flag off -option "verboseWarningOff" - "Do not display warning" flag off +option "config" - "Config file" string no +option "imagetypes" - "Display allowed image types" flag off +option "verbose" v "Verbose" flag off +option "verboseOption" - "Display options values" flag off +option "verboseWarningOff" - "Do not display warning" flag off section "I/O" -option "input" i "Input image filename" string yes -option "output" o "Output image filename" string yes +option "input" i "Input image filename" string yes +option "output" o "Output image filename" string yes section "Used determined crop" -option "boundingBox" b "Bounding box of the crop region (in 3D: =x1,x2,y1,y2,z1,z2)" int no multiple -option "lower" l "Size of the lower crop region (multiple values)" int no multiple -option "upper" u "Size of the upper crop region (multiple values)" int no multiple -option "origin" - "Set new origin to zero" flag off +option "boundingBox" b "Bounding box of the crop region in pixel (in 3D: =x1,x2,y1,y2,z1,z2)" int no multiple +option "lower" l "Size of the lower crop region (multiple values)" int no multiple +option "upper" u "Size of the upper crop region (multiple values)" int no multiple +option "origin" - "Set new origin to zero" flag off section "AutoCrop with BG value" -option "BG" - "Background value in input." double default="0" no +option "BG" - "Background value in input." double default="0" no section "Crop like another image" -option "like" - "Crop like this image (must have the same spacing" string no -option "BGLike" - "Background value in output (if like larger)" double default="0" no - - - - +option "like" - "Crop like this image (must have the same spacing" string no +option "updateOrigin" - "By default, with like image, the output origin is the same than the like image. Set to on the flag to keep the origin." flag off +option "BGLike" - "Background value in output (if like larger)" double default="0" no diff --git a/tools/clitkCropImageGenericFilter.cxx b/tools/clitkCropImageGenericFilter.cxx index 4adcb9b..4f3bb23 100644 --- a/tools/clitkCropImageGenericFilter.cxx +++ b/tools/clitkCropImageGenericFilter.cxx @@ -106,6 +106,8 @@ void clitk::CropImageGenericFilter::UpdateWithInputImageType() // Check options if (mArgsInfo.BG_given && mArgsInfo.like_given) clitkExceptionMacro("Do not use --BG and --like at the same time"); + if (mArgsInfo.updateOrigin_flag && !mArgsInfo.like_given) + clitkExceptionMacro("Use --updateOrigin with --like"); // Prepare output typename ImageType::Pointer output; @@ -182,7 +184,7 @@ void clitk::CropImageGenericFilter::UpdateWithInputImageType() typename ImageType::IndexType index = region.GetIndex(); typename ImageType::PointType origin = output->GetOrigin(); typename ImageType::SpacingType spacing = output->GetSpacing(); - if (!mArgsInfo.BG_given) { + if (!mArgsInfo.BG_given && (!mArgsInfo.like_given || mArgsInfo.updateOrigin_flag)) { if (mArgsInfo.verbose_flag) std::cout << "origin before crop " << origin << std::endl; input->TransformIndexToPhysicalPoint(index,origin); if (mArgsInfo.verbose_flag) std::cout << "origin after crop " << origin << std::endl; diff --git a/tools/clitkDicom2Image.cxx b/tools/clitkDicom2Image.cxx index 51a32d1..aa63b04 100644 --- a/tools/clitkDicom2Image.cxx +++ b/tools/clitkDicom2Image.cxx @@ -26,7 +26,7 @@ #include #include #include -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 #include #include #include @@ -64,7 +64,7 @@ int main(int argc, char * argv[]) std::map< int, std::vector > theorientation; std::map< int, std::vector > sliceLocations; std::map< int, std::vector > seriesFiles; -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 if (args_info.verbose_flag) std::cout << "Using GDCM-2.x" << std::endl; #else @@ -76,7 +76,7 @@ int main(int argc, char * argv[]) for(unsigned int i=0; i= 2 gdcm::Reader hreader; hreader.SetFileName(input_files[i].c_str()); hreader.Read(); @@ -91,7 +91,7 @@ int main(int argc, char * argv[]) series_numbers.insert(series_number); theorigin[series_number] = gdcm::ImageHelper::GetOriginValue(hreader.GetFile()); theorientation[series_number] = gdcm::ImageHelper::GetDirectionCosinesValue(hreader.GetFile()); - if (args_info.extract_series_flag) { + if (args_info.patientSystem_flag) { double n1 = theorientation[series_number][1]*theorientation[series_number][5]- theorientation[series_number][2]*theorientation[series_number][4]; double n2 = theorientation[series_number][3]*theorientation[series_number][2]- @@ -241,7 +241,7 @@ int main(int argc, char * argv[]) } vvImageWriter::Pointer writer = vvImageWriter::New(); writer->SetInput(image); - if (args_info.extract_series_flag && !image->GetTransform().empty()) + if (args_info.patientSystem_flag && !image->GetTransform().empty()) writer->SetSaveTransform(true); writer->SetOutputFileName(outfile); writer->Update(); diff --git a/tools/clitkDicomInfo.cxx b/tools/clitkDicomInfo.cxx index 202afc7..183f09f 100644 --- a/tools/clitkDicomInfo.cxx +++ b/tools/clitkDicomInfo.cxx @@ -28,7 +28,7 @@ // itk (gdcm) include #include "gdcmFile.h" -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 #include "gdcmReader.h" #include "gdcmPrinter.h" #include "gdcmDict.h" @@ -46,7 +46,7 @@ int main(int argc, char * argv[]) if (args_info.inputs_num == 0) return 0; // Study ID - #if GDCM_MAJOR_VERSION == 2 + #if GDCM_MAJOR_VERSION >= 2 if (args_info.studyID_flag) { std::set l; for(unsigned int i=0; i= 2 gdcm::Reader reader; reader.SetFileName(args_info.inputs[i]); reader.Read(); diff --git a/tools/clitkExtrude.cxx b/tools/clitkExtrude.cxx new file mode 100644 index 0000000..f860f58 --- /dev/null +++ b/tools/clitkExtrude.cxx @@ -0,0 +1,45 @@ +/*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv + + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://www.centreleonberard.fr + - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the copyright notices for more information. + + It is distributed under dual licence + + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +===========================================================================**/ + +// clitk +#include "clitkExtrude_ggo.h" +#include "clitkExtrudeGenericFilter.h" + +//-------------------------------------------------------------------- +int main(int argc, char * argv[]) +{ + + // Init command line + GGO(clitkExtrude, args_info); + CLITK_INIT; + + // Filter + typedef clitk::ExtrudeGenericFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + + filter->SetArgsInfo(args_info); + try { + filter->Update(); + } catch(std::runtime_error e) { + std::cout << e.what() << std::endl; + } + + return EXIT_SUCCESS; +}// end main + +//-------------------------------------------------------------------- diff --git a/tools/clitkExtrude.ggo b/tools/clitkExtrude.ggo new file mode 100644 index 0000000..8dae45d --- /dev/null +++ b/tools/clitkExtrude.ggo @@ -0,0 +1,14 @@ +#File clitkExtrude.ggo +package "clitkExtrude" +version "1.0" +purpose "Extrude an image i along the last+1 dimension repeating the image N times. So the output has 1 dimension more than the input." + +option "config" - "Config file" string optional +option "verbose" v "Verbose" flag off + +option "input" i "Input image filename" string required +option "output" o "Output image filename" string required +option "size" N "Size in pixel of extrusion" int no default="1" +option "spacing" s "Spacing of the new dimension" double no default="1.0" +option "origin" - "Origin of the new dimension" double no default="0.0" +option "like" l "Size, spacing and origin like this image" string no diff --git a/tools/clitkExtrudeGenericFilter.h b/tools/clitkExtrudeGenericFilter.h new file mode 100644 index 0000000..73f512f --- /dev/null +++ b/tools/clitkExtrudeGenericFilter.h @@ -0,0 +1,69 @@ +/*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv + + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://www.centreleonberard.fr + - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the copyright notices for more information. + + It is distributed under dual licence + + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +===========================================================================**/ +#ifndef clitkExtrudeGenericFilter_h +#define clitkExtrudeGenericFilter_h +#include "clitkIO.h" +#include "clitkImageToImageGenericFilter.h" + +//-------------------------------------------------------------------- +namespace clitk +{ + +template +class ITK_EXPORT ExtrudeGenericFilter: + public ImageToImageGenericFilter > +{ + +public: + + //-------------------------------------------------------------------- + ExtrudeGenericFilter(); + + //-------------------------------------------------------------------- + typedef ExtrudeGenericFilter Self; + typedef itk::SmartPointer Pointer; + typedef itk::SmartPointer ConstPointer; + + //-------------------------------------------------------------------- + // Method for creation through the object factory + // and Run-time type information (and related methods) + itkNewMacro(Self); + itkTypeMacro(ExtrudeGenericFilter, LightObject); + + //-------------------------------------------------------------------- + void SetArgsInfo(const args_info_type & a); + + //-------------------------------------------------------------------- + // Main function called each time the filter is updated + template + void UpdateWithInputImageType(); + +protected: + template void InitializeImageType(); + args_info_type mArgsInfo; + +}; // end class +//-------------------------------------------------------------------- + +} // end namespace clitk + +#ifndef ITK_MANUAL_INSTANTIATION +#include "clitkExtrudeGenericFilter.txx" +#endif + +#endif // #define clitkExtrudeGenericFilter_h diff --git a/tools/clitkExtrudeGenericFilter.txx b/tools/clitkExtrudeGenericFilter.txx new file mode 100644 index 0000000..30eafea --- /dev/null +++ b/tools/clitkExtrudeGenericFilter.txx @@ -0,0 +1,190 @@ +/*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv + + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://www.centreleonberard.fr + - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the copyright notices for more information. + + It is distributed under dual licence + + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +===========================================================================**/ +#ifndef clitkExtrudeGenericFilter_txx +#define clitkExtrudeGenericFilter_txx + +// itk include +#include +#include + +namespace clitk +{ + +//-------------------------------------------------------------------- +template +ExtrudeGenericFilter::ExtrudeGenericFilter(): + ImageToImageGenericFilter("Extrude") +{ + InitializeImageType<2>(); + InitializeImageType<3>(); +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +template +template +void ExtrudeGenericFilter::InitializeImageType() +{ + ADD_DEFAULT_IMAGE_TYPES(Dim); +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +template +void ExtrudeGenericFilter::SetArgsInfo(const args_info_type & a) +{ + mArgsInfo=a; + this->SetIOVerbose(mArgsInfo.verbose_flag); + + if (mArgsInfo.input_given) { + this->SetInputFilename(mArgsInfo.input_arg); + } + if (mArgsInfo.output_given) { + this->SetOutputFilename(mArgsInfo.output_arg); + } +} +//-------------------------------------------------------------------- + +//-------------------------------------------------------------------- +// Update with the number of dimensions and the pixeltype +//-------------------------------------------------------------------- +template +template +void +ExtrudeGenericFilter::UpdateWithInputImageType() +{ + + // Reading input + typename InputImageType::Pointer input = this->template GetInput(0); + + // Main filter + typedef typename InputImageType::PixelType PixelType; + const int Dim = InputImageType::ImageDimension; + typedef itk::Image ImageType; + typedef itk::Image OutputImageType; + + //Create the output + typename OutputImageType::IndexType start; + typename OutputImageType::SizeType size; + typename OutputImageType::PointType origin; + typename OutputImageType::SpacingType spacing; + typename OutputImageType::DirectionType direction; + typename OutputImageType::Pointer output = OutputImageType::New(); + + start.Fill(0); + + //Check if like is given and not size, origin and spacing + int extrusionSize(1); + double extrusionOrigin(0.0), extrusionSpacing(1.0); + + if (mArgsInfo.like_given) { + if (mArgsInfo.size_given || mArgsInfo.spacing_given || mArgsInfo.origin_given) { + std::cerr << "You cannot set --like and --size, --origin or --spacing at the same time" << std::endl; + return; + } + + // Read the input like image + typedef itk::ImageFileReader LikeReaderType; + typename LikeReaderType::Pointer reader = LikeReaderType::New(); + reader->SetFileName(mArgsInfo.like_arg); + reader->Update(); + typename OutputImageType::Pointer likeImage = reader->GetOutput(); + + extrusionSize = likeImage->GetLargestPossibleRegion().GetSize()[Dim]; + extrusionSpacing = likeImage->GetSpacing()[Dim]; + extrusionOrigin = likeImage->GetOrigin()[Dim]; + } else { + if (mArgsInfo.size_given) { + if (mArgsInfo.size_arg > 0) + extrusionSize = mArgsInfo.size_arg; + else { + std::cerr << "The size has to be > 0" << std::endl; + return; + } + } + if (mArgsInfo.origin_given) { + extrusionOrigin = mArgsInfo.origin_arg; + } + if (mArgsInfo.spacing_given) { + if (mArgsInfo.spacing_arg > 0) + extrusionSpacing = mArgsInfo.spacing_arg; + else { + std::cerr << "The spacing has to be > 0" << std::endl; + return; + } + } + } + + for (unsigned int i=0; iGetLargestPossibleRegion().GetSize()[i]; + size[Dim] = extrusionSize; + + for (unsigned int i=0; iGetOrigin()[i]; + if (mArgsInfo.origin_given) + origin[Dim] = mArgsInfo.origin_arg; + else + origin[Dim] = 0; + + for (unsigned int i=0; iGetSpacing()[i]; + if (mArgsInfo.spacing_given) + spacing[Dim] = mArgsInfo.spacing_arg; + else + spacing[Dim] = 1; + + for (unsigned int i=0; iGetDirection()[i][j]; + direction[i][Dim] = 0; + } + for (unsigned int i=0; iSetRegions(region); + output->Allocate(); + output->FillBuffer(0); + output->SetOrigin(origin); + output->SetSpacing(spacing); + output->SetDirection(direction); + + itk::ImageRegionIteratorWithIndex inputIterator(input, input->GetLargestPossibleRegion()); + while(!inputIterator.IsAtEnd()) { + typename OutputImageType::IndexType pixelIndex; + for (unsigned int i=0; iSetPixel(pixelIndex, inputIterator.Get()); + } + ++inputIterator; + } + + this->template SetNextOutput(output); + +} +//-------------------------------------------------------------------- + + +}//end clitk + +#endif //#define clitkExtrudeGenericFilter_txx diff --git a/tools/clitkGateSimulation2DicomGenericFilter.txx b/tools/clitkGateSimulation2DicomGenericFilter.txx index fe849b3..9ad2857 100644 --- a/tools/clitkGateSimulation2DicomGenericFilter.txx +++ b/tools/clitkGateSimulation2DicomGenericFilter.txx @@ -134,7 +134,7 @@ void GateSimulation2DicomGenericFilter::UpdateWithDimAndPixelType() { -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 // ImageTypes typedef itk::Image InputImageType; typedef itk::Image OutputImageType; diff --git a/tools/clitkImage2DicomDoseGenericFilter.txx b/tools/clitkImage2DicomDoseGenericFilter.txx index 1c4e88f..df105fa 100644 --- a/tools/clitkImage2DicomDoseGenericFilter.txx +++ b/tools/clitkImage2DicomDoseGenericFilter.txx @@ -138,7 +138,7 @@ void Image2DicomDoseGenericFilter::UpdateWithDimAndPixelType() { -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 // ImageTypes typedef itk::Image InputImageType; typedef unsigned short int OutputPixelType; diff --git a/tools/clitkInvertVFGenericFilter.txx b/tools/clitkInvertVFGenericFilter.txx index a18a641..405540c 100644 --- a/tools/clitkInvertVFGenericFilter.txx +++ b/tools/clitkInvertVFGenericFilter.txx @@ -156,7 +156,13 @@ InvertVFGenericFilter::UpdateWithDimAndPixelType() filter->SetInput(input); filter->SetVerbose(m_Verbose); - if (m_ArgsInfo.threads_given) filter->SetNumberOfThreads(m_ArgsInfo.threads_arg); + if (m_ArgsInfo.threads_given) { +#if ITK_VERSION_MAJOR <= 4 + filter->SetNumberOfThreads(m_ArgsInfo.threads_arg); +#else + filter->SetNumberOfWorkUnits(m_ArgsInfo.threads_arg); +#endif + } if (m_ArgsInfo.pad_given) { PixelType pad; if (m_ArgsInfo.pad_given != (pad.GetNumberOfComponents()) ) @@ -187,7 +193,13 @@ InvertVFGenericFilter::UpdateWithDimAndPixelType() } filter->SetVerbose(m_Verbose); - if (m_ArgsInfo.threads_given) filter->SetNumberOfThreads(m_ArgsInfo.threads_arg); + if (m_ArgsInfo.threads_given) { +#if ITK_VERSION_MAJOR <= 4 + filter->SetNumberOfThreads(m_ArgsInfo.threads_arg); +#else + filter->SetNumberOfWorkUnits(m_ArgsInfo.threads_arg); +#endif + } if (m_ArgsInfo.pad_given) { PixelType pad; if (m_ArgsInfo.pad_given != (pad.GetNumberOfComponents()) ) diff --git a/tools/clitkPartitionEnergyWindowDicomGenericFilter.txx b/tools/clitkPartitionEnergyWindowDicomGenericFilter.txx index bf58925..8e8fa33 100644 --- a/tools/clitkPartitionEnergyWindowDicomGenericFilter.txx +++ b/tools/clitkPartitionEnergyWindowDicomGenericFilter.txx @@ -136,7 +136,7 @@ void PartitionEnergyWindowDicomGenericFilter::UpdateWithDimAndPixelType() { -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 // ImageTypes typedef itk::Image InputImageType; typedef itk::Image OutputImageType; diff --git a/tools/clitkRTStructStatistics.cxx b/tools/clitkRTStructStatistics.cxx new file mode 100644 index 0000000..504c779 --- /dev/null +++ b/tools/clitkRTStructStatistics.cxx @@ -0,0 +1,46 @@ +/*=========================================================================SUVP + Program: vv http://www.creatis.insa-lyon.fr/rio/vv + + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://www.centreleonberard.fr + - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the copyright notices for more information. + + It is distributed under dual licence + + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +===========================================================================**/ +#ifndef CLITKRTSTRUCTSTATISTICS_CXX +#define CLITKRTSTRUCTSTATISTICS_CXX + +// clitk include +#include "clitkRTStructStatistics_ggo.h" +#include "clitkRTStructStatisticsGenericFilter.h" +#include "clitkIO.h" + +//-------------------------------------------------------------------- +int main(int argc, char * argv[]) +{ + + // Init command line + GGO(clitkRTStructStatistics, args_info); + CLITK_INIT; + + // Creation of a generic filter + typedef clitk::RTStructStatisticsGenericFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + + // Go ! + filter->SetArgsInfo(args_info); + CLITK_TRY_CATCH_EXIT(filter->Update()); + + // this is the end my friend + return EXIT_SUCCESS; +} // end main + +#endif //define CLITKRTSTRUCTSTATISTICS_CXX diff --git a/tools/clitkRTStructStatistics.ggo b/tools/clitkRTStructStatistics.ggo new file mode 100644 index 0000000..11969b3 --- /dev/null +++ b/tools/clitkRTStructStatistics.ggo @@ -0,0 +1,9 @@ +#File clitkRTStructStatistics.ggo +package "clitkRTStructStatistics" +version "2.0" +purpose "Find the centroid (in mm) and roundness of a binarized image." + +option "config" - "Config file" string no +option "verbose" v "Verbose" flag off + +option "input" i "Input image filename (mask)" string yes diff --git a/tools/clitkRTStructStatisticsGenericFilter.cxx b/tools/clitkRTStructStatisticsGenericFilter.cxx new file mode 100644 index 0000000..bff6956 --- /dev/null +++ b/tools/clitkRTStructStatisticsGenericFilter.cxx @@ -0,0 +1,31 @@ +/*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv + + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://www.centreleonberard.fr + - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the copyright notices for more information. + + It is distributed under dual licence + + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +===========================================================================**/ +#ifndef CLITKRTSTRUCTSTATISTICSGENERICFILTER_CXX +#define CLITKRTSTRUCTSTATISTICSGENERICFILTER_CXX + +#include "clitkRTStructStatisticsGenericFilter.h" + +namespace clitk { + // Specialisation +// template<> +// class RTStructStatisticsGenericFilter; + + +} + +#endif //define CLITKRTSTRUCTSTATISTICSGENERICFILTER_CXX diff --git a/tools/clitkRTStructStatisticsGenericFilter.h b/tools/clitkRTStructStatisticsGenericFilter.h new file mode 100644 index 0000000..aeeed80 --- /dev/null +++ b/tools/clitkRTStructStatisticsGenericFilter.h @@ -0,0 +1,84 @@ +/*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv + + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://www.centreleonberard.fr + - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the copyright notices for more information. + + It is distributed under dual licence + + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +===========================================================================**/ +#ifndef CLITKRTSTRUCTSTATISTICSGENERICFILTER_H +#define CLITKRTSTRUCTSTATISTICSGENERICFILTER_H +/** + ------------------------------------------------------------------- + * @file clitkRTStructStatisticsGenericFilter.h + * @author Thomas Baudier + * @date 11 Jul 2016 08:37:53 + + * @brief + -------------------------------------------------------------------*/ + +// clitk include +#include "clitkCommon.h" +#include "clitkImageToImageGenericFilter.h" +#include "clitkRTStructStatistics_ggo.h" + +// itk include +#include "itkImage.h" +#include "itkImageIOBase.h" + +//-------------------------------------------------------------------- +namespace clitk { + + template + class ITK_EXPORT RTStructStatisticsGenericFilter: + public clitk::ImageToImageGenericFilter > { + + public: + + // Constructor + RTStructStatisticsGenericFilter (); + + // Types + typedef RTStructStatisticsGenericFilter Self; + typedef ImageToImageGenericFilterBase Superclass; + typedef itk::SmartPointer Pointer; + typedef itk::SmartPointer ConstPointer; + + // New + itkNewMacro(Self); + + + + //-------------------------------------------------------------------- + void SetArgsInfo(const args_info_type & a); + + //-------------------------------------------------------------------- + // Main function called each time the filter is updated + template + void UpdateWithInputImageType(); + + protected: + template void InitializeImageType(); + args_info_type mArgsInfo; + + }; // end class RTStructStatisticsGenericFilter + +} // end namespace +//-------------------------------------------------------------------- + + +#ifndef ITK_MANUAL_INSTANTIATION +#include "clitkRTStructStatisticsGenericFilter.txx" +#endif + +#endif //#define CLITKRTSTRUCTSTATISTICSGENERICFILTER_H + diff --git a/tools/clitkRTStructStatisticsGenericFilter.txx b/tools/clitkRTStructStatisticsGenericFilter.txx new file mode 100644 index 0000000..3657b50 --- /dev/null +++ b/tools/clitkRTStructStatisticsGenericFilter.txx @@ -0,0 +1,124 @@ +/*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv + + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://www.centreleonberard.fr + - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the copyright notices for more information. + + It is distributed under dual licence + + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +===========================================================================**/ +#ifndef CLITKRTSTRUCTSTATISTICSGENERICFILTER_TXX +#define CLITKRTSTRUCTSTATISTICSGENERICFILTER_TXX + +#include "clitkImageCommon.h" + +#include "itkConnectedComponentImageFilter.h" +#include "itkLabelImageToShapeLabelMapFilter.h" + +namespace clitk +{ + +//-------------------------------------------------------------------- +template +RTStructStatisticsGenericFilter::RTStructStatisticsGenericFilter() + :ImageToImageGenericFilter("RTStructStatisticsGenericFilter") +{ + InitializeImageType<2>(); + InitializeImageType<3>(); + InitializeImageType<4>(); +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +template +template +void RTStructStatisticsGenericFilter::InitializeImageType() +{ + ADD_DEFAULT_IMAGE_TYPES(Dim); +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +template +void RTStructStatisticsGenericFilter::SetArgsInfo(const args_info_type & a) +{ + mArgsInfo=a; + + // Set value + this->SetIOVerbose(mArgsInfo.verbose_flag); + + if (mArgsInfo.input_given) this->AddInputFilename(mArgsInfo.input_arg); + + } +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +template +template +void RTStructStatisticsGenericFilter::UpdateWithInputImageType() +{ + // Read mask input + typedef itk::Image MaskInputImageType; + typename MaskInputImageType::Pointer mask; + mask = this->template GetInput(0); + + //Create the Shape Label Map from the mask + typedef itk::Image< unsigned char, ImageType::ImageDimension > OutputImageType; + typedef itk::ShapeLabelObject< unsigned char, ImageType::ImageDimension > ShapeLabelObjectType; + typedef itk::LabelMap< ShapeLabelObjectType > LabelMapType; + typedef itk::ConnectedComponentImageFilter ConnectedComponentImageFilterType; + typedef itk::LabelImageToShapeLabelMapFilter< OutputImageType, LabelMapType> I2LType; + + typename ConnectedComponentImageFilterType::Pointer connected = ConnectedComponentImageFilterType::New (); + connected->SetInput(mask); + connected->FullyConnectedOn(); + connected->Update(); + + //Create a map to contain all connectedComponent (even a little pixel) + typename I2LType::Pointer i2l = I2LType::New(); + i2l->SetInput( connected->GetOutput() ); + i2l->SetComputePerimeter(true); + i2l->Update(); + + // Retrieve the biggest component + LabelMapType *labelMap = i2l->GetOutput(); + int largestComponent(0); + int nbPixel(0); + for (unsigned int n = 0; n < labelMap->GetNumberOfLabelObjects(); ++n) + { + ShapeLabelObjectType *labelObject = labelMap->GetNthLabelObject(n); + if (labelObject->GetNumberOfPixels() > nbPixel) + { + nbPixel = labelObject->GetNumberOfPixels(); + largestComponent = n; + } + } + + //Write statitistics on the largest component + ShapeLabelObjectType *labelObject = labelMap->GetNthLabelObject(largestComponent); + std::cout << " Centroid position (mm): " << std::endl; + std::cout << labelObject->GetCentroid()[0] << std::endl; + std::cout << labelObject->GetCentroid()[1] << std::endl; + std::cout << labelObject->GetCentroid()[2] << std::endl; + std::cout << " Roundness: " << std::endl; + std::cout << labelObject->GetRoundness() << std::endl; + +} +//-------------------------------------------------------------------- + + + +} // end namespace + +#endif //#define CLITKRTSTRUCTSTATISTICSGENERICFILTER_TXX diff --git a/tools/clitkSUVPeak.cxx b/tools/clitkSUVPeak.cxx new file mode 100644 index 0000000..0ad4000 --- /dev/null +++ b/tools/clitkSUVPeak.cxx @@ -0,0 +1,46 @@ +/*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv + + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://www.centreleonberard.fr + - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the copyright notices for more information. + + It is distributed under dual licence + + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +===========================================================================**/ +#ifndef CLITKSUVPEAK_CXX +#define CLITKSUVPEAK_CXX + +// clitk include +#include "clitkSUVPeak_ggo.h" +#include "clitkSUVPeakGenericFilter.h" +#include "clitkIO.h" + +//-------------------------------------------------------------------- +int main(int argc, char * argv[]) +{ + + // Init command line + GGO(clitkSUVPeak, args_info); + CLITK_INIT; + + // Creation of a generic filter + typedef clitk::SUVPeakGenericFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + + // Go ! + filter->SetArgsInfo(args_info); + CLITK_TRY_CATCH_EXIT(filter->Update()); + + // this is the end my friend + return EXIT_SUCCESS; +} // end main + +#endif //define CLITKSUVPEAK_CXX diff --git a/tools/clitkSUVPeak.ggo b/tools/clitkSUVPeak.ggo new file mode 100644 index 0000000..051a31e --- /dev/null +++ b/tools/clitkSUVPeak.ggo @@ -0,0 +1,15 @@ +#File clitkSUVPeak.ggo +package "clitkSUVPeak" +version "2.0" +purpose "This tool Compute the SUV Peak. +The output is the position of the SUV Peak (in mm) and its value. +The filter use a normalized sphere of 1 cc with 1 for voxel inside, 0 for outside. +And for voxels that intercepted the sphere, it computes the intersection volume using Monte Carlo simulation." + +option "config" - "Config file" string no +option "verbose" v "Verbose" flag off + +option "input" i "Input first image filename" string yes +option "mask" m "Mask image filename (uchar)" string no +option "allow_resize" r "Resize mask if different from input" flag off +option "volume" - "Volume of the filter in cc" double default="1" no diff --git a/tools/clitkSUVPeakGenericFilter.cxx b/tools/clitkSUVPeakGenericFilter.cxx new file mode 100644 index 0000000..49576dc --- /dev/null +++ b/tools/clitkSUVPeakGenericFilter.cxx @@ -0,0 +1,31 @@ +/*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv + + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://www.centreleonberard.fr + - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the copyright notices for more information. + + It is distributed under dual licence + + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +===========================================================================**/ +#ifndef CLITKSUVPEAKGENERICFILTER_CXX +#define CLITKSUVPEAKGENERICFILTER_CXX + +#include "clitkSUVPeakGenericFilter.h" + +namespace clitk { + // Specialisation +// template<> +// class SUVPeakGenericFilter; + + +} + +#endif //define CLITKSUVPEAKGENERICFILTER_CXX diff --git a/tools/clitkSUVPeakGenericFilter.h b/tools/clitkSUVPeakGenericFilter.h new file mode 100644 index 0000000..6357167 --- /dev/null +++ b/tools/clitkSUVPeakGenericFilter.h @@ -0,0 +1,89 @@ +/*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv + + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://www.centreleonberard.fr + - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the copyright notices for more information. + + It is distributed under dual licence + + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +===========================================================================**/ +#ifndef CLITKSUVPEAKGENERICFILTER_H +#define CLITKSUVPEAKGENERICFILTER_H +/** + ------------------------------------------------------------------- + * @file clitkSUVPeakGenericFilter.h + * @author David Sarrut + * @date 23 Feb 2008 08:37:53 + + * @brief + -------------------------------------------------------------------*/ + +// clitk include +#include "clitkCommon.h" +#include "clitkImageToImageGenericFilter.h" +#include "clitkSUVPeak_ggo.h" + +// itk include +#include "itkImage.h" +#include "itkImageIOBase.h" +#include "itkImageRegionIterator.h" +#include "itkImageRegionConstIterator.h" + +//-------------------------------------------------------------------- +namespace clitk { + + template + class ITK_EXPORT SUVPeakGenericFilter: + public clitk::ImageToImageGenericFilter > { + + public: + + // Constructor + SUVPeakGenericFilter (); + + // Types + typedef SUVPeakGenericFilter Self; + typedef ImageToImageGenericFilterBase Superclass; + typedef itk::SmartPointer Pointer; + typedef itk::SmartPointer ConstPointer; + + // New + itkNewMacro(Self); + + + + //-------------------------------------------------------------------- + void SetArgsInfo(const args_info_type & a); + + //SUVPeak + template typename ImageType::Pointer ComputeMeanFilterKernel(const typename ImageType::SpacingType & spacing, double radius); + + //-------------------------------------------------------------------- + // Main function called each time the filter is updated + template + void UpdateWithInputImageType(); + + protected: + template void InitializeImageType(); + args_info_type mArgsInfo; + + }; // end class SUVPeakGenericFilter + +} // end namespace +//-------------------------------------------------------------------- + + +#ifndef ITK_MANUAL_INSTANTIATION +#include "clitkSUVPeakGenericFilter.txx" +#endif + +#endif //#define CLITKSUVPEAKGENERICFILTER_H + diff --git a/tools/clitkSUVPeakGenericFilter.txx b/tools/clitkSUVPeakGenericFilter.txx new file mode 100644 index 0000000..893750d --- /dev/null +++ b/tools/clitkSUVPeakGenericFilter.txx @@ -0,0 +1,262 @@ +/*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv + + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://www.centreleonberard.fr + - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the copyright notices for more information. + + It is distributed under dual licence + + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +===========================================================================**/ +#ifndef CLITKSUVPEAKGENERICFILTER_TXX +#define CLITKSUVPEAKGENERICFILTER_TXX + +#include "clitkImageCommon.h" +#include "clitkCropLikeImageFilter.h" +#include "clitkResampleImageWithOptionsFilter.h" + +#include + +namespace clitk +{ + +//-------------------------------------------------------------------- +template +SUVPeakGenericFilter::SUVPeakGenericFilter() + :ImageToImageGenericFilter("SUVPeakGenericFilter") +{ + InitializeImageType<2>(); + InitializeImageType<3>(); + InitializeImageType<4>(); +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +template +template +void SUVPeakGenericFilter::InitializeImageType() +{ + ADD_DEFAULT_IMAGE_TYPES(Dim); +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +template +void SUVPeakGenericFilter::SetArgsInfo(const args_info_type & a) +{ + mArgsInfo=a; + + // Set value + this->SetIOVerbose(mArgsInfo.verbose_flag); + + if (mArgsInfo.input_given) this->AddInputFilename(mArgsInfo.input_arg); + + if (mArgsInfo.mask_given) this->AddInputFilename(mArgsInfo.mask_arg); + } +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +template +template +void SUVPeakGenericFilter::UpdateWithInputImageType() +{ + // Read input + typename ImageType::Pointer input = this->template GetInput(0); + + //Read mask + typedef itk::Image MaskImageType; + typename MaskImageType::Pointer mask; + if(mArgsInfo.mask_given) { + mask = this->template GetInput(1); + // Check mask sampling/size + if (!HaveSameSizeAndSpacing(mask, input)) { + if (mArgsInfo.allow_resize_flag) { + if (mArgsInfo.verbose_flag) { + std::cout << "Resize mask image like input" << std::endl; + } + typedef clitk::ResampleImageWithOptionsFilter ResamplerType; + typename ResamplerType::Pointer resampler = ResamplerType::New(); + resampler->SetInput(mask); //By default the interpolation in NN, Ok for mask + resampler->SetOutputSpacing(input->GetSpacing()); + resampler->SetOutputOrigin(mask->GetOrigin()); + resampler->SetGaussianFilteringEnabled(false); + resampler->Update(); + mask = resampler->GetOutput(); + + typedef clitk::CropLikeImageFilter FilterType; + typename FilterType::Pointer crop = FilterType::New(); + crop->SetInput(mask); + crop->SetCropLikeImage(input); + crop->Update(); + mask = crop->GetOutput(); + + } + else { + std::cerr << "Mask image has a different size/spacing than input. Abort. (Use option --allow_resize)" << std::endl; + exit(-1); + } + } + } + else { + mask = MaskImageType::New(); + mask->SetRegions(input->GetLargestPossibleRegion()); + mask->SetOrigin(input->GetOrigin()); + mask->SetSpacing(input->GetSpacing()); + mask->Allocate(); + mask->FillBuffer(1); + } + + double volume = 1000; //1 cc into mc + if (mArgsInfo.volume_given) + volume *= mArgsInfo.volume_arg; + const double PI = 3.141592653589793238463; + double radius = std::pow(3*volume/(4*PI),1./3); + + typename ImageType::Pointer kernel = ComputeMeanFilterKernel(input->GetSpacing(), radius); + + // Perform the convolution + typedef itk::ConvolutionImageFilter FilterType; + typename FilterType::Pointer filter = FilterType::New(); + filter->SetInput(input); + filter->SetKernelImage(kernel); + filter->Update(); + typename ImageType::Pointer output = filter->GetOutput(); + + + typedef itk::ImageRegionConstIteratorWithIndex IteratorType; + typedef itk::ImageRegionConstIteratorWithIndex MIteratorType; + IteratorType iters(output, output->GetLargestPossibleRegion()); + MIteratorType iterm(mask, mask->GetLargestPossibleRegion()); + iters.GoToBegin(); + iterm.GoToBegin(); + double max = 0.0; + typename ImageType::IndexType index; + while (!iters.IsAtEnd()) { + if (iterm.Get() == 1) { // inside the mask + if (iters.Get() > max) { + max = iters.Get(); + index = iters.GetIndex(); + } + } + ++iters; + ++iterm; + } + typename ImageType::PointType p; + output->TransformIndexToPhysicalPoint(index, p); + std::cout<<"SUV Peak found in "<< p << " mm with the value " << max << std::endl; +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +template +template +typename ImageType::Pointer +SUVPeakGenericFilter::ComputeMeanFilterKernel(const typename ImageType::SpacingType & spacing, double radius) +{ + // Some kind of cache to speed up a bit + static std::map cache; + if (cache.find(radius) != cache.end()) { + return cache.find(radius)->second; + } + + // Compute a kernel that corresponds to a sphere with 1 inside, 0 + // outside and in between proportional to the intersection between + // the pixel and the sphere. Computed by Monte-Carlo because I don't + // know an equation that compute the intersection volume between a + // box and a sphere ... + //auto kernel = ImageType::New(); + typename ImageType::Pointer kernel = ImageType::New(); + + // Size of the kernel in pixel (minimum 3 pixels) + typename ImageType::SizeType size; + size[0] = std::max((int)ceil(radius*2/spacing[0]), 3); + size[1] = std::max((int)ceil(radius*2/spacing[1]), 3); + size[2] = std::max((int)ceil(radius*2/spacing[2]), 3); + + // Compute the region, such as the origin is at the center + typename ImageType::IndexType start; + start.Fill(0); + typename ImageType::RegionType region; + region.SetSize(size); + region.SetIndex(start); + kernel->SetRegions(region); + kernel->SetSpacing(spacing); + typename ImageType::PointType origin; + origin[0] = -(double)size[0]/2.0*spacing[0]+spacing[0]/2.0; + origin[1] = -(double)size[1]/2.0*spacing[1]+spacing[1]/2.0; + origin[2] = -(double)size[2]/2.0*spacing[2]+spacing[2]/2.0; + kernel->SetOrigin(origin); + kernel->Allocate(); + + // Fill the kernel + itk::ImageRegionIteratorWithIndex iter(kernel, region); + typename ImageType::PointType center; + center.Fill(0.0); + typename ImageType::PointType hh; // half a voxel + hh[0] = spacing[0]/2.0; + hh[1] = spacing[1]/2.0; + hh[2] = spacing[2]/2.0; + double h = hh.EuclideanDistanceTo(center); // distance of half a pixel to its center. + std::srand(time(NULL)); + double sum = 0.0; + while (!iter.IsAtEnd()) { + typename ImageType::IndexType index = iter.GetIndex(); + typename ImageType::PointType p; + kernel->TransformIndexToPhysicalPoint(index, p); + double d = p.EuclideanDistanceTo(center) + h; + if (d + +//-------------------------------------------------------------------= +int main(int argc, char * argv[]) +{ + + // init command line + GGO(clitkScintivolStats, args_info); + CLITK_INIT; + + typedef itk::Image Input3DType; + typedef itk::Image Input2DType; + typedef itk::Image Input3DMaskType; + typedef itk::Image Input2DMaskType; + typedef itk::ImageFileReader InputReader3DType; + typedef itk::ImageFileReader InputReader3DMaskType; + typedef itk::ImageFileReader InputReader2DMaskType; + typedef itk::LabelStatisticsImageFilter LabelStatistics3DImageFilterType; + typedef itk::LabelStatisticsImageFilter LabelStatistics2DImageFilterType; + typedef itk::StatisticsImageFilter Statistics2DImageFilterType; + typedef itk::ExtractImageFilter ExtractImageFilter; + + //Determine nbAcquisitionDynamic1 and nbAcquisitionDynamic2 (ie. the number of slice in dynamic1 and dynamic2) + //Start to open the dynamic1 and dynamic2 and get the 3rd dimension size + InputReader3DType::Pointer readerDynamic1 = InputReader3DType::New(); + readerDynamic1->SetFileName(args_info.dynamic1_arg); + readerDynamic1->Update(); + Input3DType::Pointer dynamic1 = readerDynamic1->GetOutput(); + int nbAcquisitionDynamic1 = dynamic1->GetLargestPossibleRegion().GetSize()[2]; + + InputReader3DType::Pointer readerDynamic2 = InputReader3DType::New(); + readerDynamic2->SetFileName(args_info.dynamic2_arg); + readerDynamic2->Update(); + Input3DType::Pointer dynamic2 = readerDynamic2->GetOutput(); + int nbAcquisitionDynamic2 = dynamic2->GetLargestPossibleRegion().GetSize()[2]; + + //Open the csv file + //If it's scatter or attenuation correction, just append results to the csv file + //If not open it normally and write the number of dynamic acquisition for the first and the second images (given by the ggo and from the dicom tag) + std::ofstream csvFile; + if (args_info.append_flag) + csvFile.open (args_info.output_arg, std::ios::app); + else { + csvFile.open (args_info.output_arg); + csvFile << "1;" << nbAcquisitionDynamic1 << ";" << nbAcquisitionDynamic2 << "\n"; + } + + //Read Tomo image, total and remnant masks + InputReader3DType::Pointer readerTomo = InputReader3DType::New(); + readerTomo->SetFileName(args_info.tomo_arg); + readerTomo->Update(); + Input3DType::Pointer tomo = readerTomo->GetOutput(); + + InputReader3DMaskType::Pointer readerTotalLiver = InputReader3DMaskType::New(); + readerTotalLiver->SetFileName(args_info.totalLiverMask_arg); + readerTotalLiver->Update(); + + InputReader3DMaskType::Pointer readerRemnantLiver = InputReader3DMaskType::New(); + readerRemnantLiver->SetFileName(args_info.remnantLiverMask_arg); + readerRemnantLiver->Update(); + + //Find number of counts in tomo for total Liver and remnant Liver + LabelStatistics3DImageFilterType::Pointer labelStatisticsImageFilterTotalLiver = LabelStatistics3DImageFilterType::New(); + labelStatisticsImageFilterTotalLiver->SetLabelInput(readerTotalLiver->GetOutput()); + labelStatisticsImageFilterTotalLiver->SetInput(tomo); + labelStatisticsImageFilterTotalLiver->Update(); + + LabelStatistics3DImageFilterType::Pointer labelStatisticsImageFilterRemnantLiver = LabelStatistics3DImageFilterType::New(); + labelStatisticsImageFilterRemnantLiver->SetLabelInput(readerRemnantLiver->GetOutput()); + labelStatisticsImageFilterRemnantLiver->SetInput(tomo); + labelStatisticsImageFilterRemnantLiver->Update(); + + //Write them in the csv file + csvFile << args_info.acquisitionTimeTomo_arg << ";" << labelStatisticsImageFilterTotalLiver->GetSum(1) << ";" << labelStatisticsImageFilterRemnantLiver->GetSum(1) << "\n"; + + //Read liver and heart masks for dynamic1 + InputReader2DMaskType::Pointer readerLiver = InputReader2DMaskType::New(); + readerLiver->SetFileName(args_info.liverMask_arg); + readerLiver->Update(); + + InputReader2DMaskType::Pointer readerHeart = InputReader2DMaskType::New(); + readerHeart->SetFileName(args_info.heartMask_arg); + readerHeart->Update(); + + for (unsigned int i=0; iGetLargestPossibleRegion().GetSize()[0]; + size[1] = dynamic1->GetLargestPossibleRegion().GetSize()[1]; + size[2] = 0; + Input3DType::RegionType desiredRegion; + desiredRegion.SetSize(size); + desiredRegion.SetIndex(start); + extractSlice->SetExtractionRegion(desiredRegion); + extractSlice->SetInput(dynamic1); +#if ITK_VERSION_MAJOR >= 4 + extractSlice->SetDirectionCollapseToIdentity(); +#endif + extractSlice->Update(); + + //Find number of counts in dynamic1 slice for Liver and heart + LabelStatistics2DImageFilterType::Pointer labelStatisticsImageFilterLiver = LabelStatistics2DImageFilterType::New(); + labelStatisticsImageFilterLiver->SetLabelInput(readerLiver->GetOutput()); + labelStatisticsImageFilterLiver->SetInput(extractSlice->GetOutput()); + labelStatisticsImageFilterLiver->SetCoordinateTolerance(0.001); + labelStatisticsImageFilterLiver->SetDirectionTolerance(0.001); + labelStatisticsImageFilterLiver->Update(); + + LabelStatistics2DImageFilterType::Pointer labelStatisticsImageFilterHeart = LabelStatistics2DImageFilterType::New(); + labelStatisticsImageFilterHeart->SetLabelInput(readerHeart->GetOutput()); + labelStatisticsImageFilterHeart->SetInput(extractSlice->GetOutput()); + labelStatisticsImageFilterHeart->SetCoordinateTolerance(0.001); + labelStatisticsImageFilterHeart->SetDirectionTolerance(0.001); + labelStatisticsImageFilterHeart->Update(); + + //Find number of counts in dynamic1 slice + Statistics2DImageFilterType::Pointer statisticsImageFilterDynamic1 = Statistics2DImageFilterType::New(); + statisticsImageFilterDynamic1->SetInput(extractSlice->GetOutput()); + statisticsImageFilterDynamic1->Update(); + + //Write them in the csv file + csvFile << timeFrame << ";" << labelStatisticsImageFilterLiver->GetSum(1) << ";" << labelStatisticsImageFilterHeart->GetSum(1) << ";" << statisticsImageFilterDynamic1->GetSum() << "\n"; + } + + //Read parenchyma mask for dynamic2 + InputReader2DMaskType::Pointer readerParenchyma = InputReader2DMaskType::New(); + readerParenchyma->SetFileName(args_info.parenchymaMask_arg); + readerParenchyma->Update(); + + for (unsigned int i=0; iGetLargestPossibleRegion().GetSize()[0]; + size[1] = dynamic2->GetLargestPossibleRegion().GetSize()[1]; + size[2] = 0; + Input3DType::RegionType desiredRegion; + desiredRegion.SetSize(size); + desiredRegion.SetIndex(start); + extractSlice->SetExtractionRegion(desiredRegion); + extractSlice->SetInput(dynamic2); +#if ITK_VERSION_MAJOR >= 4 + extractSlice->SetDirectionCollapseToIdentity(); +#endif + extractSlice->Update(); + + //Find number of counts in dynamic2 slice for parenchyma + LabelStatistics2DImageFilterType::Pointer labelStatisticsImageFilterParenchyma = LabelStatistics2DImageFilterType::New(); + labelStatisticsImageFilterParenchyma->SetLabelInput(readerParenchyma->GetOutput()); + labelStatisticsImageFilterParenchyma->SetInput(extractSlice->GetOutput()); + labelStatisticsImageFilterParenchyma->SetCoordinateTolerance(0.001); + labelStatisticsImageFilterParenchyma->SetDirectionTolerance(0.001); + labelStatisticsImageFilterParenchyma->Update(); + + //Write them in the csv file + csvFile << timeFrame << ";" << labelStatisticsImageFilterParenchyma->GetSum(1) << "\n"; + } + + csvFile.close(); + + // this is the end my friend + return 0; +} +//-------------------------------------------------------------------= + +#endif /* end #define CLITKSCINTIVOLSTATS_CXX */ diff --git a/tools/clitkScintivolStats.ggo b/tools/clitkScintivolStats.ggo new file mode 100644 index 0000000..e99d9ab --- /dev/null +++ b/tools/clitkScintivolStats.ggo @@ -0,0 +1,23 @@ +# file clitkScintivolStats.ggo +package "clitkScintivolStats" +version "1.0" +purpose "Convert an image into another image.\n\tAllow to change the file format and/or the pixel type. \n\tKnown file formats 2D: jpeg png bmp tif mhd hdr vox dcm \n\tKnown file formats 3D: mhd vox hdr dcm\n\tKnown file formats 4D: mhd \n\tKnown images: 2D 3D or 4D, schar, uchar, short, ushort, int, float and double\n\nIf the -o option is not given, the last parameter of the command line is used as output." + +option "config" - "Config file" string no +option "output" o "Output .csv filename" string yes +option "append" - "Append results to .csv file (eg: for scatter)" flag off + +option "dynamic1" - "Dynamique 1 filename (geometrical mean)" string yes +option "frameDurationDynamic1" - "Frame duration for dynamique 1" double yes +option "heartMask" - "Heart mask filename" string yes +option "liverMask" - "Liver mask filename" string yes + +option "dynamic2" - "Dynamique 2 filename (geometrical mean)" string yes +option "frameDurationDynamic2" - "Frame duration for dynamique 2" double yes +option "acquisitionTimeDynamic2" - "Start acquisition time of the dynamic2 after dynamic1" double yes +option "parenchymaMask" - "Parenchyma mask filename" string yes + +option "tomo" - "Tomo image filename" string yes +option "acquisitionTimeTomo" - "Acquisition time for tomo" double yes +option "totalLiverMask" - "Total liver mask filename" string yes +option "remnantLiverMask" - "Remnant liver mask filename" string yes diff --git a/travis/travis_build_itk.sh b/travis/travis_build_itk.sh index ed6f89e..e5b55dd 100755 --- a/travis/travis_build_itk.sh +++ b/travis/travis_build_itk.sh @@ -4,27 +4,11 @@ MAKE="make --jobs=$NUM_THREADS --keep-going" #Prepare cmake arguments following the ITK version if [ "$C11" == "true" ]; then - if [ "$ITK_VERSION" == "4.6" ]; then - itk_repo_str=" --branch v4.6.0 https://github.com/InsightSoftwareConsortium/ITK.git --depth 1" - cmake_arg_str=" -DCMAKE_CXX_FLAGS=-std=c++11 -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF " - elif [ "$ITK_VERSION" == "4.9.1" ]; then - itk_repo_str=" --branch v4.9.1 https://github.com/InsightSoftwareConsortium/ITK.git --depth 1" - cmake_arg_str=" -DCMAKE_CXX_FLAGS=-std=c++11 -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF " - elif [ "$ITK_VERSION" == "4.13.0" ]; then - itk_repo_str=" --branch v4.13.0 https://github.com/InsightSoftwareConsortium/ITK.git --depth 1" - cmake_arg_str=" -DCMAKE_CXX_FLAGS=-std=c++11 -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF " - fi + itk_repo_str=" --branch "$ITK_VERSION" https://github.com/InsightSoftwareConsortium/ITK.git --depth 1" + cmake_arg_str=" -DCMAKE_CXX_FLAGS=-std=c++11 -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF " else - if [ "$ITK_VERSION" == "4.6" ]; then - itk_repo_str=" --branch v4.6.0 https://github.com/InsightSoftwareConsortium/ITK.git --depth 1" - cmake_arg_str=" -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF " - elif [ "$ITK_VERSION" == "4.9.1" ]; then - itk_repo_str=" --branch v4.9.1 https://github.com/InsightSoftwareConsortium/ITK.git --depth 1" - cmake_arg_str=" -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF " - elif [ "$ITK_VERSION" == "4.13.0" ]; then - itk_repo_str=" --branch v4.13.0 https://github.com/InsightSoftwareConsortium/ITK.git --depth 1" - cmake_arg_str=" -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF " - fi + itk_repo_str=" --branch "$ITK_VERSION" https://github.com/InsightSoftwareConsortium/ITK.git --depth 1" + cmake_arg_str=" -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF " fi if [ -d $ITK_SOURCE_DIR ]; then diff --git a/travis/travis_build_qt.sh b/travis/travis_build_qt.sh index 7fffb00..12e137b 100755 --- a/travis/travis_build_qt.sh +++ b/travis/travis_build_qt.sh @@ -7,7 +7,7 @@ if [ "$QT_VERSION" == "4.8.7" ]; then elif [ "$QT_VERSION" == "5.5.1" ]; then if test $TRAVIS_OS_NAME == linux ; then sudo add-apt-repository --yes ppa:beineri/opt-qt551-trusty; fi if test $TRAVIS_OS_NAME == linux ; then sudo apt-get update -qq; fi - if test $TRAVIS_OS_NAME == linux ; then sudo apt-get -y --force-yes install qt55tools; fi + if test $TRAVIS_OS_NAME == linux ; then sudo apt-get -y --force-yes install qt55tools qt55x11extras; fi fi if test $TRAVIS_OS_NAME == osx ; then brew install qt5; fi if test $TRAVIS_OS_NAME == osx ; then brew link qt5 --force; fi diff --git a/travis/travis_build_vtk.sh b/travis/travis_build_vtk.sh index f4dbf32..9d36bdb 100755 --- a/travis/travis_build_vtk.sh +++ b/travis/travis_build_vtk.sh @@ -10,8 +10,8 @@ fi #Prepare cmake arguments following the VTK version if [ "$C11" == "true" ]; then - if [ "$VTK_VERSION" == "5.10" ]; then - vtk_repo_str=" --branch v5.10.0 https://github.com/Kitware/VTK.git --depth 1" + vtk_repo_str=" --branch "$VTK_VERSION" https://github.com/Kitware/VTK.git --depth 1" + if [ "$VTK_VERSION" == "v5.10.0" ]; then cmake_arg_str=" $cmake_arg_str -DCMAKE_CXX_FLAGS=-std=c++11 -DBUILD_SHARED_LIBS=1 @@ -23,8 +23,7 @@ if [ "$C11" == "true" ]; then -DVTK_USE_RENDERING=ON -DVTK_USE_VIEWS=ON -DVTK_QT_VERSION="$QT_MAJOR_VERSION" " - elif [ "$VTK_VERSION" == "6.3" ]; then - vtk_repo_str=" --branch v6.3.0 https://github.com/Kitware/VTK.git --depth 1" + elif [ "$VTK_VERSION" == "v6.3.0" ] || [ "$VTK_VERSION" == "v8.1.1" ]; then cmake_arg_str=" $cmake_arg_str -DCMAKE_CXX_FLAGS=-std=c++11 -DBUILD_SHARED_LIBS=1 @@ -45,8 +44,7 @@ if [ "$C11" == "true" ]; then -DModule_vtkRenderingQt=ON -DModule_vtkViewsQt=ON -DVTK_QT_VERSION="$QT_MAJOR_VERSION" " - elif [ "$VTK_VERSION" == "7.0.0" ]; then - vtk_repo_str=" --branch v7.0.0 https://github.com/Kitware/VTK.git --depth 1" + elif [ "$VTK_VERSION" == "v7.0.0" ]; then cmake_arg_str=" $cmake_arg_str -DCMAKE_CXX_FLAGS=-std=c++11 -DBUILD_SHARED_LIBS=1 @@ -70,8 +68,8 @@ if [ "$C11" == "true" ]; then -DVTK_QT_VERSION="$QT_MAJOR_VERSION" " fi else - if [ "$VTK_VERSION" == "5.10" ]; then - vtk_repo_str=" --branch v5.10.0 https://github.com/Kitware/VTK.git --depth 1" + vtk_repo_str=" --branch "$VTK_VERSION" https://github.com/Kitware/VTK.git --depth 1" + if [ "$VTK_VERSION" == "v5.10.0" ]; then cmake_arg_str=" $cmake_arg_str -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release @@ -82,8 +80,7 @@ else -DVTK_USE_RENDERING=ON -DVTK_USE_VIEWS=ON -DVTK_QT_VERSION="$QT_MAJOR_VERSION" " - elif [ "$VTK_VERSION" == "6.3" ]; then - vtk_repo_str=" --branch v6.3.0 https://github.com/Kitware/VTK.git --depth 1" + elif [ "$VTK_VERSION" == "v6.3.0" ] || [ "$VTK_VERSION" == "v8.1.1" ]; then cmake_arg_str=" $cmake_arg_str -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release @@ -103,8 +100,7 @@ else -DModule_vtkRenderingQt=ON -DModule_vtkViewsQt=ON -DVTK_QT_VERSION="$QT_MAJOR_VERSION" " - elif [ "$VTK_VERSION" == "7.0.0" ]; then - vtk_repo_str=" --branch v7.0.0 https://github.com/Kitware/VTK.git --depth 1" + elif [ "$VTK_VERSION" == "v7.0.0" ]; then cmake_arg_str=" $cmake_arg_str -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release diff --git a/vv/CMakeLists.txt b/vv/CMakeLists.txt index fe6120e..9453e1b 100644 --- a/vv/CMakeLists.txt +++ b/vv/CMakeLists.txt @@ -26,8 +26,6 @@ set(vv_TOOLS vvToolConvert ## with dummy vvToolConvert.ui vvToolROIManager vvToolSegmentation - vvToolProfile - vvToolHistogram ## these ones are for tests (not working) # vvToolTest # vvToolFoo @@ -39,6 +37,12 @@ set(vv_TOOLS # vvToolExtractLung # vvToolStructureSetManager ) +#List of vv tools to compile +#Ensure compatibility with QVTKOpenGL for VTK < v8.1 and QVTKOpenGLNativeWidget for others +set(vv_TOOLS_VTK7 + vvToolProfile + vvToolHistogram +) # dependencies of the tools # Future issues : when tool depend on other tools ... how to manage that ? # >> add the relevant $_LIBS variable to the tool that has dependencies? @@ -65,8 +69,6 @@ set(vv_COMMON_WITH_UI vvOverlayPanel vvLandmarksPanel vvProgressDialog - vvSegmentationDialog - vvSurfaceViewerDialog vvDeformationDialog vvStructSelector vvIntensityValueSlider @@ -76,6 +78,13 @@ set(vv_COMMON_WITH_UI vvToolInputSelectorWidget vvRegisterForm ) +# in COMMON_WITH_UI -> must have .h and .cxx and VTK7.ui +#Ensure compatibility with QVTKOpenGL for VTK < v8.1 and QVTKOpenGLNativeWidget for others +set(vv_COMMON_WITH_UI_VTK7 + vvMainWindow + vvSegmentationDialog + vvSurfaceViewerDialog +) # All others sources set(vv_SRCS @@ -208,7 +217,7 @@ endif(CLITK_USE_PACS_CONNECTION) # variables in vv.cxx for the tools contained in vvLib if(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h) file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h) - foreach(tool ${vv_TOOLS}) + foreach(tool ${vv_TOOLS} ${vv_TOOLS_VTK7}) file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "#include \"${tool}.h\"\n") file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "extern const vvToolCreator<${tool}> *dummy${tool};\n") file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "const vvToolCreator<${tool}> *dummy${tool}2 = dummy${tool};\n\n") @@ -226,6 +235,28 @@ endif(CLITK_USE_PACS_CONNECTION) QT4_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui) endif() endforeach(tool) + + #Special case for Main Window with QVTKWidget according VTK version + foreach(tool ${vv_TOOLS_VTK7} ${vv_COMMON_WITH_UI_VTK7}) + set(vv_SRCS ${vv_SRCS} ${tool}.cxx) + if(VTK_VERSION VERSION_GREATER "8.0.0") + if(vv_QT_VERSION VERSION_GREATER "4") + QT5_WRAP_CPP(vv_SRCS ${tool}.h) + QT5_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui) + else() + QT4_WRAP_CPP(vv_SRCS ${tool}.h) + QT4_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui) + endif() + else() + if(vv_QT_VERSION VERSION_GREATER "4") + QT5_WRAP_CPP(vv_SRCS ${tool}.h) + QT5_WRAP_UI(vv_UI_CXX qt_ui/${tool}VTK7.ui) + else() + QT4_WRAP_CPP(vv_SRCS ${tool}.h) + QT4_WRAP_UI(vv_UI_CXX qt_ui/${tool}VTK7.ui) + endif() + endif() + endforeach(tool) # Add the common source files foreach(tool ${vv_COMMON}) @@ -301,7 +332,7 @@ include_directories( #========================================================= #Add each tool's dependencies -foreach(tool ${vv_TOOLS}) +foreach(tool ${vv_TOOLS} ${vv_TOOLS_VTK7}) set(toolLibs ${toolLibs} ${${tool}_LIBS}) endforeach(tool) diff --git a/vv/qt_ui/vvMainWindow.ui b/vv/qt_ui/vvMainWindow.ui index fa205e0..09050ba 100644 --- a/vv/qt_ui/vvMainWindow.ui +++ b/vv/qt_ui/vvMainWindow.ui @@ -651,7 +651,7 @@ 2 - + true @@ -691,7 +691,7 @@ 2 - + true @@ -733,7 +733,7 @@ 2 - + true @@ -770,7 +770,7 @@ 2 - + 0 @@ -1285,9 +1285,9 @@ - QVTKWidget + QVTKOpenGLNativeWidget QWidget -
QVTKWidget.h
+
QVTKOpenGLNativeWidget.h
vvInfoPanel diff --git a/vv/qt_ui/vvMainWindowVTK7.ui b/vv/qt_ui/vvMainWindowVTK7.ui new file mode 100644 index 0000000..fa205e0 --- /dev/null +++ b/vv/qt_ui/vvMainWindowVTK7.ui @@ -0,0 +1,1332 @@ + + + vvMainWindow + + + true + + + + 0 + 0 + 1008 + 758 + + + + + 0 + 0 + + + + vv : the 4D Slicer + + + + :/common/icons/ducky.png:/common/icons/ducky.png + + + Type 'F1' on image to display help on navigation + + + + + 0 + 0 + + + + Type 'F1' on image to display help on navigation + + + + + + + 0 + 0 + + + + + 16 + 36 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 2 + + + 2 + + + + + + 0 + 0 + + + + + 24 + 24 + + + + Go to cursor + + + + + + + :/common/icons/cross.png:/common/icons/cross.png + + + + + + + QFrame::Sunken + + + Qt::Vertical + + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + Play Current Image + + + + + + + :/common/icons/player_play.png:/common/icons/player_play.png + + + + + + + Qt::Vertical + + + + + + + Window : + + + + + + + 6 + + + -66000.000000000000000 + + + 66000.000000000000000 + + + 10.000000000000000 + + + + + + + + 0 + 0 + + + + + 24 + 16777215 + + + + Inverse colors + + + + + + + :/common/icons/invertcolor.png:/common/icons/invertcolor.png + + + + + + + Level : + + + + + + + 6 + + + -66000.000000000000000 + + + 66000.000000000000000 + + + 10.000000000000000 + + + + + + + Preset : + + + + + + + + 0 + 0 + + + + + 100 + 16777215 + + + + + Auto Scale + + + + + Hounsfield Full Scale + + + + + Soft Tissue + + + + + Lungs + + + + + Bones + + + + + Head/Brain + + + + + [0,1] Scale + + + + + User Scale + + + + + Ventilation Image + + + + + + + + Colormap : + + + + + + + + B&W + + + + + Heat + + + + + Cold + + + + + Dosimetry + + + + + Full Color + + + + + Segmentation + + + + + Ventilation + + + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + Expand window + + + + + + + :/common/icons/adjustsize.png:/common/icons/adjustsize.png + + + + + + + 1 + + + 100 + + + 10 + + + + + + + Speed : + + + + + + + true + + + + 24 + 16777215 + + + + Apply windowing to all images + + + All + + + + + + + + World + + + + + Voxels + + + + + + + + Slice to + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Horizontal + + + + Qt::Vertical + + + + + 0 + 1 + + + + 0 + + + + Images + + + + 2 + + + 2 + + + + + + 0 + 0 + + + + Qt::ScrollBarAsNeeded + + + false + + + Qt::ElideLeft + + + true + + + 7 + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + Data + + + + + 6 + + + + + 8 + + + + + + + + + + 0 + 0 + + + + Overlay + + + + 2 + + + 2 + + + + + + 0 + 0 + + + + + + + + + ROI + + + + + + + 0 + 0 + + + + Link + + + + 2 + + + 2 + + + + + + 0 + 0 + + + + + + + + + + 0 + 0 + + + + Landmarks + + + + 2 + + + 2 + + + + + + 0 + 0 + + + + + + + + + + true + + + + 0 + 0 + + + + + + + + 1 + 0 + + + + Qt::Horizontal + + + + Qt::Vertical + + + + + 0 + 0 + + + + + 2 + + + 2 + + + + + true + + + + + + + Qt::Vertical + + + + + + + Qt::Horizontal + + + + + + + + + 0 + 0 + + + + Qt::NoFocus + + + + 2 + + + 2 + + + + + true + + + + + + + Qt::Vertical + + + + + + + Qt::Horizontal + + + + + + + + + Qt::Vertical + + + + + 0 + 0 + + + + + 2 + + + 2 + + + + + true + + + + + + + Qt::Vertical + + + + + + + Qt::Horizontal + + + + + + + + + 0 + 0 + + + + + 2 + + + 2 + + + + + + 0 + 0 + + + + true + + + + + + + Qt::Vertical + + + + + + + Qt::Horizontal + + + + + + + + + + + + + + + 0 + 0 + 1008 + 27 + + + + false + + + + Help + + + + + + + + Overlay + + + + + + + + + Screenshots + + + + + + + + + + + Experimental + + + + + + + + + + Tools + + + + + File + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + :/common/icons/fileopen.png:/common/icons/fileopen.png + + + Open image(s) + + + Ctrl+O + + + true + + + + + Close images + + + + + + :/common/icons/exit.png:/common/icons/exit.png + + + Exit + + + true + + + + + Save screenshot + + + + + pickable + + + + + dragable + + + + + Set colormap + + + + + IsoContours + + + + + About QtVTKRender2D + + + + + About + + + true + + + + + Reload images + + + + + + :/common/icons/open.png:/common/icons/open.png + + + Open Dicom + + + true + + + + + + :/common/icons/open.png:/common/icons/open.png + + + Merge several nD images into a single (n+1)D image + + + true + + + + + + :/common/icons/open.png:/common/icons/open.png + + + Slice a nD image into several (n-1)D images + + + true + + + + + Open One Image As Multiple + + + + + + :/common/icons/filesave.png:/common/icons/filesave.png + + + Save current image + + + Ctrl+S + + + true + + + + + + :/common/icons/cursor-uparrow.png:/common/icons/cursor-uparrow.png + + + Add deformation field to current image + + + true + + + + + + :/common/icons/NOgrid.png:/common/icons/NOgrid.png + + + Save image in TL + + + true + + + + + + :/common/icons/NEgrid.png:/common/icons/NEgrid.png + + + Save image in TR + + + true + + + + + + :/common/icons/SOgrid.png:/common/icons/SOgrid.png + + + Save image in BL + + + true + + + + + + :/common/icons/SEgrid.png:/common/icons/SEgrid.png + + + Save image in BR + + + true + + + + + + :/common/icons/open.png:/common/icons/open.png + + + Open a nD image as a (n-1)D + t image + + + true + + + + + + :/common/icons/open.png:/common/icons/open.png + + + Open several nD images into a single nD+t image + + + true + + + + + + :/common/icons/fusion.png:/common/icons/fusion.png + + + Add fusion image to current image + + + true + + + + + Segmentation + + + true + + + + + Resample + + + + + Surface Viewer + + + true + + + + + joelDebug + + + + + Deformable Registration + + + true + + + + + Verify Registration + + + true + + + + + Maximum Intensity Projection + + + + + + :/common/icons/open.png:/common/icons/open.png + + + Open VTK or OBJ contour + + + true + + + + + Navigation Help + + + true + + + QAction::NormalPriority + + + + + + :/common/icons/open.png:/common/icons/open.png + + + Open Dicom-Struct + + + true + + + + + Compute mid-position image + + + true + + + + + Experimental... + + + + + Register vv + + + true + + + + + Save all slices (Top-Left view) + + + + + + :/common/icons/filesave.png:/common/icons/filesave.png + + + Save current state + + + Save current window and file states + + + true + + + + + + :/common/icons/open.png:/common/icons/open.png + + + Read Saved State + + + true + + + + + + :/common/icons/GPSup.png:/common/icons/GPSup.png + + + Add overlay image to current image + + + true + + + + + + :/common/icons/rotateright.png:/common/icons/rotateright.png + + + Test / Fusion of US & CT sequences + + + true + + + + + Connect Pacs + + + + + + QVTKWidget + QWidget +
QVTKWidget.h
+
+ + vvInfoPanel + QWidget +
vvInfoPanel.h
+
+ + vvLandmarksPanel + QWidget +
vvLandmarksPanel.h
+
+ + vvLinkPanel + QWidget +
vvLinkPanel.h
+
+ + vvOverlayPanel + QWidget +
vvOverlayPanel.h
+
+
+ + presetComboBox + windowSpinBox + levelSpinBox + NOViewWidget + NOVerticalSlider + NOHorizontalSlider + SOVerticalSlider + SOHorizontalSlider + NEVerticalSlider + NEHorizontalSlider + SEVerticalSlider + SEHorizontalSlider + viewButton + + + + + +
diff --git a/vv/qt_ui/vvSegmentationDialog.ui b/vv/qt_ui/vvSegmentationDialog.ui index 4767625..d7e9309 100644 --- a/vv/qt_ui/vvSegmentationDialog.ui +++ b/vv/qt_ui/vvSegmentationDialog.ui @@ -28,7 +28,7 @@
- + @@ -132,9 +132,9 @@ - QVTKWidget + QVTKOpenGLNativeWidget QWidget -
QVTKWidget.h
+
QVTKOpenGLNativeWidget.h
diff --git a/vv/qt_ui/vvSegmentationDialogVTK7.ui b/vv/qt_ui/vvSegmentationDialogVTK7.ui new file mode 100644 index 0000000..4767625 --- /dev/null +++ b/vv/qt_ui/vvSegmentationDialogVTK7.ui @@ -0,0 +1,159 @@ + + vvSegmentationDialog + + + + 0 + 0 + 561 + 453 + + + + Segmentation tool + + + + + + Qt::Vertical + + + + + + + Qt::Vertical + + + + + + + + + + + 0 + 0 + + + + Min : + + + + + + + Max : + + + + + + + + 0 + 0 + + + + Binarise + + + + + + + Erode + + + + + + + Dilate + + + + + + + Kernel Size : + + + + + + + 1 + + + 2 + + + + + + + + 0 + 0 + + + + 3D + + + + + + + Save As + + + + + + + Close + + + + + + + TextLabel + + + + + + + + QVTKWidget + QWidget +
QVTKWidget.h
+
+
+ + + + closeButton + clicked() + vvSegmentationDialog + reject() + + + 528 + 403 + + + 542 + 423 + + + + +
diff --git a/vv/qt_ui/vvSurfaceViewerDialog.ui b/vv/qt_ui/vvSurfaceViewerDialog.ui index 6683830..a87d8ff 100644 --- a/vv/qt_ui/vvSurfaceViewerDialog.ui +++ b/vv/qt_ui/vvSurfaceViewerDialog.ui @@ -14,7 +14,7 @@ - + @@ -47,9 +47,9 @@
- QVTKWidget + QVTKOpenGLNativeWidget QWidget -
QVTKWidget.h
+
QVTKOpenGLNativeWidget.h
diff --git a/vv/qt_ui/vvSurfaceViewerDialogVTK7.ui b/vv/qt_ui/vvSurfaceViewerDialogVTK7.ui new file mode 100644 index 0000000..6683830 --- /dev/null +++ b/vv/qt_ui/vvSurfaceViewerDialogVTK7.ui @@ -0,0 +1,74 @@ + + vvSurfaceViewerDialog + + + + 0 + 0 + 554 + 472 + + + + Dialog + + + + + + + + + Qt::Horizontal + + + + 311 + 20 + + + + + + + + Load + + + + + + + Close + + + + + + + + QVTKWidget + QWidget +
QVTKWidget.h
+
+
+ + + + closeButton + clicked() + vvSurfaceViewerDialog + reject() + + + 492 + 436 + + + 443 + 435 + + + + +
diff --git a/vv/qt_ui/vvToolHistogram.ui b/vv/qt_ui/vvToolHistogram.ui index 01851e0..7cc94e9 100644 --- a/vv/qt_ui/vvToolHistogram.ui +++ b/vv/qt_ui/vvToolHistogram.ui @@ -78,7 +78,7 @@
- + 0 @@ -96,9 +96,9 @@ - QVTKWidget + QVTKOpenGLNativeWidget QWidget -
QVTKWidget.h
+
QVTKOpenGLNativeWidget.h
diff --git a/vv/qt_ui/vvToolHistogramVTK7.ui b/vv/qt_ui/vvToolHistogramVTK7.ui new file mode 100644 index 0000000..01851e0 --- /dev/null +++ b/vv/qt_ui/vvToolHistogramVTK7.ui @@ -0,0 +1,106 @@ + + + vvToolHistogram + + + + 0 + 0 + 506 + 452 + + + + Histogram image + + + + + + + + 6 + + + + + + + + 0 + 0 + + + + Save Histogram + + + + + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + + + + + 0 + 300 + + + + true + + + + + + + + + + QVTKWidget + QWidget +
QVTKWidget.h
+
+
+ + +
diff --git a/vv/qt_ui/vvToolProfile.ui b/vv/qt_ui/vvToolProfile.ui index bc3c9c8..fb0b5ad 100644 --- a/vv/qt_ui/vvToolProfile.ui +++ b/vv/qt_ui/vvToolProfile.ui @@ -141,7 +141,7 @@
- + 0 @@ -159,9 +159,9 @@ - QVTKWidget + QVTKOpenGLNativeWidget QWidget -
QVTKWidget.h
+
QVTKOpenGLNativeWidget.h
diff --git a/vv/qt_ui/vvToolProfileVTK7.ui b/vv/qt_ui/vvToolProfileVTK7.ui new file mode 100644 index 0000000..bc3c9c8 --- /dev/null +++ b/vv/qt_ui/vvToolProfileVTK7.ui @@ -0,0 +1,169 @@ + + + vvToolProfile + + + + 0 + 0 + 505 + 452 + + + + Profile image + + + + + + + + 6 + + + + + + + Select point 2 + + + + + + + Center of voxel2 (vox): + + + + + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + + + + + + + + + + + + Cancel + + + + + + + + 0 + 0 + + + + Save Profile + + + + + + + + + + + Select point 1 + + + + + + + Center of voxel1 (vox): + + + + + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + + + + + 0 + 300 + + + + true + + + + + + + + + + QVTKWidget + QWidget +
QVTKWidget.h
+
+
+ + +
diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index e88a5d9..1bf5469 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -18,6 +18,7 @@ It is distributed under dual licence #include #include +#include #include #include #include "QTreePushButton.h" @@ -132,6 +133,8 @@ vvMainWindow::vvMainWindow():vvMainWindowBase() { setupUi(this); // this sets up the GUI + setAcceptDrops(true); // enable to drop into the window + setDicomClient(); //Qt::WindowFlags flags = windowFlags(); @@ -816,6 +819,25 @@ void vvMainWindow::OpenRecentImage() LoadImages(images, vvImageReader::IMAGE); } //------------------------------------------------------------------------------ +void vvMainWindow::dragEnterEvent(QDragEnterEvent *event) +{ + if (event->mimeData()->hasUrls()) { + event->acceptProposedAction(); + } +} +//------------------------------------------------------------------------------ +void vvMainWindow::dropEvent(QDropEvent *event) +{ + const QMimeData * mimeData = event->mimeData(); + if (!mimeData->hasUrls()) + return; + std::vector images; + for (int i=0; iurls().size(); ++i) { + images.push_back(mimeData->urls()[i].toLocalFile().toStdString()); + } + LoadImages(images, vvImageReader::IMAGE); +} +//------------------------------------------------------------------------------ //------------------------------------------------------------------------------ @@ -3278,7 +3300,11 @@ void vvMainWindow::SaveSEScreenshot() //------------------------------------------------------------------------------ void vvMainWindow::SaveScreenshotAllSlices() { +#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9 + QVTKOpenGLNativeWidget *widget = NOViewWidget; +#else QVTKWidget *widget = NOViewWidget; +#endif int index = 0;// GetSlicerIndexFromItem(DataTree->selectedItems()[0]); vvSlicerManager * SM = mSlicerManagers[index]; @@ -3304,7 +3330,7 @@ void vvMainWindow::SaveScreenshotAllSlices() // Screenshot vtkSmartPointer windowToImageFilter = vtkSmartPointer::New(); windowToImageFilter->SetInput(renderWindow); -#if VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 1 +#if (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9 windowToImageFilter->SetScale(1); #else windowToImageFilter->SetMagnification(1); @@ -3334,7 +3360,11 @@ void vvMainWindow::SaveScreenshotAllSlices() //------------------------------------------------------------------------------ +#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9 +void vvMainWindow::SaveScreenshot(QVTKOpenGLNativeWidget *widget) +#else void vvMainWindow::SaveScreenshot(QVTKWidget *widget) +#endif { QString Extensions = "Images( *.png);;"; Extensions += "Images( *.jpg);;"; @@ -3358,7 +3388,7 @@ void vvMainWindow::SaveScreenshot(QVTKWidget *widget) if (!fileName.isEmpty()) { vtkSmartPointer w2i = vtkSmartPointer::New(); w2i->SetInput(widget->GetRenderWindow()); -#if VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 1 +#if (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9 w2i->SetScale(1); #else w2i->SetMagnification(1); diff --git a/vv/vvMainWindow.h b/vv/vvMainWindow.h index 8908b24..07f38e5 100644 --- a/vv/vvMainWindow.h +++ b/vv/vvMainWindow.h @@ -21,7 +21,13 @@ #include #include +#include +#include "vtkVersion.h" +#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9 #include "ui_vvMainWindow.h" +#else +#include "ui_vvMainWindowVTK7.h" +#endif #include "vvMainWindowBase.h" #include "vvToolManager.h" #include "vvImageReader.h" @@ -192,6 +198,10 @@ protected: void createRecentlyOpenedFilesMenu(); void updateRecentlyOpenedFilesMenu(const std::list &files); + // Drag and drop event handlers + virtual void dragEnterEvent(QDragEnterEvent *event); + virtual void dropEvent(QDropEvent *event); + private: //variables @@ -222,7 +232,11 @@ private: QString GetVectorIntAsString(std::vector vectorInt); int GetSlicerIndexFromItem(QTreeWidgetItem* item); //this actually returns the SlicerManager index TODO: rename it to GetSlicerManagerIndexFromItem QTreeWidgetItem* GetItemFromSlicerManager(vvSlicerManager* sm); +#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9 + void SaveScreenshot(QVTKOpenGLNativeWidget *widget); +#else void SaveScreenshot(QVTKWidget *widget); +#endif int GetImageDuplicateFilenameNumber(std::string filename); QMenu contextMenu; diff --git a/vv/vvMeshReader.cxx b/vv/vvMeshReader.cxx index 0feabf3..b041638 100644 --- a/vv/vvMeshReader.cxx +++ b/vv/vvMeshReader.cxx @@ -24,7 +24,7 @@ // gdcm #include -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 #include #include #include @@ -125,7 +125,7 @@ std::vector > vvMeshReader::GetROINames() } #else -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 // duplicate code from clitk::DicomRT_StructureSet::Read gdcm::Reader * reader = new gdcm::Reader; @@ -223,7 +223,7 @@ std::vector > vvMeshReader::GetROINames() std::vector vvMeshReader::readSelectedContours() { std::vector result; -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::Reader reader; reader.SetFileName(filename.c_str()); reader.Read(); diff --git a/vv/vvOverlayPanel.cxx b/vv/vvOverlayPanel.cxx index 2a77e8d..165104f 100644 --- a/vv/vvOverlayPanel.cxx +++ b/vv/vvOverlayPanel.cxx @@ -250,7 +250,7 @@ void vvOverlayPanel::getCurrentFusionInfo(int visibility,double value) { QString fusionValue = "Pixel value in image 2 : "; if (visibility) { - fusionValue += QString::number(value,'f',1); + fusionValue += QString::number(value,'g',3); } valueFusionnedLabel->setText(fusionValue); } diff --git a/vv/vvQDicomSeriesSelector.cxx b/vv/vvQDicomSeriesSelector.cxx index 9c27982..d5444cd 100644 --- a/vv/vvQDicomSeriesSelector.cxx +++ b/vv/vvQDicomSeriesSelector.cxx @@ -20,7 +20,7 @@ #include #include #include -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 #include #include #include @@ -144,7 +144,7 @@ void vvDicomSeriesSelector::SearchButtonRelease() mListOfSeriesFilenames[seriesUID[i]] = filenames; // store first header -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 mDicomHeader[seriesUID[i]].SetFileName( (*filenames)[0].c_str() ); mDicomHeader[seriesUID[i]].Read(); #else @@ -235,7 +235,7 @@ void vvDicomSeriesSelector::itemDetailsSelectionChanged() std::ostringstream s; QString l; -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 mDicomHeader[mCurrentSerie].GetFile().Print(s); const gdcm::File& header = mDicomHeader[mCurrentSerie].GetFile(); gdcm::StringFilter sf; @@ -284,7 +284,7 @@ void vvDicomSeriesSelector::itemDetailsSelectionChanged() //==================================================================== //==================================================================== -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 QString vvDicomSeriesSelector::MakeDicomInfo(std::string & s, const gdcm::Reader& header) { QString n = QString("%1").arg(mListOfSeriesFilenames[s]->size()); @@ -357,7 +357,7 @@ QString vvDicomSeriesSelector::MakeDicomInfo(std::string & s, gdcm::File *header //==================================================================== QString vvDicomSeriesSelector::AddInfo(const gdcm::File *header, QString n, uint16_t group, uint16_t elem) { -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 gdcm::StringFilter sf; sf.SetFile( *header ); gdcm::Tag t( group, elem ); @@ -381,7 +381,7 @@ QString vvDicomSeriesSelector::AddInfo(std::string n, std::string m) //==================================================================== void vvDicomSeriesSelector::AddSerieToTheTable(int i, std::vector & filenames) { -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 #else gdcm::File *header = new gdcm::File(); header->SetFileName(filenames[0]); diff --git a/vv/vvQDicomSeriesSelector.h b/vv/vvQDicomSeriesSelector.h index aa905fc..b70e507 100644 --- a/vv/vvQDicomSeriesSelector.h +++ b/vv/vvQDicomSeriesSelector.h @@ -50,7 +50,7 @@ protected: QString mPreviousPath; QString mFoldername; void AddSerieToTheTable(int i, std::vector & filenames); -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 QString MakeDicomInfo(std::string & s, const gdcm::Reader& header); #else QString MakeDicomInfo(std::string & s, gdcm::File *header); @@ -64,7 +64,7 @@ private: std::map* > mListOfSeriesFilenames; std::vector * mFilenames; std::map mDicomInfo; -#if GDCM_MAJOR_VERSION == 2 +#if GDCM_MAJOR_VERSION >= 2 std::map mDicomHeader; #else std::map mDicomHeader; diff --git a/vv/vvSegmentationDialog.h b/vv/vvSegmentationDialog.h index f457df5..d359e5d 100644 --- a/vv/vvSegmentationDialog.h +++ b/vv/vvSegmentationDialog.h @@ -17,7 +17,12 @@ ===========================================================================**/ #ifndef _VVSEGMENTATIONDIALOG_H #define _VVSEGMENTATIONDIALOG_H +#include +#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9 #include "ui_vvSegmentationDialog.h" +#else +#include "ui_vvSegmentationDialogVTK7.h" +#endif #include "clitkCommon.h" #include "vvImage.h" #include "vvSlicerManager.h" diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index a53daf2..7405a45 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -653,7 +653,9 @@ void vvSlicer::SetVF(vvImage::Pointer vf) #else mVFMapper->SetInputConnection(mGlyphFilter->GetOutputPort()); #endif +#ifndef VTK_OPENGL2 mVFMapper->ImmediateModeRenderingOn(); +#endif mVFMapper->SetLookupTable(mVFColorLUT); if (!mVFActor) diff --git a/vv/vvSurfaceViewerDialog.h b/vv/vvSurfaceViewerDialog.h index f53c9bb..c0a8840 100644 --- a/vv/vvSurfaceViewerDialog.h +++ b/vv/vvSurfaceViewerDialog.h @@ -17,7 +17,12 @@ ===========================================================================**/ #ifndef _vvSurfaceViewerDialog_H #define _vvSurfaceViewerDialog_H +#include +#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9 #include "ui_vvSurfaceViewerDialog.h" +#else +#include "ui_vvSurfaceViewerDialogVTK7.h" +#endif class vtkPolyDataMapper; class vtkActor; diff --git a/vv/vvToolHistogram.cxx b/vv/vvToolHistogram.cxx index 293fbcd..939642a 100644 --- a/vv/vvToolHistogram.cxx +++ b/vv/vvToolHistogram.cxx @@ -311,7 +311,11 @@ void vvToolHistogram::InputIsSelected(vvSlicerManager * m) //------------------------------------------------------------------------------ +#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9 +QVTKOpenGLNativeWidget* vvToolHistogram::GetHistogramWidget() +#else QVTKWidget* vvToolHistogram::GetHistogramWidget() +#endif { return(HistogramWidget); } diff --git a/vv/vvToolHistogram.h b/vv/vvToolHistogram.h index 437e4e6..3897c90 100644 --- a/vv/vvToolHistogram.h +++ b/vv/vvToolHistogram.h @@ -27,7 +27,12 @@ #include "vvToolBase.h" #include "vvToolWidgetBase.h" +#include +#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9 #include "ui_vvToolHistogram.h" +#else +#include "ui_vvToolHistogramVTK7.h" +#endif #include "clitkHistogramImage_ggo.h" #include "clitkHistogramImageGenericFilter.h" @@ -61,7 +66,11 @@ class vvToolHistogram: void displayHistogram(); +#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9 + QVTKOpenGLNativeWidget* GetHistogramWidget(); +#else QVTKWidget* GetHistogramWidget(); +#endif //----------------------------------------------------- public slots: diff --git a/vv/vvToolProfile.h b/vv/vvToolProfile.h index 0410637..0f94ff3 100644 --- a/vv/vvToolProfile.h +++ b/vv/vvToolProfile.h @@ -29,7 +29,12 @@ #include "vvToolWidgetBase.h" #include "vvImageContour.h" #include "vvLandmarks.h" +#include +#if (VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1) || VTK_MAJOR_VERSION >= 9 #include "ui_vvToolProfile.h" +#else +#include "ui_vvToolProfileVTK7.h" +#endif #include "vvBinaryImageOverlayActor.h" #include "clitkProfileImage_ggo.h"